annotate lisp/textmodes/org.el @ 70585:af0fd91baddc

(org-read-date, org-goto-calendar, org-agenda-goto-calendar): Bind `view-calendar-holidays-initially' to nil.
author Carsten Dominik <dominik@science.uva.nl>
date Thu, 11 May 2006 08:49:36 +0000
parents 1f7b0f5ff852
children 7d0efe895341 a5812696f7bf
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/
70161
b9e09a4a2168 (org-mode-map): Catch conflict with old allout.el.
Carsten Dominik <dominik@science.uva.nl>
parents: 70136
diff changeset
8 ;; Version: 4.26
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 ;;
70161
b9e09a4a2168 (org-mode-map): Catch conflict with old allout.el.
Carsten Dominik <dominik@science.uva.nl>
parents: 70136
diff changeset
82 ;; Changes since version 4.10:
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
83 ;; ---------------------------
70161
b9e09a4a2168 (org-mode-map): Catch conflict with old allout.el.
Carsten Dominik <dominik@science.uva.nl>
parents: 70136
diff changeset
84 ;; Version 4.26
b9e09a4a2168 (org-mode-map): Catch conflict with old allout.el.
Carsten Dominik <dominik@science.uva.nl>
parents: 70136
diff changeset
85 ;; - Bug fixes.
b9e09a4a2168 (org-mode-map): Catch conflict with old allout.el.
Carsten Dominik <dominik@science.uva.nl>
parents: 70136
diff changeset
86 ;;
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
87 ;; Version 4.25
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
88 ;; - Revision of the font-lock faces section, with better tty support.
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
89 ;; - TODO keywords in Agenda buffer are fontified.
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
90 ;; - Export converts links between .org files to links between .html files.
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
91 ;; - Better support for bold/italic/underline emphasis.
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
92 ;;
70064
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
93 ;; Version 4.24
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
94 ;; - Bug fixes.
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
95 ;;
70010
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
96 ;; Version 4.23
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
97 ;; - Bug fixes.
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
98 ;;
69997
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
99 ;; Version 4.22
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
100 ;; - Bug fixes.
69997
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
101 ;; - 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
102 ;; 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
103 ;;
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
104 ;; Version 4.20
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
105 ;; - 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
106 ;; 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
107 ;; - 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
108 ;; 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
109 ;; - 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
110 ;; - 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
111 ;; - New structure for the customization tree.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
112 ;; - Bug fixes.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
113 ;;
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
114 ;; Version 4.13
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
115 ;; - 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
116 ;; - Bug fixes.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
117 ;;
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
118 ;; Version 4.12
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
119 ;; - 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
120 ;; 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
121 ;; - 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
122 ;; `org-time-stamp-rounding-minutes'.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
123 ;; - Bug fixes (there are *always* more bugs).
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
124 ;;
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
125 ;;; Code:
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
126
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
127 (eval-when-compile
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
128 (require 'cl)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
129 (require 'calendar))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
130 (require 'outline)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
131 (require 'time-date)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
132 (require 'easymenu)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
133
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
134 (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
135 (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
136 (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
137
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
138 ;;; Customization variables
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
139
70161
b9e09a4a2168 (org-mode-map): Catch conflict with old allout.el.
Carsten Dominik <dominik@science.uva.nl>
parents: 70136
diff changeset
140 (defvar org-version "4.26"
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
141 "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
142 (defun org-version ()
8e7a2f6f9fa7 (org-version): Unnecessary prefix arg removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 59547
diff changeset
143 (interactive)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
144 (message "Org-mode version %s" org-version))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
145
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
146 ;; 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
147 ;; of outline.el.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
148 (defconst org-noutline-p (featurep 'noutline)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
149 "Are we using the new outline mode?")
70161
b9e09a4a2168 (org-mode-map): Catch conflict with old allout.el.
Carsten Dominik <dominik@science.uva.nl>
parents: 70136
diff changeset
150 (defconst org-xemacs-p (featurep 'xemacs)) ; not used by org.el itself
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
151 (defconst org-format-transports-properties-p
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
152 (let ((x "a"))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
153 (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
154 (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
155 "Does format transport text properties?")
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
156
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
157 (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
158 "Outline-based notes management and organizer."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
159 :tag "Org"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
160 :group 'outlines
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
161 :group 'hypermedia
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
162 :group 'calendar)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
163
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
164 (defgroup org-startup nil
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
165 "Options concerning startup of Org-mode."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
166 :tag "Org Startup"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
167 :group 'org)
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 (defcustom org-startup-folded t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
170 "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
171 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
172 the following lines anywhere in the buffer:
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
173
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
174 #+STARTUP: fold
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
175 #+STARTUP: nofold
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
176 #+STARTUP: content"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
177 :group 'org-startup
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
178 :type '(choice
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
179 (const :tag "nofold: show all" nil)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
180 (const :tag "fold: overview" t)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
181 (const :tag "content: all headlines" content)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
182
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
183 (defcustom org-startup-truncated t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
184 "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
185 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
186 uninteresting. Also tables look terrible when wrapped."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
187 :group 'org-startup
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
188 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
189
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
190 (defcustom org-startup-align-all-tables nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
191 "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
192 This is useful when the column width in tables is forced with <N> cookies
70064
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
193 in table fields. Such tables will look correct only after the first re-align.
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
194 This can also be configured on a per-file basis by adding one of
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
195 the following lines anywhere in the buffer:
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
196 #+STARTUP: align
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
197 #+STARTUP: noalign"
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
198 :group 'org-startup
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
199 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
200
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
201 (defcustom org-startup-with-deadline-check nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
202 "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
203 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
204 immediate reminder of any due deadlines.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
205 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
206 the following lines anywhere in the buffer:
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
207 #+STARTUP: dlcheck
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
208 #+STARTUP: nodlcheck"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
209 :group 'org-startup
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
210 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
211
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
212 (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
213 "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
214 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
215 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
216 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
217 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
218 has been set."
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 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
221
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
222 (defcustom org-CUA-compatible nil
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
223 "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
224 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
225 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
226 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
227 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
228 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
229
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
230 S-RET -> C-S-RET
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
231 S-up -> M-p
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
232 S-down -> M-n
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
233 S-left -> M--
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
234 S-right -> M-+
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
235
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
236 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
237 `org-disputed-keys'.
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
238
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
239 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
240 a restart of Emacs to become effective."
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
241 :group 'org-startup
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
242 :type 'boolean)
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
243
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
244 (defvar org-disputed-keys
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
245 '((S-up [(shift up)] [(meta ?p)])
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
246 (S-down [(shift down)] [(meta ?n)])
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
247 (S-left [(shift left)] [(meta ?-)])
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
248 (S-right [(shift right)] [(meta ?+)])
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
249 (S-return [(shift return)] [(control shift return)]))
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
250 "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
251 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
252 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
253
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
254 (defun org-key (key)
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
255 "Select a key according to `org-CUA-compatible'."
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
256 (nth (if org-CUA-compatible 2 1)
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
257 (or (assq key org-disputed-keys)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
258 (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
259
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
260 (defcustom org-ellipsis nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
261 "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
262 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
263 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
264 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
265 effective."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
266 :group 'org-startup
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
267 :type '(choice (const :tag "Default" nil)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
268 (string :tag "String" :value "...#")))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
269
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
270 (defvar org-display-table nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
271 "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
272
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
273 (defgroup org-keywords nil
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
274 "Keywords in Org-mode."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
275 :tag "Org Keywords"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
276 :group 'org)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
277
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
278 (defcustom org-deadline-string "DEADLINE:"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
279 "String to mark deadline entries.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
280 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
281 terminated by a colon. You can insert a schedule keyword and
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
282 a timestamp with \\[org-deadline].
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
283 Changes become only effective after restarting Emacs."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
284 :group 'org-keywords
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
285 :type 'string)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
286
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
287 (defcustom org-scheduled-string "SCHEDULED:"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
288 "String to mark scheduled TODO entries.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
289 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
290 terminated by a colon. You can insert a schedule keyword and
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
291 a timestamp with \\[org-schedule].
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
292 Changes become only effective after restarting Emacs."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
293 :group 'org-keywords
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
294 :type 'string)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
295
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
296 (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
297 "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
298 :group 'org-keywords
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
299 :type 'string)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
300
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
301 (defcustom org-comment-string "COMMENT"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
302 "Entries starting with this keyword will never be exported.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
303 An entry can be toggled between COMMENT and normal with
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
304 \\[org-toggle-comment].
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
305 Changes become only effective after restarting Emacs."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
306 :group 'org-keywords
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
307 :type 'string)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
308
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
309 (defcustom org-quote-string "QUOTE"
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
310 "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
311 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
312 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
313 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
314 \\[org-toggle-fixed-width-section]."
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
315 :group 'org-keywords
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
316 :type 'string)
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
317
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
318 (defgroup org-structure nil
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
319 "Options concerning the general structure of Org-mode files."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
320 :tag "Org Structure"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
321 :group 'org)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
322
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
323 (defgroup org-cycle nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
324 "Options concerning visibility cycling in Org-mode."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
325 :tag "Org Cycle"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
326 :group 'org-structure)
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
327
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
328 (defcustom org-cycle-emulate-tab t
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
329 "Where should `org-cycle' emulate TAB.
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
330 nil Never
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
331 white Only in completely white lines
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
332 t Everywhere except in headlines"
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
333 :group 'org-cycle
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
334 :type '(choice (const :tag "Never" nil)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
335 (const :tag "Only in completely white lines" white)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
336 (const :tag "Everywhere except in headlines" t)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
337 ))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
338
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
339 (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
340 "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
341 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
342 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
343 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
344 `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
345 the values `folded', `children', or `subtree'."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
346 :group 'org-cycle
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
347 :type 'hook)
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
348
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
349 (defgroup org-edit-structure nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
350 "Options concerning structure editing in Org-mode."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
351 :tag "Org Edit Structure"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
352 :group 'org-structure)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
353
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
354 (defcustom org-odd-levels-only nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
355 "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
356 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
357 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
358 handled by the exporters.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
359 Changing it requires restart of `font-lock-mode' to become effective
70064
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
360 for fontification also in regions already fontified.
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
361 You may also set this on a per-file basis by adding one of the following
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
362 lines to the buffer:
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
363
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
364 #+STARTUP: odd
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
365 #+STARTUP: oddeven"
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
366 :group 'org-edit-structure
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
367 :group 'org-font-lock
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
368 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
369
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
370 (defcustom org-adapt-indentation t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
371 "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
372 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
373 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
374 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
375 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
376 :group 'org-edit-structure
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
377 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
378
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
379 (defcustom org-enable-fixed-width-editor t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
380 "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
381 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
382 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
383 See also the QUOTE keyword."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
384 :group 'org-edit-structure
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
385 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
386
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
387 (defgroup org-sparse-trees nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
388 "Options concerning sparse trees in Org-mode."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
389 :tag "Org Sparse Trees"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
390 :group 'org-structure)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
391
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
392 (defcustom org-highlight-sparse-tree-matches t
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
393 "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
394 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
395 changed by an edit command."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
396 :group 'org-sparse-trees
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
397 :type 'boolean)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
398
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
399 (defcustom org-show-hierarchy-above t
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
400 "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
401 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
402 :group 'org-sparse-trees
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
403 :type 'boolean)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
404
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
405 (defcustom org-show-following-heading t
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
406 "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
407 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
408 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
409 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
410 `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
411 unnecessary clutter."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
412 :group 'org-sparse-trees
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
413 :type 'boolean)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
414
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
415 (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
416 "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
417 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
418 as possible."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
419 :group 'org-sparse-trees
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
420 :type 'hook)
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
421
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
422 (defgroup org-plain-lists nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
423 "Options concerning plain lists in Org-mode."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
424 :tag "Org Plain lists"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
425 :group 'org-structure)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
426
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
427 (defcustom org-cycle-include-plain-lists nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
428 "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
429 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
430 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
431 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
432 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
433 such an item."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
434 :group 'org-plain-lists
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
435 :type 'boolean)
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
436
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
437
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
438 (defcustom org-plain-list-ordered-item-terminator t
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
439 "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
440 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
441 ?. 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
442 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
443 the safe choice."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
444 :group 'org-plain-lists
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
445 :type '(choice (const :tag "dot like in \"2.\"" ?.)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
446 (const :tag "paren like in \"2)\"" ?\))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
447 (const :tab "both" t)))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
448
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
449 (defcustom org-auto-renumber-ordered-lists t
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
450 "Non-nil means, automatically renumber ordered plain lists.
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
451 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
452 \\[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
453 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
454 :group 'org-plain-lists
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
455 :type 'boolean)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
456
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
457 (defgroup org-archive nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
458 "Options concerning archiving in Org-mode."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
459 :tag "Org Archive"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
460 :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
461
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
462 (defcustom org-archive-location "%s_archive::"
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
463 "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
464 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
465
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
466 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
467 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
468 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
469 contributing to the Org-mode Agenda.
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
470
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
471 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
472 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
473 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
474
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
475 Here are a few examples:
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
476 \"%s_archive::\"
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
477 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
478 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
479
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
480 \"::* Archived Tasks\"
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
481 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
482 \"* Archived Tasks\".
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
483
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
484 \"~/org/archive.org::\"
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
485 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
486
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
487 \"basement::** Finished Tasks\"
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
488 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
489 below the level 2 heading \"** Finished Tasks\".
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
490
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
491 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
492 line like
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
493
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
494 #+ARCHIVE: basement::** Finished Tasks"
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
495 :group 'org-archive
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
496 :type 'string)
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
497
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
498 (defcustom org-archive-mark-done t
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
499 "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
500 :group 'org-archive
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
501 :type 'boolean)
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
502
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
503 (defcustom org-archive-stamp-time t
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
504 "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
505 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
506 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
507 `org-archive-mark-done'."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
508 :group 'org-archive
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
509 :type 'boolean)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
510
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
511 (defgroup org-table nil
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
512 "Options concerning tables in Org-mode."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
513 :tag "Org Table"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
514 :group 'org)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
515
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
516 (defcustom org-enable-table-editor 'optimized
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
517 "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
518 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
519
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
520 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
521 do the following:
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
522 - 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
523 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
524 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
525 - 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
526 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
527 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
528 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
529 `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
530 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
531 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
532 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
533
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
534 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
535 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
536
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
537 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
538 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
539
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
540 See also the variable `org-table-auto-blank-field'."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
541 :group 'org-table
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
542 :type '(choice
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
543 (const :tag "off" nil)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
544 (const :tag "on" t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
545 (const :tag "on, optimized" optimized)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
546
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
547 (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
548 "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
549 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
550 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
551 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
552 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
553 restored.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
554
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
555 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
556 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
557 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
558 :group 'org-table
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
559 :type 'boolean)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
560
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
561 (defgroup org-table-settings nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
562 "Settings for tables in Org-mode."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
563 :tag "Org Table Settings"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
564 :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
565
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
566 (defcustom org-table-default-size "5x2"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
567 "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
568 :group 'org-table-settings
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
569 :type 'string)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
570
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
571 (defcustom org-table-number-regexp "^[<>]?[-+^.0-9]*[0-9][-+^.0-9eEdDx()%]*$"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
572 "Regular expression for recognizing numbers in table columns.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
573 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
574 right. If not, it will be aligned to the left.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
575
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
576 The default value of this option is a regular expression which allows
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
577 anything which looks remotely like a number as used in scientific
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
578 context. For example, all of the following will be considered a
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
579 number:
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
580 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
581
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
582 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
583 :group 'org-table-settings
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
584 :type '(choice
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
585 (const :tag "Positive Integers"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
586 "^[0-9]+$")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
587 (const :tag "Integers"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
588 "^[-+]?[0-9]+$")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
589 (const :tag "Floating Point Numbers"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
590 "^[-+]?\\([0-9]*\\.[0-9]+\\|[0-9]+\\.[0-9]*\\)$")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
591 (const :tag "Floating Point Number or Integer"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
592 "^[-+]?\\([0-9]*\\.[0-9]+\\|[0-9]+\\.?[0-9]*\\)$")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
593 (const :tag "Exponential, Floating point, Integer"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
594 "^[-+]?[0-9.]+\\([eEdD][-+0-9]+\\)?$")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
595 (const :tag "Very General Number-Like"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
596 "^[<>]?[-+^.0-9]*[0-9][-+^.0-9eEdDx()%]*$")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
597 (string :tag "Regexp:")))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
598
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
599 (defcustom org-table-number-fraction 0.5
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
600 "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
601 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
602 fraction of fields is matched by `org-table-number-fraction',
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
603 alignment to the right border applies."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
604 :group 'org-table-settings
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
605 :type 'number)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
606
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
607 (defgroup org-table-editing nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
608 "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
609 :tag "Org Table Editing"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
610 :group 'org-table)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
611
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
612 (defcustom org-table-automatic-realign t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
613 "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
614 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
615 removal/insertion."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
616 :group 'org-table-editing
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
617 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
618
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
619 (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
620 "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
621 :group 'org-table-editing
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
622 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
623
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
624 (defcustom org-table-auto-blank-field t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
625 "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
626 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
627 command (TAB, S-TAB or RET).
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
628 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
629 :group 'org-table-editing
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
630 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
631
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
632 (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
633 "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
634 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
635 `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
636 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
637 this line."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
638 :group 'org-table-editing
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
639 :type 'boolean)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
640
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
641 (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
642 "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
643 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
644 calls `table-recognize-table'."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
645 :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
646 :type 'boolean)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
647
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
648 (defgroup org-table-calculation nil
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
649 "Options concerning tables in Org-mode."
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
650 :tag "Org Table Calculation"
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
651 :group 'org-table)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
652
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
653 (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
654 "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
655 :group 'org-table-calculation
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
656 :type 'boolean)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
657
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
658 (defcustom org-calc-default-modes
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
659 '(calc-internal-prec 12
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
660 calc-float-format (float 5)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
661 calc-angle-mode deg
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
662 calc-prefer-frac nil
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
663 calc-symbolic-mode nil
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
664 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
665 calc-display-working-message t
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
666 )
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
667 "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
668 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
669 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
670 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
671 :group 'org-table-calculation
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
672 :type 'plist)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
673
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
674 (defcustom org-table-formula-evaluate-inline t
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
675 "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
676 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
677 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
678 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
679 Emacs calc package.
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
680 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
681 the command \\[org-table-eval-formula]."
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
682 :group 'org-table-calculation
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
683 :type 'boolean)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
684
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
685
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
686 (defcustom org-table-formula-use-constants t
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
687 "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
688 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
689 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
690 from the `constants.el' package."
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
691 :group 'org-table-calculation
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
692 :type 'boolean)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
693
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
694 (defcustom org-table-formula-constants nil
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
695 "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
696 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
697 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
698 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
699
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
700 (setq org-table-formula-constants '((\"c\" . \"299792458.\")))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
701
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
702 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
703 :group 'org-table-calculation
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
704 :type '(repeat
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
705 (cons (string :tag "name")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
706 (string :tag "value"))))
63832
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-numbers-only nil
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
709 "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
710 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
711 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
712 in table calculations, including symbolics etc."
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
713 :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
714 :type 'boolean)
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
715
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
716 (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
717 "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
718 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
719 :group 'org-table-calculation
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
720 :type 'boolean)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
721
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
722 (defgroup org-link nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
723 "Options concerning links in Org-mode."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
724 :tag "Org Link"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
725 :group 'org)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
726
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
727 (defcustom org-descriptive-links t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
728 "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
729 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
730 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
731 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
732 :group 'org-link
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
733 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
734
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
735 (defcustom org-link-style 'bracket
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
736 "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
737 Possible values are:
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
738 bracket [[link][description]]. This is recommended
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
739 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
740 :group 'org-link
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
741 :type '(choice
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
742 (const :tag "Bracket (recommended)" bracket)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
743 (const :tag "Plain (no longer recommended)" plain)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
744
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
745 (defcustom org-link-format "%s"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
746 "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
747 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
748 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
749 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
750 `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
751 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
752 :group 'org-link
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
753 :type '(choice
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
754 (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
755 (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
756 (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
757 (string :tag "Other" :value "<%s>")))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
758
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
759 (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
760 "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
761 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
762 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
763 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
764
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
765 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
766 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
767 <bbdb:Carsten Dominik>.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
768 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
769 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
770 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
771 date Time stamps (link to calendar).
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
772 camel CamelCase words defining text searches.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
773
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
774 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
775 :group 'org-link
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
776 :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
777 (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
778 (const :tag "plain text links" plain)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
779 (const :tag "Radio target matches" radio)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
780 (const :tag "Tags" tag)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
781 (const :tag "Timestamps" date)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
782 (const :tag "CamelCase words" camel)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
783
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
784 (defgroup org-link-store nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
785 "Options concerning storing links in Org-mode"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
786 :tag "Org Store Link"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
787 :group 'org-link)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
788
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
789 (defcustom org-context-in-file-links t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
790 "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
791 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
792 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
793 `org-open-at-point'.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
794 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
795 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
796 :group 'org-link-store
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
797 :type 'boolean)
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 (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
800 "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
801 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
802 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
803 :group 'org-link-store
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
804 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
805
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
806 (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
807 "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
808
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
809 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
810 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
811 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
812 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
813 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
814 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
815 more efficient."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
816 :group 'org-link-store
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
817 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
818
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
819 (defcustom org-usenet-links-prefer-google nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
820 "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
821 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
822 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
823 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
824 :group 'org-link-store
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
825 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
826
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
827 (defgroup org-link-follow nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
828 "Options concerning following links in Org-mode"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
829 :tag "Org Follow Link"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
830 :group 'org-link)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
831
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
832 (defcustom org-tab-follows-link nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
833 "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
834 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
835 :group 'org-link-follow
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
836 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
837
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
838 (defcustom org-return-follows-link nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
839 "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
840 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
841 :group 'org-link-follow
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
842 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
843
69997
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
844 (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
845 "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
846 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
847 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
848 :group 'org-link-follow
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
849 :type 'boolean)
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
850
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
851 (defcustom org-mark-ring-length 4
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
852 "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
853 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
854 :group 'org-link-follow
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
855 :type 'interger)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
856
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
857 (defcustom org-link-frame-setup
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
858 '((vm . vm-visit-folder-other-frame)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
859 (gnus . gnus-other-frame)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
860 (file . find-file-other-window))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
861 "Setup the frame configuration for following links.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
862 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
863 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
864 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
865 For VM, use any of
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
866 `vm-visit-folder'
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
867 `vm-visit-folder-other-frame'
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
868 For Gnus, use any of
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
869 `gnus'
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
870 `gnus-other-frame'
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
871 For FILE, use any of
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
872 `find-file'
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
873 `find-file-other-window'
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
874 `find-file-other-frame'
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
875 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
876 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
877 another window."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
878 :group 'org-link-follow
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
879 :type '(list
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
880 (cons (const vm)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
881 (choice
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
882 (const vm-visit-folder)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
883 (const vm-visit-folder-other-window)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
884 (const vm-visit-folder-other-frame)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
885 (cons (const gnus)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
886 (choice
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
887 (const gnus)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
888 (const gnus-other-frame)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
889 (cons (const file)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
890 (choice
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
891 (const find-file)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
892 (const find-file-other-window)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
893 (const find-file-other-frame)))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
894
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
895 (defcustom org-open-non-existing-files nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
896 "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
897 When nil, an error will be generated."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
898 :group 'org-link-follow
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
899 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
900
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
901 (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
902 "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
903 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
904
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
905 [[shell:rm -rf ~/*][Google Search]]
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
906
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
907 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
908 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
909 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
910 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
911 rather than having to type \"yes\"."
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 '(choice
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
914 (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
915 (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
916 (const :tag "no confirmation (dangerous)" nil)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
917
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
918 (defconst org-file-apps-defaults-gnu
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
919 '((t . mailcap))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
920 "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
921 See `org-file-apps'.")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
922
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
923 (defconst org-file-apps-defaults-macosx
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
924 '((t . "open %s")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
925 ("ps" . "gv %s")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
926 ("ps.gz" . "gv %s")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
927 ("eps" . "gv %s")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
928 ("eps.gz" . "gv %s")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
929 ("dvi" . "xdvi %s")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
930 ("fig" . "xfig %s"))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
931 "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
932 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
933 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
934 See `org-file-apps'.")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
935
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
936 (defconst org-file-apps-defaults-windowsnt
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
937 '((t . (w32-shell-execute "open" file)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
938 "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
939 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
940 See `org-file-apps'.")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
941
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
942 (defcustom org-file-apps
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
943 '(
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
944 ("txt" . emacs)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
945 ("tex" . emacs)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
946 ("ltx" . emacs)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
947 ("org" . emacs)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
948 ("el" . emacs)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
949 )
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
950 "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
951 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
952 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
953 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
954 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
955 `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
956 `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
957 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
958 by the path to the file.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
959 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
960 be available in the Lisp variable `file'.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
961 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
962 `org-file-apps-defaults-macosx'
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
963 `org-file-apps-defaults-windowsnt'
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
964 `org-file-apps-defaults-gnu'."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
965 :group 'org-link-follow
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
966 :type '(repeat
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
967 (cons (choice :value ""
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
968 (string :tag "Extension")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
969 (const :tag "Default for unrecognized files" t)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
970 (const :tag "Links to a directory" directory))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
971 (choice :value ""
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
972 (const :tag "Visit with Emacs" emacs)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
973 (const :tag "Use system default" default)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
974 (string :tag "Command")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
975 (sexp :tag "Lisp form")))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
976
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
977 (defcustom org-mhe-search-all-folders nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
978 "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
979 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
980 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
981 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
982 :group 'org-link-follow
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
983 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
984
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
985 (defgroup org-remember nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
986 "Options concerning interaction with remember.el."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
987 :tag "Org Remember"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
988 :group 'org)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
989
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
990 (defcustom org-directory "~/org"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
991 "Directory with org files.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
992 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
993 Used by the hooks for remember.el."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
994 :group 'org-remember
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
995 :type 'directory)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
996
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
997 (defcustom org-default-notes-file "~/.notes"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
998 "Default target for storing notes.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
999 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
1000 the value of `remember-data-file'."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1001 :group 'org-remember
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1002 :type '(choice
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1003 (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
1004 file))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1005
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1006 (defcustom org-remember-templates nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1007 "Templates for the creation of remember buffers.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1008 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
1009 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
1010 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
1011 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
1012 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
1013 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
1014
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1015 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
1016 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
1017 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
1018 %t time stamp, date only
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1019 %T time stamp with date and time
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1020 %u inactive time stamp, date only
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1021 %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
1022 %n user name
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1023 %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
1024 %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
1025 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
1026 %? 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
1027 :group 'org-remember
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1028 :type '(repeat :tag "enabled"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1029 (list :value (?a "\n" nil)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1030 (character :tag "Selection Key")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1031 (string :tag "Template")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1032 (file :tag "Destination file (optional)"))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1033
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1034 (defcustom org-reverse-note-order nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1035 "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
1036 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
1037 :group 'org-remember
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1038 :type '(choice
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1039 (const :tag "Reverse always" t)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1040 (const :tag "Reverse never" nil)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1041 (repeat :tag "By file name regexp"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1042 (cons regexp boolean))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1043
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1044 (defgroup org-todo nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1045 "Options concerning TODO items in Org-mode."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1046 :tag "Org TODO"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1047 :group 'org)
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 (defcustom org-todo-keywords '("TODO" "DONE")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1050 "List of TODO entry keywords.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1051 \\<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
1052 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
1053 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
1054 etc.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1055 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
1056 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
1057 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
1058 Changes become only effective after restarting Emacs."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1059 :group 'org-todo
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1060 :group 'org-keywords
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1061 :type '(repeat (string :tag "Keyword")))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1062
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1063 (defcustom org-todo-interpretation 'sequence
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1064 "Controls how TODO keywords are interpreted.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1065 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
1066 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
1067
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1068 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
1069 `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
1070 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
1071 switches directly to DONE from any state.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1072 See the manual for more information."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1073 :group 'org-todo
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1074 :group 'org-keywords
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1075 :type '(choice (const sequence)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1076 (const type)))
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 (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
1079 "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
1080 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
1081 Lisp variable `state'."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1082 :group 'org-todo
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1083 :type 'hook)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1084
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1085 (defcustom org-log-done nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1086 "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
1087 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
1088 closing date."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1089 :group 'org-todo
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1090 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1091
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1092 (defgroup org-priorities nil
70064
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
1093 "Priorities in Org-mode."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1094 :tag "Org Priorities"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1095 :group 'org-todo)
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-default-priority ?B
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1098 "The default priority of TODO items.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1099 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
1100 :group 'org-priorities
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1101 :type 'character)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1102
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1103 (defcustom org-lowest-priority ?C
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1104 "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
1105 :group 'org-priorities
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1106 :type 'character)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1107
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1108 (defgroup org-time nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1109 "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
1110 :tag "Org Time"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1111 :group 'org)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1112
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1113 (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
1114 "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
1115 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
1116
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1117 (defcustom org-time-stamp-rounding-minutes 0
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1118 "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
1119 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
1120 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
1121 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
1122 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
1123 :group 'org-time
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1124 :type 'integer)
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 (defcustom org-deadline-warning-days 30
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1127 "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
1128 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
1129 :group 'org-time
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1130 :type 'number)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1131
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1132 (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
1133 "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
1134 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
1135 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
1136 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
1137 :group 'org-time
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1138 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1139
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1140 (defcustom org-calendar-follow-timestamp-change t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1141 "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
1142 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
1143 moved to the new date."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1144 :group 'org-time
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1145 :type 'boolean)
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 (defgroup org-tags nil
70064
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
1148 "Options concerning tags in Org-mode."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1149 :tag "Org Tags"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1150 :group 'org)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1151
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1152 (defcustom org-tags-column 48
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1153 "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
1154 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
1155 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
1156 -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
1157 :group 'org-tags
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-auto-align-tags t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1161 "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
1162 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
1163 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
1164 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
1165 :group 'org-tags
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1166 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1167
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1168 (defcustom org-use-tag-inheritance t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1169 "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
1170 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
1171 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
1172 companion option `org-tags-match-list-sublevels'."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1173 :group 'org-tags
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1174 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1175
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1176 (defcustom org-tags-match-list-sublevels nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1177 "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
1178 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
1179 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
1180 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
1181 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
1182 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
1183 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
1184
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1185 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
1186 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
1187 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
1188 :group 'org-tags
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1189 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1190
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1191 (defvar org-tags-history nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1192 "History of minibuffer reads for tags.")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1193 (defvar org-last-tags-completion-table nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1194 "The last used completion table for tags.")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1195
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1196 (defgroup org-agenda nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1197 "Options concerning agenda display Org-mode."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1198 :tag "Org Agenda"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1199 :group 'org)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1200
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1201 (defvar org-category nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1202 "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
1203 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
1204
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1205 -*- mode: org; org-category: \"ELisp\"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1206
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1207 or contain a special line
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1208
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1209 #+CATEGORY: ELisp
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1210
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1211 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
1212 is used instead.")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1213 (make-variable-buffer-local 'org-category)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1214
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1215 (defcustom org-agenda-files nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1216 "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
1217 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
1218 \\[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
1219
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1220 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
1221 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
1222 agenda file per line."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1223 :group 'org-agenda
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1224 :type '(choice
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1225 (repeat :tag "List of files" file)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1226 (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
1227
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1228 (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
1229 "Custom commands for the agenda.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1230 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
1231 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
1232
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1233 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
1234 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
1235 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
1236 tags Tags match in all agenda files.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1237 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
1238 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
1239 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
1240 match What to search for:
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1241 - a single keyword for TODO keyword searches
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1242 - a tags match expression for tags searches
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1243 - a regular expression for occur searches"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1244 :group 'org-agenda
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1245 :type '(repeat
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1246 (list (string :tag "Key")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1247 (choice :tag "Type"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1248 (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
1249 (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
1250 (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
1251 (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
1252 (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
1253 (string :tag "Match"))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1254
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1255 (defcustom org-agenda-include-all-todo t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1256 "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
1257 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
1258 with a prefix argument.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1259 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
1260 the entries for specific days."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1261 :group 'org-agenda
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1262 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1263
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1264 (defcustom org-agenda-include-diary nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1265 "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
1266 :group 'org-agenda
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1267 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1268
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1269 (defcustom org-calendar-to-agenda-key [?c]
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1270 "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
1271 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
1272 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
1273 forth between agenda and calendar."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1274 :group 'org-agenda
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1275 :type 'sexp)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1276
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1277 (defgroup org-agenda-window-setup nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1278 "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
1279 :tag "Org Agenda Window Setup"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1280 :group 'org-agenda)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1281
69997
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
1282 (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
1283 "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
1284 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
1285 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
1286 :group 'org-agenda-setup
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
1287 :type 'boolean)
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
1288
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1289 (defcustom org-select-timeline-window t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1290 "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
1291 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
1292 :group 'org-agenda-setup
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1293 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1294
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1295 (defcustom org-select-agenda-window t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1296 "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
1297 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
1298 :group 'org-agenda-setup
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1299 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1300
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1301 (defcustom org-fit-agenda-window t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1302 "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
1303 :group 'org-agenda-setup
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1304 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1305
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1306 (defgroup org-agenda-display nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1307 "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
1308 :tag "Org Agenda Display"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1309 :group 'org-agenda)
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 (defcustom org-agenda-show-all-dates t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1312 "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
1313 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
1314 :group 'org-agenda-display
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1315 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1316
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1317 (defcustom org-agenda-start-on-weekday 1
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1318 "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
1319 0 denotes Sunday, 1 denotes Monday etc.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1320 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
1321 :group 'org-agenda-display
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1322 :type '(choice (const :tag "Today" nil)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1323 (number :tag "Weekday No.")))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1324
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1325 (defcustom org-agenda-ndays 7
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1326 "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
1327 Should be 1 or 7."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1328 :group 'org-agenda-display
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1329 :type 'number)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1330
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1331 (defcustom org-agenda-use-time-grid t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1332 "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
1333 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
1334 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
1335 sorted in between these lines.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1336 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
1337 the variable `org-agenda-time-grid'."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1338 :group 'org-agenda-display
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1339 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1340
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1341 (defcustom org-agenda-time-grid
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1342 '((daily today require-timed)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1343 "----------------"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1344 (800 1000 1200 1400 1600 1800 2000))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1345
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1346 "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
1347 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
1348 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
1349
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1350 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
1351 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
1352 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
1353 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
1354
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1355 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
1356
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1357 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
1358 a grid line."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1359 :group 'org-agenda-display
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1360 :type
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1361 '(list
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1362 (set :greedy t :tag "Grid Display Options"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1363 (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
1364 (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
1365 (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
1366 (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
1367 require-timed)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1368 (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
1369 remove-match))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1370 (string :tag "Grid String")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1371 (repeat :tag "Grid Times" (integer :tag "Time"))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1372
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1373 (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
1374 "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
1375 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
1376 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
1377 symbols are recognized:
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1378
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1379 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
1380 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
1381 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
1382 sequence in `org-agenda-files'.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1383 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
1384 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
1385 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
1386 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
1387
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1388 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
1389 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
1390 '(time-up category-keep priority-down)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1391 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
1392 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
1393 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
1394 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
1395 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
1396 priority.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1397
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1398 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
1399 categories by priority."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1400 :group 'org-agenda-display
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1401 :type '(repeat
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1402 (choice
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1403 (const time-up)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1404 (const time-down)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1405 (const category-keep)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1406 (const category-up)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1407 (const category-down)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1408 (const priority-up)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1409 (const priority-down))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1410
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1411 (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
1412 "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
1413 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
1414 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
1415 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
1416 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
1417 agenda entries."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1418 :group 'org-agenda-display
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1419 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1420
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 (defgroup org-agenda-prefix nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1423 "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
1424 :tag "Org Agenda Prefix"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1425 :group 'org-agenda)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1426
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1427 (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
1428 "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
1429 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
1430
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1431 %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
1432 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
1433 %T the first tag of the item.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1434 %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
1435 format HH:MM
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1436 %s Scheduling/Deadline information, a short string
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1437
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1438 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
1439 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
1440 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
1441
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1442 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
1443 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
1444 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
1445 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
1446 \"%?-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
1447 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
1448 not contain a time.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1449
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1450 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
1451 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
1452 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
1453 \"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
1454 empty, no additional colon would be interted.
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 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
1457 - Indent the line with two space characters
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1458 - 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
1459 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
1460 (because of `:').
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1461 - 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
1462 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
1463 - 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
1464
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1465 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
1466 the prefix, you could use:
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1467
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1468 (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
1469
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1470 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
1471 `org-agenda-remove-tags-when-in-prefix'."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1472 :type 'string
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1473 :group 'org-agenda-prefix)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1474
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1475 (defcustom org-timeline-prefix-format " % s"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1476 "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
1477 :type 'string
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1478 :group 'org-agenda-prefix)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1479
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1480 (defvar org-prefix-format-compiled nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1481 "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
1482 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
1483 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
1484
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1485 ;; 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
1486 (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
1487 "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
1488 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
1489 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
1490 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
1491 \(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
1492 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
1493 cluttered.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1494 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
1495 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
1496 the headline/diary entry."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1497 :group 'org-agenda-prefix
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1498 :type '(choice
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1499 (const :tag "Always" t)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1500 (const :tag "Never" nil)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1501 (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
1502
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1503 (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
1504 "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
1505 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
1506 `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
1507 :group 'org-agenda-prefix
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1508 :type '(choice
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1509 (const :tag "Always" t)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1510 (const :tag "Never" nil)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1511 (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
1512
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1513 (defgroup org-export nil
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1514 "Options for exporting org-listings."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1515 :tag "Org Export"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1516 :group 'org)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1517
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1518 (defgroup org-export-general nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1519 "General options for exporting Org-mode files."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1520 :tag "Org Export General"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1521 :group 'org-export)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1522
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1523 (defcustom org-export-language-setup
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1524 '(("en" "Author" "Date" "Table of Contents")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1525 ("da" "Ophavsmand" "Dato" "Indhold")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1526 ("de" "Autor" "Datum" "Inhaltsverzeichnis")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1527 ("es" "Autor" "Fecha" "\xccndice")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1528 ("fr" "Auteur" "Date" "Table des Mati\xe8res")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1529 ("it" "Autore" "Data" "Indice")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1530 ("nl" "Auteur" "Datum" "Inhoudsopgave")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1531 ("nn" "Forfattar" "Dato" "Innhold") ;; nn = Norsk (nynorsk)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1532 ("sv" "F\xf6rfattarens" "Datum" "Inneh\xe5ll"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1533 "Terms used in export text, translated to different languages.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1534 Use the variable `org-export-default-language' to set the language,
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1535 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
1536 :group 'org-export-general
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1537 :type '(repeat
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
1538 (list
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
1539 (string :tag "HTML language tag")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
1540 (string :tag "Author")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
1541 (string :tag "Date")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
1542 (string :tag "Table of Contents"))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1543
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1544 (defcustom org-export-default-language "en"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1545 "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
1546 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
1547 :group 'org-export-general
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
1548 :type 'string)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
1549
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1550 (defcustom org-export-headline-levels 3
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1551 "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
1552 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
1553 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
1554 this setting.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1555
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1556 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
1557 :group 'org-export-general
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1558 :type 'number)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1559
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1560 (defcustom org-export-with-section-numbers t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1561 "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
1562
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1563 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
1564 :group 'org-export-general
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1565 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1566
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1567 (defcustom org-export-with-toc t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1568 "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
1569 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
1570
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1571 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
1572 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
1573
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1574 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
1575
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1576 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
1577 :group 'org-export-general
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1578 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1579
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1580 (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
1581 "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
1582 :group 'org-export-general
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1583 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1584
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1585 (defcustom org-export-preserve-breaks nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1586 "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
1587 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
1588 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
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. \"\\n:t\"."
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 'boolean)
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 (defgroup org-export-translation nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1595 "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
1596 :tag "Org Export Translation"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1597 :group 'org-export)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1598
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1599 (defcustom org-export-with-emphasize t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1600 "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
1601 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
1602 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
1603 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
1604 Not all export backends support this.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1605
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1606 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
1607 :group 'org-export-translation
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1608 :type 'boolean)
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 (defcustom org-export-with-sub-superscripts t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1611 "Non-nil means, interpret \"_\" and \"^\" for export.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1612 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
1613 superscripts. Several characters after \"_\" or \"^\" will be
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1614 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
1615 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
1616 sub- or superscripts.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1617
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1618 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
1619 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
1620 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
1621 terminated by almost any nonword/nondigit char.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1622 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
1623
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1624 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
1625 sub/superscript.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1626 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
1627
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1628 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
1629 :group 'org-export-translation
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1630 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1631
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1632 (defcustom org-export-with-TeX-macros t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1633 "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
1634 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
1635 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
1636 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
1637 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
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. \"TeX: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-fixed-width t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1645 "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
1646 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
1647 example:
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1648 : ;; Some Lisp examples
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1649 : (while (defc cnt)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1650 : (ding))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1651 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
1652 Not all export backends support this.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1653
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1654 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
1655 :group 'org-export-translation
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1656 :type 'boolean)
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 (defcustom org-match-sexp-depth 3
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1659 "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
1660 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
1661 :group 'org-export-translation
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1662 :type 'integer)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1663
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1664 (defgroup org-export-tables nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1665 "Options for exporting tables in Org-mode."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1666 :tag "Org Export Tables"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1667 :group 'org-export)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1668
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1669 (defcustom org-export-with-tables t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1670 "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
1671 For example:
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1672
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1673 | Name | Address | Birthday |
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1674 |-------------+----------+-----------|
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1675 | Arthur Dent | England | 29.2.2100 |
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1676
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1677 Not all export backends support this.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1678
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1679 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
1680 :group 'org-export-tables
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1681 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1682
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1683 (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
1684 "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
1685 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
1686 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
1687 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
1688 line will be formatted with <th> tags."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1689 :group 'org-export-tables
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-export-table-remove-special-lines t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1693 "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
1694 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
1695 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
1696 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
1697 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
1698 :group 'org-export-tables
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1699 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1700
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1701 (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
1702 "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
1703 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
1704 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
1705 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
1706 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
1707 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
1708 much faster."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1709 :group 'org-export-tables
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1710 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1711
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1712 (defgroup org-export-ascii nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1713 "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
1714 :tag "Org Export ASCII"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1715 :group 'org-export)
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-ascii-show-new-buffer t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1718 "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
1719 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
1720 :group 'org-export-ascii
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1721 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1722
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1723 (defgroup org-export-xml nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1724 "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
1725 :tag "Org Export XML"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1726 :group 'org-export)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1727
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1728 (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
1729 "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
1730 Allowed values are:
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1731 xoxo The XOXO exporter."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1732 :group 'org-export-xml
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1733 :type '(choice
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1734 (const :tag "XOXO" xoxo)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1735
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1736 (defgroup org-export-html nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1737 "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
1738 :tag "Org Export HTML"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1739 :group 'org-export)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1740
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
1741 (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
1742 "<style type=\"text/css\">
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
1743 html {
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
1744 font-family: Times, serif;
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
1745 font-size: 12pt;
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
1746 }
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
1747 .title { text-align: center; }
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
1748 .todo, .deadline { color: red; }
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
1749 .done { color: green; }
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
1750 .target { background-color: lavender; }
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
1751 pre {
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
1752 border: 1pt solid #AEBDCC;
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
1753 background-color: #F3F5F7;
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
1754 padding: 5pt;
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
1755 font-family: courier, monospace;
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
1756 }
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
1757 table { border-collapse: collapse; }
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
1758 td, th {
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
1759 vertical-align: top;
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
1760 border: 1pt solid #ADB9CC;
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
1761 }
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
1762 </style>"
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
1763 "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
1764 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
1765 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
1766 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
1767 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
1768 would be:
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
1769
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
1770 <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
1771 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
1772 h1 { color: black; }
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
1773 .title { text-align: center; }
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
1774 .todo, .deadline { color: red; }
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
1775 .done { color: green; }
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
1776 </style>
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
1777
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
1778 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
1779
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
1780 <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
1781
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
1782 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
1783 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
1784 :group 'org-export-html
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1785 :type 'string)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1786
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1787 (defcustom org-export-html-link-org-files-as-html t
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1788 "Non-nil means, make file links to `file.org' point to `file.html'.
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1789 When org-mode is exporting an org-mode file to HTML, links to
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1790 non-html files are directly put into a href tag in HTML.
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1791 However, links to other Org-mode files (recognized by the
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1792 extension `.org.) should become links to the corresponding html
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1793 file, assuming that the linked org-mode file will also be
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1794 converted to HTML.
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1795 When nil, the links still point to the plain `.org' file."
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1796 :group 'org-export-html
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1797 :type 'boolean)
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1798
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1799 (defcustom org-export-html-inline-images t
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1800 "Non-nil means, inline images into exported HTML pages.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1801 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
1802 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
1803 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
1804 :group 'org-export-html
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1805 :type 'boolean)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1806
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1807 (defcustom org-export-html-expand t
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1808 "Non-nil means, for HTML export, treat @<...> as HTML tag.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1809 When nil, these tags will be exported as plain text and therefore
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1810 not be interpreted by a browser.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1811
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1812 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
1813 :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
1814 :type 'boolean)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
1815
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1816 (defcustom org-export-html-table-tag
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1817 "<table border=1 cellspacing=0 cellpadding=6>"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1818 "The HTML tag used to start a table.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1819 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
1820 borders and spacing."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1821 :group 'org-export-html
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1822 :type 'string)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1823
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1824 (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
1825 "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
1826 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
1827 to a file."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1828 :group 'org-export-html
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1829 :type 'boolean)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1830
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1831 (defcustom org-export-html-html-helper-timestamp
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1832 "<br><br><hr><p><!-- hhmts start --> <!-- hhmts end -->\n"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1833 "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
1834 :group 'org-export-html
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1835 :type 'string)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1836
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1837 (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
1838 "Non-nil means, popup buffer containing the exported html text.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1839 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
1840 :group 'org-export-html
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1841 :type 'boolean)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1842
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1843 (defgroup org-export-icalendar nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1844 "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
1845 :tag "Org Export iCalendar"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1846 :group 'org-export)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1847
66262
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
1848 (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
1849 "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
1850 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
1851 :group 'org-export-icalendar
66262
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
1852 :type 'file)
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
1853
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
1854 (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
1855 "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
1856 :group 'org-export-icalendar
66262
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
1857 :type 'boolean)
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
1858
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
1859 (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
1860 "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
1861 :group 'org-export-icalendar
66262
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
1862 :type 'string)
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
1863
69454
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
1864 (defgroup org-font-lock nil
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1865 "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
1866 :tag "Org Font Lock"
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1867 :group 'org)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1868
69454
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
1869 (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
1870 "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
1871 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
1872 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
1873 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
1874 :group 'org-font-lock
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
1875 :type 'boolean)
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
1876
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
1877 (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
1878 "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
1879 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
1880 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
1881 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
1882 make this work.
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
1883 Changing it requires restart of `font-lock-mode' to become effective
70064
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
1884 also in regions already fontified.
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
1885 You may also set this on a per-file basis by adding one of the following
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
1886 lines to the buffer:
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
1887
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
1888 #+STARTUP: hidestars
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
1889 #+STARTUP: showstars"
69454
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
1890 :group 'org-font-lock
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
1891 :type 'boolean)
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
1892
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
1893 (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
1894 "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
1895 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
1896 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
1897 `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
1898 :group 'org-font-lock
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
1899 :type 'boolean)
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
1900
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
1901 (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
1902 "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
1903 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
1904 :group 'org-font-lock
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
1905 :type 'boolean)
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
1906
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1907 (defgroup org-faces nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1908 "Faces in Org-mode."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1909 :tag "Org Faces"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1910 :group 'org-font-lock)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1911
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1912 (defun org-compatible-face (specs)
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1913 "Make a compatible face specification.
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1914 XEmacs and Emacs 21 do not know about the `min-colors' attribute.
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1915 For them we convert a (min-colors 8) entry to a `tty' entry and move it
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1916 to the top of the list. The `min-colors' attribute will be removed from
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1917 any other entries, and any resulting duplicates will be removed entirely."
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1918 (if (or (featurep 'xemacs) (< emacs-major-version 22))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1919 (let (r e a)
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1920 (while (setq e (pop specs))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1921 (cond
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1922 ((memq (car e) '(t default)) (push e r))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1923 ((setq a (member '(min-colors 8) (car e)))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1924 (nconc r (list (cons (cons '(type tty) (delq (car a) (car e)))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1925 (cdr e)))))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1926 ((setq a (assq 'min-colors (car e)))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1927 (setq e (cons (delq a (car e)) (cdr e)))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1928 (or (assoc (car e) r) (push e r)))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1929 (t (or (assoc (car e) r) (push e r)))))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1930 (nreverse r))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1931 specs))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1932
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
1933 (defface org-hide
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1934 '((((background light)) (:foreground "white"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1935 (((background dark)) (:foreground "black")))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1936 "Face used to hide leading stars in headlines.
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1937 The forground color of this face should be equal to the background
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1938 color of the frame."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1939 :group 'org-faces)
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
1940
63225
7660591a3c92 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389
Miles Bader <miles@gnu.org>
parents: 63110
diff changeset
1941 (defface org-level-1 ;; font-lock-function-name-face
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1942 (org-compatible-face
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1943 '((((class color) (min-colors 88) (background light)) (:foreground "Blue1"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1944 (((class color) (min-colors 88) (background dark)) (:foreground "LightSkyBlue"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1945 (((class color) (min-colors 16) (background light)) (:foreground "Blue"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1946 (((class color) (min-colors 16) (background dark)) (:foreground "LightSkyBlue"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1947 (((class color) (min-colors 8)) (:foreground "blue" :bold t))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1948 (t (:bold t))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1949 "Face used for level 1 headlines."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1950 :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
1951
7660591a3c92 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389
Miles Bader <miles@gnu.org>
parents: 63110
diff changeset
1952 (defface org-level-2 ;; font-lock-variable-name-face
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1953 (org-compatible-face
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1954 '((((class color) (min-colors 16) (background light)) (:foreground "DarkGoldenrod"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1955 (((class color) (min-colors 16) (background dark)) (:foreground "LightGoldenrod"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1956 (((class color) (min-colors 8) (background light)) (:foreground "yellow"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1957 (((class color) (min-colors 8) (background dark)) (:foreground "yellow" :bold t))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1958 (t (:bold t))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1959 "Face used for level 2 headlines."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1960 :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
1961
7660591a3c92 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389
Miles Bader <miles@gnu.org>
parents: 63110
diff changeset
1962 (defface org-level-3 ;; font-lock-keyword-face
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1963 (org-compatible-face
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1964 '((((class color) (min-colors 88) (background light)) (:foreground "Purple"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1965 (((class color) (min-colors 88) (background dark)) (:foreground "Cyan1"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1966 (((class color) (min-colors 16) (background light)) (:foreground "Purple"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1967 (((class color) (min-colors 16) (background dark)) (:foreground "Cyan"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1968 (((class color) (min-colors 8) (background light)) (:foreground "purple" :bold t))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1969 (((class color) (min-colors 8) (background dark)) (:foreground "cyan" :bold t))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1970 (t (:bold t))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1971 "Face used for level 3 headlines."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1972 :group 'org-faces)
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
1973
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
1974 (defface org-level-4 ;; font-lock-comment-face
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1975 (org-compatible-face
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1976 '((((class color) (min-colors 88) (background light)) (:foreground "Firebrick"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1977 (((class color) (min-colors 88) (background dark)) (:foreground "chocolate1"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1978 (((class color) (min-colors 16) (background light)) (:foreground "red"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1979 (((class color) (min-colors 16) (background dark)) (:foreground "red1"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1980 (((class color) (min-colors 8) (background light)) (:foreground "red" :bold t))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1981 (((class color) (min-colors 8) (background dark)) (:foreground "red" :bold t))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1982 (t (:bold t))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1983 "Face used for level 4 headlines."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1984 :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
1985
7660591a3c92 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389
Miles Bader <miles@gnu.org>
parents: 63110
diff changeset
1986 (defface org-level-5 ;; font-lock-type-face
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1987 (org-compatible-face
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1988 '((((class color) (min-colors 16) (background light)) (:foreground "ForestGreen"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1989 (((class color) (min-colors 16) (background dark)) (:foreground "PaleGreen"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1990 (((class color) (min-colors 8)) (:foreground "green"))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1991 "Face used for level 5 headlines."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1992 :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
1993
7660591a3c92 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389
Miles Bader <miles@gnu.org>
parents: 63110
diff changeset
1994 (defface org-level-6 ;; font-lock-constant-face
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1995 (org-compatible-face
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1996 '((((class color) (min-colors 16) (background light)) (:foreground "CadetBlue"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1997 (((class color) (min-colors 16) (background dark)) (:foreground "Aquamarine"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
1998 (((class color) (min-colors 8)) (:foreground "magenta"))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1999 "Face used for level 6 headlines."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2000 :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
2001
7660591a3c92 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389
Miles Bader <miles@gnu.org>
parents: 63110
diff changeset
2002 (defface org-level-7 ;; font-lock-builtin-face
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2003 (org-compatible-face
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2004 '((((class color) (min-colors 16) (background light)) (:foreground "Orchid"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2005 (((class color) (min-colors 16) (background dark)) (:foreground "LightSteelBlue"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2006 (((class color) (min-colors 8)) (:foreground "blue")))) ;; FIXME: for dark bg?
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2007 "Face used for level 7 headlines."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2008 :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
2009
7660591a3c92 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389
Miles Bader <miles@gnu.org>
parents: 63110
diff changeset
2010 (defface org-level-8 ;; font-lock-string-face
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2011 (org-compatible-face
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2012 '((((class color) (min-colors 16) (background light)) (:foreground "RosyBrown"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2013 (((class color) (min-colors 16) (background dark)) (:foreground "LightSalmon"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2014 (((class color) (min-colors 8)) (:foreground "green"))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2015 "Face used for level 8 headlines."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2016 :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
2017
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
2018 (defface org-special-keyword ;; font-lock-string-face
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2019 (org-compatible-face
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2020 '((((class color) (min-colors 16) (background light)) (:foreground "RosyBrown"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2021 (((class color) (min-colors 16) (background dark)) (:foreground "LightSalmon"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2022 (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
2023 "Face used for special keywords."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2024 :group 'org-faces)
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
2025
63225
7660591a3c92 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389
Miles Bader <miles@gnu.org>
parents: 63110
diff changeset
2026 (defface org-warning ;; font-lock-warning-face
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2027 (org-compatible-face
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2028 '((((class color) (min-colors 16) (background light)) (:foreground "Red1" :bold t))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2029 (((class color) (min-colors 16) (background dark)) (:foreground "Pink" :bold t))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2030 (((class color) (min-colors 8) (background light)) (:foreground "red" :bold t))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2031 (((class color) (min-colors 8) (background dark)) (:foreground "red" :bold t))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2032 (t (:bold t))))
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
2033 "Face for deadlines and TODO keywords."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2034 :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
2035
63225
7660591a3c92 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389
Miles Bader <miles@gnu.org>
parents: 63110
diff changeset
2036 (defface org-headline-done ;; font-lock-string-face
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2037 (org-compatible-face
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2038 '((((class color) (min-colors 16) (background light)) (:foreground "RosyBrown"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2039 (((class color) (min-colors 16) (background dark)) (:foreground "LightSalmon"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2040 (((class color) (min-colors 8) (background light)) (:bold nil))))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2041 "Face used to indicate that a headline is DONE.
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2042 This face is only used if `org-fontify-done-headline' is set."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2043 :group 'org-faces)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
2044
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
2045 (defface org-link
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2046 '((((class color) (background light)) (:foreground "Purple" :underline t))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2047 (((class color) (background dark)) (:foreground "Cyan" :underline t))
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2048 (t (:underline t)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2049 "Face for links."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2050 :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
2051
70064
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
2052 (defface org-date
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2053 '((((class color) (background light)) (:foreground "Purple" :underline t))
70064
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
2054 (((class color) (background dark)) (:foreground "Cyan" :underline t))
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2055 (t (:underline t)))
70064
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
2056 "Face for links."
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
2057 :group 'org-faces)
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
2058
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
2059 (defface org-tag
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2060 '((t (:bold t)))
69454
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2061 "Face for tags."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2062 :group 'org-faces)
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
2063
70064
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
2064 (defface org-todo ;; font-lock-warning-face
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2065 (org-compatible-face
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2066 '((((class color) (min-colors 16) (background light)) (:foreground "Red1" :bold t))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2067 (((class color) (min-colors 16) (background dark)) (:foreground "Pink" :bold t))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2068 (((class color) (min-colors 8) (background light)) (:foreground "red" :bold t))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2069 (((class color) (min-colors 8) (background dark)) (:foreground "red" :bold t))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2070 (t (:inverse-video t :bold t))))
70064
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
2071 "Face for TODO keywords."
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
2072 :group 'org-faces)
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
2073
63225
7660591a3c92 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389
Miles Bader <miles@gnu.org>
parents: 63110
diff changeset
2074 (defface org-done ;; font-lock-type-face
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2075 (org-compatible-face
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2076 '((((class color) (min-colors 16) (background light)) (:foreground "ForestGreen"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2077 (((class color) (min-colors 16) (background dark)) (:foreground "PaleGreen"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2078 (((class color) (min-colors 8)) (:foreground "green"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2079 (t (:bold t))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2080 "Face used for DONE."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2081 :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
2082
7660591a3c92 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389
Miles Bader <miles@gnu.org>
parents: 63110
diff changeset
2083 (defface org-table ;; font-lock-function-name-face
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2084 (org-compatible-face
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2085 '((((class color) (min-colors 88) (background light)) (:foreground "Blue1"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2086 (((class color) (min-colors 88) (background dark)) (:foreground "LightSkyBlue"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2087 (((class color) (min-colors 16) (background light)) (:foreground "Blue"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2088 (((class color) (min-colors 16) (background dark)) (:foreground "LightSkyBlue"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2089 (((class color) (min-colors 8) (background light)) (:foreground "blue"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2090 (((class color) (min-colors 8) (background dark)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2091 "Face used for tables."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2092 :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
2093
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2094 (defface org-formula
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2095 (org-compatible-face
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2096 '((((class color) (min-colors 88) (background light)) (:foreground "Firebrick"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2097 (((class color) (min-colors 88) (background dark)) (:foreground "chocolate1"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2098 (((class color) (min-colors 8) (background light)) (:foreground "red"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2099 (((class color) (min-colors 8) (background dark)) (:foreground "red"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2100 (t (:bold t :italic t))))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2101 "Face for formulas."
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2102 :group 'org-faces)
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2103
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2104 (defface org-scheduled-today
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2105 (org-compatible-face
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2106 '((((class color) (min-colors 88) (background light)) (:foreground "DarkGreen"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2107 (((class color) (min-colors 88) (background dark)) (:foreground "PaleGreen"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2108 (((class color) (min-colors 8)) (:foreground "green"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2109 (t (:bold t :italic t))))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2110 "Face for items scheduled for a certain day."
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2111 :group 'org-faces)
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2112
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2113 (defface org-scheduled-previously
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2114 (org-compatible-face
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2115 '((((class color) (min-colors 88) (background light)) (:foreground "Firebrick"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2116 (((class color) (min-colors 88) (background dark)) (:foreground "chocolate1"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2117 (((class color) (min-colors 8) (background light)) (:foreground "red"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2118 (((class color) (min-colors 8) (background dark)) (:foreground "red" :bold t))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2119 (t (:bold t))))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2120 "Face for items scheduled previously, and not yet done."
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2121 :group 'org-faces)
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2122
63225
7660591a3c92 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389
Miles Bader <miles@gnu.org>
parents: 63110
diff changeset
2123 (defface org-time-grid ;; font-lock-variable-name-face
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2124 (org-compatible-face
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2125 '((((class color) (min-colors 16) (background light)) (:foreground "DarkGoldenrod"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2126 (((class color) (min-colors 16) (background dark)) (:foreground "LightGoldenrod"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2127 (((class color) (min-colors 8)) (:foreground "yellow" :weight light)))) ; FIXME: turn off???
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
2128 "Face used for time grids."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2129 :group 'org-faces)
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
2130
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2131 (defconst org-level-faces
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
2132 '(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
2133 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
2134 ))
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2135 (defconst org-n-levels (length org-level-faces))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2136
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2137 (defconst org-bold-re
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2138 (if (featurep 'xemacs)
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2139 "\\([ ]\\|^\\)\\(\\*\\(\\w[a-zA-Z0-9-_ ]*?\\w\\)\\*\\)\\([ ,.]\\|$\\)"
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2140 "\\([ ]\\|^\\)\\(\\*\\(\\w[[:word:] -_]*?\\w\\)\\*\\)\\([ ,.]\\|$\\)")
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2141 "Regular expression for bold emphasis.")
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2142 (defconst org-italic-re
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2143 (if (featurep 'xemacs)
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2144 "\\([ ]\\|^\\)\\(/\\(\\w[a-zA-Z0-9-_ ]*?\\w\\)/\\)\\([ ,.]\\|$\\)"
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2145 "\\([ ]\\|^\\)\\(/\\(\\w[[:word:] -_]*?\\w\\)/\\)\\([ ,.]\\|$\\)")
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2146 "Regular expression for italic emphasis.")
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2147 (defconst org-underline-re
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2148 (if (featurep 'xemacs)
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2149 "\\([ ]\\|^\\)\\(_\\(\\w[a-zA-Z0-9-_ ]*?\\w\\)_\\)\\([ ,.]\\|$\\)"
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2150 "\\([ ]\\|^\\)\\(_\\(\\w[[:word:] -_]*?\\w\\)_\\)\\([ ,.]\\|$\\)")
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2151 "Regular expression for underline emphasis.")
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2152
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2153 ;; 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
2154 (defvar org-done-string nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2155 "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
2156 (make-variable-buffer-local 'org-done-string)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2157 (defvar org-todo-regexp nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2158 "Matches any of the TODO state keywords.")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2159 (make-variable-buffer-local 'org-todo-regexp)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2160 (defvar org-not-done-regexp nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2161 "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
2162 (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
2163 (defvar org-todo-line-regexp nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2164 "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
2165 (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
2166 (defvar org-nl-done-regexp nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2167 "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
2168 (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
2169 (defvar org-looking-at-done-regexp nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2170 "Matches the DONE keyword a point.")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2171 (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
2172 (defvar org-todo-kwd-priority-p nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2173 "Do TODO items have priorities?")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2174 (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
2175 (defvar org-todo-kwd-max-priority nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2176 "Maximum priority of TODO items.")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2177 (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
2178 (defvar org-ds-keyword-length 12
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2179 "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
2180 (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
2181 (defvar org-deadline-regexp nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2182 "Matches the DEADLINE keyword.")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2183 (make-variable-buffer-local 'org-deadline-regexp)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2184 (defvar org-deadline-time-regexp nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2185 "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
2186 (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
2187 (defvar org-deadline-line-regexp nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2188 "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
2189 (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
2190 (defvar org-scheduled-regexp nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2191 "Matches the SCHEDULED keyword.")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2192 (make-variable-buffer-local 'org-scheduled-regexp)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2193 (defvar org-scheduled-time-regexp nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2194 "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
2195 (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
2196
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 (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
2198 "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
2199 (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
2200 (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
2201 '("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
2202 "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
2203 (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
2204 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
2205 (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
2206 (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
2207 (widen)
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2208 (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
2209 (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
2210 (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
2211 (cond
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2212 ((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
2213 (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
2214 (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
2215 (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
2216 ((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
2217 (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
2218 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
2219 ((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
2220 (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
2221 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
2222 ((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
2223 (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
2224 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
2225 ((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
2226 (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
2227 (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
2228 ("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
2229 ("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
2230 ("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
2231 ("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
2232 ("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
2233 ("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
2234 ("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
2235 ("oddeven" org-odd-levels-only nil)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2236 ("align" org-startup-align-all-tables t)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2237 ("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
2238 ("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
2239 ("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
2240 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
2241 (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
2242 (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
2243 (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
2244 ((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
2245 (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
2246 (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
2247 (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
2248 '(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
2249 )))
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2250 (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
2251 (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
2252 (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
2253 (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
2254 ;; 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
2255 (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
2256 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
2257 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
2258 (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
2259 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
2260 (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
2261 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
2262 (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
2263 "\\|") "\\)\\>")
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2264 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
2265 (concat "\\<\\("
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2266 (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
2267 (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
2268 "\\|")
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2269 "\\)\\>")
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2270 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
2271 (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
2272 (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
2273 "\\)? *\\(.*\\)")
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2274 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
2275 (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
2276 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
2277 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
2278 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
2279 (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
2280 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
2281 (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
2282 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
2283 (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
2284 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
2285 (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
2286 (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
2287
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2288 ;; Tell the compiler about dynamically scoped variables,
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2289 ;; and variables from other packages
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2290 (defvar zmacs-regions) ; XEmacs regions
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2291 (defvar original-date) ; dynamically scoped in calendar
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2292 (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
2293 (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
2294 (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
2295 (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
2296 (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
2297 (defvar org-ts-what) ; dynamically scoped parameter
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2298 (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
2299 (defvar timecnt) ; dynamically scoped parameter
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2300 (defvar levels-open) ; dynamically scoped parameter
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2301 (defvar title) ; dynamically scoped parameter
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2302 (defvar author) ; dynamically scoped parameter
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2303 (defvar email) ; dynamically scoped parameter
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2304 (defvar text) ; dynamically scoped parameter
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2305 (defvar entry) ; dynamically scoped parameter
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2306 (defvar date) ; dynamically scoped parameter
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2307 (defvar language) ; dynamically scoped parameter
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2308 (defvar options) ; dynamically scoped parameter
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2309 (defvar ans1) ; dynamically scoped parameter
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2310 (defvar ans2) ; dynamically scoped parameter
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2311 (defvar starting-day) ; local variable
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2312 (defvar include-all-loc) ; local variable
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2313 (defvar vm-message-pointer) ; from vm
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2314 (defvar vm-folder-directory) ; from vm
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2315 (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
2316 (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
2317 (defvar gnus-group-name) ; from gnus
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2318 (defvar gnus-article-current) ; from gnus
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2319 (defvar w3m-current-url) ; from w3m
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2320 (defvar mh-progs) ; from MH-E
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2321 (defvar mh-current-folder) ; from MH-E
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2322 (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
2323 (defvar mh-index-folder) ; from MH-E
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2324 (defvar mh-searcher) ; from MH-E
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2325 (defvar org-selected-point) ; dynamically scoped parameter
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2326 (defvar calendar-mode-map) ; from calendar.el
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2327 (defvar last-arg) ; local variable
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2328 (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
2329 (defvar remember-data-file) ; from remember.el
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2330 (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
2331 (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
2332 (defvar orgtbl-mode) ; defined later in this file
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2333 ;;; Define the mode
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2334
70161
b9e09a4a2168 (org-mode-map): Catch conflict with old allout.el.
Carsten Dominik <dominik@science.uva.nl>
parents: 70136
diff changeset
2335 (defvar org-mode-map
b9e09a4a2168 (org-mode-map): Catch conflict with old allout.el.
Carsten Dominik <dominik@science.uva.nl>
parents: 70136
diff changeset
2336 (if (and (not (keymapp outline-mode-map)) (featurep 'allout))
b9e09a4a2168 (org-mode-map): Catch conflict with old allout.el.
Carsten Dominik <dominik@science.uva.nl>
parents: 70136
diff changeset
2337 (error "Conflict with outdated version of allout.el. Load org.el before allout.el, or ugrade to newer allout, for example by switching to Emacs 22.")
b9e09a4a2168 (org-mode-map): Catch conflict with old allout.el.
Carsten Dominik <dominik@science.uva.nl>
parents: 70136
diff changeset
2338 (copy-keymap outline-mode-map))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2339 "Keymap for Org-mode.")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2340
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2341 (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
2342 (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
2343 (defvar org-tbl-menu) ; defined later in this file
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2344
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
2345 ;; 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
2346 ;; an update.
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
2347 (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
2348 "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
2349 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
2350 `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
2351 (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
2352 (defvar org-inhibit-startup nil) ; Dynamically-scoped param.
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
2353 (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
2354
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
2355
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2356 ;;;###autoload
62712
b9935dc86aa4 (org-mode): Use `define-derived-mode' to define
Carsten Dominik <dominik@science.uva.nl>
parents: 62546
diff changeset
2357 (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
2358 "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
2359 \"Carsten's outline-mode for keeping track of everything.\"
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2360
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2361 Org-mode develops organizational tasks around a NOTES file which
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2362 contains information about projects as plain text. Org-mode is
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2363 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
2364 of large files well structured. It supports ToDo items, deadlines and
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2365 time stamps, which magically appear in the diary listing of the Emacs
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2366 calendar. Tables are easily created with a built-in table editor.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2367 Plain text URL-like links connect to websites, emails (VM), Usenet
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2368 messages (Gnus), BBDB entries, and any files related to the project.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2369 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
2370 can be exported as a structured ASCII or HTML file.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2371
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
2372 The following commands are available:
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2373
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2374 \\{org-mode-map}"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2375 (easy-menu-add org-org-menu)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
2376 (easy-menu-add org-tbl-menu)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2377 (org-install-agenda-files-menu)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2378 (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
2379 (org-add-to-invisibility-spec '(org-cwidth))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2380 (setq outline-regexp "\\*+")
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2381 ;;(setq outline-regexp "\\(?:\\*+\\|[ \t]*\\(?:[-+*]\\|[0-9]+[.)]\\) \\)")
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2382 (setq outline-level 'org-outline-level)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2383 (when (and org-ellipsis (stringp org-ellipsis))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2384 (unless org-display-table
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2385 (setq org-display-table (make-display-table)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2386 (set-display-table-slot org-display-table
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2387 4 (string-to-vector org-ellipsis))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2388 (setq buffer-display-table org-display-table))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2389 (org-set-regexps-and-options)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2390 (if org-startup-truncated (setq truncate-lines t))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2391 (set (make-local-variable 'font-lock-unfontify-region-function)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2392 'org-unfontify-region)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2393 ;; 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
2394 (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
2395 (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
2396 'local)
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
2397 ;; Paragraphs and auto-filling
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
2398 (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
2399 (org-update-radio-target-regexp)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
2400 ;; Settings for Calc embedded mode
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
2401 (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
2402 (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
2403 (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
2404 (interactive-p)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
2405 (= (point-min) (point-max)))
62712
b9935dc86aa4 (org-mode): Use `define-derived-mode' to define
Carsten Dominik <dominik@science.uva.nl>
parents: 62546
diff changeset
2406 (insert " -*- mode: org -*-\n\n"))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
2407
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
2408 ;; 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
2409 ;; 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
2410 ;; the keymap so late.
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2411 (if (featurep 'xemacs)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
2412 (progn
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
2413 (delete-menu-item '("Headings"))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
2414 (delete-menu-item '("Show"))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
2415 (delete-menu-item '("Hide"))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
2416 (set-menubar-dirty-flag))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
2417 (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
2418 (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
2419 (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
2420
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
2421 (unless org-inhibit-startup
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2422 (if org-startup-align-all-tables
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2423 (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
2424 (if org-startup-with-deadline-check
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
2425 (call-interactively 'org-check-deadlines)
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
2426 (cond
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
2427 ((eq org-startup-folded t)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
2428 (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
2429 ((eq org-startup-folded 'content)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
2430 (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
2431 (org-cycle '(4)) (org-cycle '(4))))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2432
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
2433 (defsubst org-current-line (&optional pos)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
2434 (+ (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
2435
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2436 (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
2437 mouse-map t)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2438 "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
2439
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2440 (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
2441 (if (featurep 'xemacs)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2442 (let ((s (match-string num string)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2443 (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
2444 s)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2445 (match-string-no-properties num string)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2446
70064
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
2447 (defsubst org-no-properties (s)
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
2448 (remove-text-properties 0 (length s) org-rm-props s)
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
2449 s)
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
2450
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2451 (defun org-current-time ()
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2452 "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
2453 (if (> org-time-stamp-rounding-minutes 0)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2454 (let ((r org-time-stamp-rounding-minutes)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2455 (time (decode-time)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2456 (apply 'encode-time
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2457 (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
2458 (nthcdr 2 time))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2459 (current-time)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2460
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2461 (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
2462 "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
2463 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
2464 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
2465 (add-text-properties
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2466 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
2467 string)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2468 (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
2469
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
2470
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2471 ;;; Font-Lock stuff
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2472
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2473 (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
2474 (define-key org-mouse-map
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2475 (if (featurep 'xemacs) [button2] [mouse-2]) 'org-open-at-mouse)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2476 (define-key org-mouse-map
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2477 (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
2478 (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
2479 (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
2480 (when org-tab-follows-link
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
2481 (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
2482 (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
2483 (when org-return-follows-link
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
2484 (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
2485 (define-key org-mouse-map "\C-m" 'org-open-at-point))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2486
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2487 (require 'font-lock)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2488
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2489 (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
2490 (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
2491 "wl" "mhe" "rmail" "gnus" "shell"))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2492 (defconst org-link-re-with-space
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2493 (concat
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2494 "<?\\(" (mapconcat 'identity org-link-types "\\|") "\\):"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2495 "\\([^" org-non-link-chars " ]"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2496 "[^" org-non-link-chars "]*"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2497 "[^" org-non-link-chars " ]\\)>?")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2498 "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
2499
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2500 (defconst org-link-re-with-space2
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2501 (concat
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2502 "<?\\(" (mapconcat 'identity org-link-types "\\|") "\\):"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2503 "\\([^" org-non-link-chars " ]"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2504 "[^]\t\n\r]*"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2505 "[^" org-non-link-chars " ]\\)>?")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2506 "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
2507
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2508 (defconst org-angle-link-re
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2509 (concat
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2510 "<\\(" (mapconcat 'identity org-link-types "\\|") "\\):"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2511 "\\([^" org-non-link-chars " ]"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2512 "[^" org-non-link-chars "]*"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2513 "\\)>")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2514 "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
2515 (defconst org-plain-link-re
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2516 (concat
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2517 "\\(" (mapconcat 'identity org-link-types "\\|") "\\):"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2518 "\\([^]\t\n\r<>,;() ]+\\)")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2519 "Matches plain link, without spaces.")
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
2520
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2521 (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
2522 "\\[\\[\\([^]]+\\)\\]\\(\\[\\([^]]+\\)\\]\\)?\\]"
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2523 "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
2524
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2525 (defconst org-bracket-link-analytic-regexp
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2526 (concat
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2527 "\\[\\["
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2528 "\\(\\(" (mapconcat 'identity org-link-types "\\|") "\\):\\)?"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2529 "\\([^]]+\\)"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2530 "\\]"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2531 "\\(\\[" "\\([^]]+\\)" "\\]\\)?"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2532 "\\]"))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2533 ; 1: http:
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2534 ; 2: http
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2535 ; 3: path
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2536 ; 4: [desc]
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2537 ; 5: desc
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2538
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2539
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2540 (defconst org-ts-lengths
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2541 (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
2542 (length (format-time-string (cdr org-time-stamp-formats))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2543 "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
2544 (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
2545 "Regular expression for fast time stamp matching.")
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
2546 (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
2547 "Regular expression for fast time stamp matching.")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2548 (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
2549 "Regular expression matching time strings for analysis.")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2550 (defconst org-ts-regexp2 (concat "<" org-ts-regexp1 ">")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2551 "Regular expression matching time stamps, with groups.")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2552 (defconst org-tr-regexp (concat org-ts-regexp "--?-?" org-ts-regexp)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2553 "Regular expression matching a time stamp range.")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2554 (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
2555 org-ts-regexp "\\)?")
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2556 "Regular expression matching a time stamp or time stamp range.")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2557
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2558 (defun org-activate-plain-links (limit)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2559 "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
2560 (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
2561 (progn
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2562 (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
2563 (list 'mouse-face 'highlight
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2564 'keymap org-mouse-map
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2565 ))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2566 t)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2567
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2568 (defun org-activate-angle-links (limit)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2569 "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
2570 (if (re-search-forward org-angle-link-re limit t)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2571 (progn
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
2572 (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
2573 (list 'mouse-face 'highlight
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2574 'keymap org-mouse-map
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2575 ))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
2576 t)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2577
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2578 (defun org-activate-bracket-links (limit)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2579 "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
2580 (if (re-search-forward org-bracket-link-regexp limit t)
70064
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
2581 (let* ((help (concat "LINK: "
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
2582 (org-match-string-no-properties 1)))
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
2583 ;; FIXME: above we should remove the escapes.
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2584 (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
2585 'keymap org-mouse-map 'mouse-face 'highlight
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2586 'help-echo help))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2587 (vp (list 'rear-nonsticky t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2588 'keymap org-mouse-map 'mouse-face 'highlight
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2589 'help-echo help)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2590 ;; 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
2591 ;; may have made some of this invisible.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2592 (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
2593 '(invisible nil))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2594 (if (match-end 3)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2595 (progn
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2596 (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
2597 (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
2598 (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
2599 (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
2600 (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
2601 (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
2602 t)))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2603
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2604 (defun org-activate-dates (limit)
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
2605 "Run through the buffer and add overlays to dates."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2606 (if (re-search-forward org-tsr-regexp limit t)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2607 (progn
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
2608 (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
2609 (list 'mouse-face 'highlight
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
2610 'keymap org-mouse-map))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
2611 t)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2612
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2613 (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
2614 "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
2615 (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
2616 "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
2617 (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
2618 "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
2619
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2620 (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
2621 "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
2622 (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
2623 (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
2624 (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
2625 (progn
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2626 (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
2627 (list 'mouse-face 'highlight
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2628 'keymap org-mouse-map
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2629 '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
2630 'org-linked-text t))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2631 t)))))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2632
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2633 (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
2634 "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
2635 (interactive)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2636 (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
2637 (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
2638 (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
2639 (org-restart-font-lock)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2640
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2641 (defun org-hide-wide-columns (limit)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2642 (let (s e)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2643 (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
2644 'org-cwidth t))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2645 (when s
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2646 (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
2647 (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
2648 (goto-char e)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2649 t)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2650
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2651 (defun org-restart-font-lock ()
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2652 "Restart font-lock-mode, to force refontification."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2653 (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
2654 (font-lock-mode -1)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2655 (font-lock-mode 1)))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2656
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2657 (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
2658 "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
2659 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
2660 (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
2661 rtn)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2662 (save-excursion
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2663 (goto-char (point-min))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2664 (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
2665 (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
2666 rtn)))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2667
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2668 (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
2669 "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
2670 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
2671 between words."
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
2672 (and targets
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
2673 (concat
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
2674 "\\<\\("
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
2675 (mapconcat
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
2676 (lambda (x)
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
2677 (while (string-match " +" x)
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
2678 (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
2679 x)
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
2680 targets
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
2681 "\\|")
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
2682 "\\)\\>")))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2683
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
2684 (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
2685 "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
2686
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2687 (defun org-activate-camels (limit)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2688 "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
2689 (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
2690 (progn
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2691 (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
2692 (list 'mouse-face 'highlight
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2693 'keymap org-mouse-map))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2694 t)))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2695
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
2696 (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
2697 (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
2698 (progn
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
2699 (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
2700 (list 'mouse-face 'highlight
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
2701 'keymap org-mouse-map))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
2702 t)))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
2703
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2704 (defun org-font-lock-level ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2705 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2706 (org-back-to-heading t)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2707 (- (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
2708
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2709 (defun org-outline-level ()
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2710 (save-excursion
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2711 (looking-at outline-regexp)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2712 (if (match-beginning 1)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2713 (+ (org-get-string-indentation (match-string 1)) 1000)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2714 (- (match-end 0) (match-beginning 0)))))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2715
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
2716 (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
2717
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2718 (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
2719 (let* ((em org-fontify-emphasized-text)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2720 (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
2721 (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
2722 (list
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2723 '("^\\(\\**\\)\\(\\*\\)\\(.*\\)" (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
2724 (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
2725 '("^[ \t]*\\(\\(|\\|\\+-[-+]\\).*\\S-\\)"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2726 (1 'org-table))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2727 (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
2728 (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
2729 (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
2730 (if (memq 'radio lk) '(org-activate-target-links (0 'org-link t)))
70064
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
2731 (if (memq 'date lk) '(org-activate-dates (0 'org-date t)))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2732 (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
2733 (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
2734 (if org-table-limit-column-width
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2735 '(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
2736 (list (concat "^\\*+[ \t]*" org-not-done-regexp)
70064
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
2737 '(1 'org-todo t))
69454
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2738 (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
2739 (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
2740 (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
2741 (list (concat "\\<" org-closed-string) '(0 'org-special-keyword t))
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2742 ; (if em '("\\(\\W\\|^\\)\\(\\*\\w+\\*\\)\\(\\W\\|$\\)" 2 'bold prepend))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2743 ; (if em '("\\(\\W\\|^\\)\\(/\\w+/\\)\\(\\W\\|$\\)" 2 'italic prepend))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2744 ; (if em '("\\(\\W\\|^\\)\\(_\\w+_\\)\\(\\W\\|$\\)" 2 'underline prepend))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2745 (if em (list org-bold-re 2 ''bold 'prepend))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2746 (if em (list org-italic-re 2 ''italic 'prepend))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
2747 (if em (list org-underline-re 2 ''underline 'prepend))
69454
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2748 (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
2749 "\\|" org-quote-string "\\)\\>")
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2750 '(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
2751 '("^#.*" (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
2752 (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
2753 (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
2754 '(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
2755 (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
2756 '(1 'org-done t)))
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2757 '("^[ \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
2758 '("| *\\(:?=[^|\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
2759 '("^[ \t]*| *\\([#!$*_^]\\) *|" (1 'org-formula t))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2760 (if org-format-transports-properties-p
70064
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
2761 '("| *\\(<[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
2762 )))
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2763 (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
2764 ;; Now set the full font-lock-keywords
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2765 (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
2766 org-font-lock-extra-keywords)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2767 (set (make-local-variable 'font-lock-defaults)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
2768 '(org-font-lock-keywords t nil nil backward-paragraph))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2769 (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
2770
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
2771 (defvar org-m nil)
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
2772 (defvar org-l nil)
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
2773 (defvar org-f nil)
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
2774 (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
2775 "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
2776 (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
2777 (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
2778 ; (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
2779 (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
2780 (cond
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
2781 ((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
2782 ((eq n 2) org-f)
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
2783 (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
2784
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2785 (defun org-unfontify-region (beg end &optional maybe_loudly)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2786 "Remove fontification and activation overlays from links."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2787 (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
2788 (let* ((buffer-undo-list t)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
2789 (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
2790 (inhibit-modification-hooks t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
2791 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
2792 (remove-text-properties beg end
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2793 '(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
2794 invisible nil intangible nil))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2795 ;;; Visibility cycling
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2796
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2797 (defvar org-cycle-global-status nil)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2798 (defvar org-cycle-subtree-status nil)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2799 (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
2800 "Visibility cycling for Org-mode.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2801
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2802 - 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
2803 buffer through 3 states (global cycling)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2804 1. OVERVIEW: Show only top-level headlines.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2805 2. CONTENTS: Show all headlines of all levels, but no body text.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2806 3. SHOW ALL: Show everything.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2807
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2808 - 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
2809 by this line through 3 different states (local cycling)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2810 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
2811 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
2812 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
2813 and zoom in further.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2814 3. SUBTREE: Show the entire subtree, including body text.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2815
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
2816 - 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
2817 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
2818 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
2819
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2820 - When point is not at the beginning of a headline, execute
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2821 `indent-relative', like TAB normally does. See the option
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2822 `org-cycle-emulate-tab' for details.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2823
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2824 - 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
2825 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
2826 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2827
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
2828 (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
2829 (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
2830 ;; special case: use global cycling
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2831 (setq arg t))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2832
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2833 (let ((outline-regexp
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2834 (if org-cycle-include-plain-lists
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2835 "\\*+\\|\\([ \t]*\\)\\([-+*]\\|[0-9]+[.)]\\) "
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2836 outline-regexp)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2837
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2838 (cond
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2839
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2840 ((org-at-table-p 'any)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2841 ;; 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
2842 (or (org-table-recognize-table.el)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2843 (progn
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2844 (if arg (org-table-edit-field t)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2845 (org-table-justify-field-maybe)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2846 (org-table-next-field)))))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2847
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2848 ((eq arg t) ;; Global cycling
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2849
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2850 (cond
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2851 ((and (eq last-command this-command)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2852 (eq org-cycle-global-status 'overview))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2853 ;; 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
2854 ;; 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
2855 (message "CONTENTS...")
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2856 (save-excursion
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2857 ;; Visit all headings and show their offspring
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2858 (goto-char (point-max))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2859 (catch 'exit
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2860 (while (and (progn (condition-case nil
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2861 (outline-previous-visible-heading 1)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2862 (error (goto-char (point-min))))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2863 t)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2864 (looking-at outline-regexp))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2865 (show-branches)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2866 (if (bobp) (throw 'exit nil))))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2867 (message "CONTENTS...done"))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2868 (setq org-cycle-global-status 'contents)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2869 (run-hook-with-args 'org-cycle-hook 'contents))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2870
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2871 ((and (eq last-command this-command)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2872 (eq org-cycle-global-status 'contents))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2873 ;; 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
2874 (show-all)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2875 (message "SHOW ALL")
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2876 (setq org-cycle-global-status 'all)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2877 (run-hook-with-args 'org-cycle-hook 'all))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2878
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2879 (t
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2880 ;; Default action: go to overview
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2881 (hide-sublevels 1)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2882 (message "OVERVIEW")
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2883 (setq org-cycle-global-status 'overview)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2884 (run-hook-with-args 'org-cycle-hook 'overview))))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2885
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2886 ((integerp arg)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2887 ;; Show-subtree, ARG levels up from here.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2888 (save-excursion
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
2889 (org-back-to-heading)
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2890 (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
2891 (- (funcall outline-level) arg)))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2892 (org-show-subtree)))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2893
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2894 ((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
2895 ;; At a heading: rotate between three different views
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2896 (org-back-to-heading)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2897 (let ((goal-column 0) eoh eol eos)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2898 ;; First, some boundaries
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2899 (save-excursion
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2900 (org-back-to-heading)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2901 (save-excursion
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2902 (beginning-of-line 2)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2903 (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
2904 (get-char-property (1- (point)) 'invisible))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2905 (beginning-of-line 2)) (setq eol (point)))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2906 (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
2907 (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
2908 (outline-next-heading))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2909 ;; 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
2910 (cond
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2911 ((= eos eoh)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2912 ;; Nothing is hidden behind this heading
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2913 (message "EMPTY ENTRY")
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2914 (setq org-cycle-subtree-status nil))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2915 ((>= eol eos)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2916 ;; 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
2917 (org-show-entry)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2918 (show-children)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2919 (message "CHILDREN")
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2920 (setq org-cycle-subtree-status 'children)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2921 (run-hook-with-args 'org-cycle-hook 'children))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2922 ((and (eq last-command this-command)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2923 (eq org-cycle-subtree-status 'children))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2924 ;; We just showed the children, now show everything.
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2925 (org-show-subtree)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2926 (message "SUBTREE")
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2927 (setq org-cycle-subtree-status 'subtree)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2928 (run-hook-with-args 'org-cycle-hook 'subtree))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2929 (t
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2930 ;; Default action: hide the subtree.
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2931 (hide-subtree)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2932 (message "FOLDED")
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2933 (setq org-cycle-subtree-status 'folded)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2934 (run-hook-with-args 'org-cycle-hook 'folded)))))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2935
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2936 ;; TAB emulation
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2937 (buffer-read-only (org-back-to-heading))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2938 ((if (and (eq org-cycle-emulate-tab 'white)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2939 (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
2940 t
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2941 (eq org-cycle-emulate-tab t))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2942 (if (and (looking-at "[ \n\r\t]")
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2943 (string-match "^[ \t]*$" (buffer-substring
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2944 (point-at-bol) (point))))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2945 (progn
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2946 (beginning-of-line 1)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2947 (and (looking-at "[ \t]+") (replace-match ""))))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2948 (indent-relative))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2949
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2950 (t (save-excursion
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2951 (org-back-to-heading)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2952 (org-cycle))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2953
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
2954 (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
2955 "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
2956 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
2957 (when (get-buffer-window (current-buffer))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2958 (cond
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2959 ((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
2960 ((eq state 'content) nil)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2961 ((eq state 'all) nil)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2962 ((eq state 'folded) nil)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2963 ((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
2964 ((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
2965
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
2966 (defun org-subtree-end-visible-p ()
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
2967 "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
2968 (pos-visible-in-window-p
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
2969 (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
2970
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
2971 (defun org-first-headline-recenter (&optional N)
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
2972 "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
2973 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
2974 (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
2975 (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
2976 (beginning-of-line)
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
2977 (recenter (prefix-numeric-value N))))
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
2978
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2979 (defvar org-goto-window-configuration nil)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2980 (defvar org-goto-marker nil)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2981 (defvar org-goto-map (make-sparse-keymap))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2982 (let ((cmds '(isearch-forward isearch-backward)) cmd)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2983 (while (setq cmd (pop cmds))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2984 (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
2985 (define-key org-goto-map "\C-m" 'org-goto-ret)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2986 (define-key org-goto-map [(left)] 'org-goto-left)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2987 (define-key org-goto-map [(right)] 'org-goto-right)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2988 (define-key org-goto-map [(?q)] 'org-goto-quit)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2989 (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
2990 (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
2991 (define-key org-goto-map [(tab)] 'org-cycle)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2992 (define-key org-goto-map [(down)] 'outline-next-visible-heading)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2993 (define-key org-goto-map [(up)] 'outline-previous-visible-heading)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2994 (define-key org-goto-map "n" 'outline-next-visible-heading)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2995 (define-key org-goto-map "p" 'outline-previous-visible-heading)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2996 (define-key org-goto-map "f" 'outline-forward-same-level)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2997 (define-key org-goto-map "b" 'outline-backward-same-level)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2998 (define-key org-goto-map "u" 'outline-up-heading)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2999 (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
3000 (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
3001 (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
3002 (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
3003 (define-key org-goto-map "\C-c\C-u" 'outline-up-heading)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3004 (let ((l '(1 2 3 4 5 6 7 8 9 0)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3005 (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
3006
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3007 (defconst org-goto-help
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3008 "Select a location to jump to, press RET
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3009 \[Up]/[Down]=next/prev headline TAB=cycle visibility RET=select [Q]uit")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3010
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3011 (defun org-goto ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3012 "Go to a different location of the document, keeping current visibility.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3013
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3014 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
3015 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
3016 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
3017 which may not be what you want.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3018
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3019 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
3020 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
3021 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
3022 original buffer in which the visibility is still unchanged. It then jumps
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3023 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
3024 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3025 (let* ((org-goto-start-pos (point))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3026 (selected-point
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3027 (org-get-location (current-buffer) org-goto-help)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3028 (if selected-point
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3029 (progn
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
3030 (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
3031 (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
3032 (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
3033 (org-show-hierarchy-above)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3034 (error "Quit"))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3035
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3036 (defun org-get-location (buf help)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3037 "Let the user select a location in the Org-mode buffer BUF.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3038 This function uses a recursive edit. It returns the selected position
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3039 or nil."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3040 (let (org-selected-point)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3041 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3042 (save-window-excursion
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3043 (delete-other-windows)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3044 (switch-to-buffer (get-buffer-create "*org-goto*"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3045 (with-output-to-temp-buffer "*Help*"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3046 (princ help))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3047 (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
3048 (setq buffer-read-only nil)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3049 (erase-buffer)
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
3050 (insert-buffer-substring buf)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3051 (let ((org-startup-truncated t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3052 (org-startup-folded t)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3053 (org-startup-align-all-tables nil)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3054 (org-startup-with-deadline-check nil))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3055 (org-mode))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3056 (setq buffer-read-only t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3057 (if (boundp 'org-goto-start-pos)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3058 (goto-char org-goto-start-pos)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3059 (goto-char (point-min)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3060 (org-beginning-of-line)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3061 (message "Select location and press RET")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3062 ;; 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
3063 ;; 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
3064 (let ((gm (current-global-map))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3065 (overriding-local-map org-goto-map))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3066 (unwind-protect
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3067 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3068 (use-global-map org-goto-map)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3069 (recursive-edit))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3070 (use-global-map gm)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3071 (kill-buffer "*org-goto*")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3072 org-selected-point))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3073
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3074 ;; 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
3075 (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
3076 "Finish `org-goto' by going to the new location."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3077 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3078 (setq org-selected-point (point)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3079 current-prefix-arg arg)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3080 (throw 'exit nil))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3081
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
3082 (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
3083 "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
3084 (interactive)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3085 (if (org-on-heading-p)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3086 (progn
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3087 (beginning-of-line 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3088 (setq org-selected-point (point)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3089 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
3090 (throw 'exit nil))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3091 (error "Not on a heading")))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3092
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
3093 (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
3094 "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
3095 (interactive)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3096 (if (org-on-heading-p)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3097 (progn
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3098 (outline-end-of-subtree)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3099 (or (eobp) (forward-char 1))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3100 (setq org-selected-point (point)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3101 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
3102 (throw 'exit nil))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3103 (error "Not on a heading")))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3104
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3105 (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
3106 "Finish `org-goto' without cursor motion."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3107 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3108 (setq org-selected-point nil)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3109 (throw 'exit nil))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3110
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3111 ;;; Promotion, Demotion, Inserting new headlines
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3112
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3113 (defvar org-ignore-region nil
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
3114 "To temporarily disable the active region.")
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
3115
67380
7b2c13a9190d (org-insert-heading): Try to do items before headings.
Carsten Dominik <dominik@science.uva.nl>
parents: 67342
diff changeset
3116 (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
3117 "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
3118 (interactive "P")
7b2c13a9190d (org-insert-heading): Try to do items before headings.
Carsten Dominik <dominik@science.uva.nl>
parents: 67342
diff changeset
3119 (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
3120 (let* ((head (save-excursion
7b2c13a9190d (org-insert-heading): Try to do items before headings.
Carsten Dominik <dominik@science.uva.nl>
parents: 67342
diff changeset
3121 (condition-case nil
7b2c13a9190d (org-insert-heading): Try to do items before headings.
Carsten Dominik <dominik@science.uva.nl>
parents: 67342
diff changeset
3122 (org-back-to-heading)
7b2c13a9190d (org-insert-heading): Try to do items before headings.
Carsten Dominik <dominik@science.uva.nl>
parents: 67342
diff changeset
3123 (error (outline-next-heading)))
7b2c13a9190d (org-insert-heading): Try to do items before headings.
Carsten Dominik <dominik@science.uva.nl>
parents: 67342
diff changeset
3124 (prog1 (match-string 0)
7b2c13a9190d (org-insert-heading): Try to do items before headings.
Carsten Dominik <dominik@science.uva.nl>
parents: 67342
diff changeset
3125 (funcall outline-level)))))
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
3126 (cond
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
3127 ((and (org-on-heading-p) (bolp)
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
3128 (save-excursion (backward-char 1) (not (org-invisible-p))))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
3129 (open-line 1))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
3130 ((bolp) nil)
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
3131 (t (newline)))
67380
7b2c13a9190d (org-insert-heading): Try to do items before headings.
Carsten Dominik <dominik@science.uva.nl>
parents: 67342
diff changeset
3132 (insert head)
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
3133 (just-one-space)
67380
7b2c13a9190d (org-insert-heading): Try to do items before headings.
Carsten Dominik <dominik@science.uva.nl>
parents: 67342
diff changeset
3134 (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
3135
7b2c13a9190d (org-insert-heading): Try to do items before headings.
Carsten Dominik <dominik@science.uva.nl>
parents: 67342
diff changeset
3136 (defun org-insert-item ()
7b2c13a9190d (org-insert-heading): Try to do items before headings.
Carsten Dominik <dominik@science.uva.nl>
parents: 67342
diff changeset
3137 "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
3138 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
3139 (when (save-excursion
7b2c13a9190d (org-insert-heading): Try to do items before headings.
Carsten Dominik <dominik@science.uva.nl>
parents: 67342
diff changeset
3140 (condition-case nil
7b2c13a9190d (org-insert-heading): Try to do items before headings.
Carsten Dominik <dominik@science.uva.nl>
parents: 67342
diff changeset
3141 (progn
7b2c13a9190d (org-insert-heading): Try to do items before headings.
Carsten Dominik <dominik@science.uva.nl>
parents: 67342
diff changeset
3142 (org-beginning-of-item)
7b2c13a9190d (org-insert-heading): Try to do items before headings.
Carsten Dominik <dominik@science.uva.nl>
parents: 67342
diff changeset
3143 (org-at-item-p)
7b2c13a9190d (org-insert-heading): Try to do items before headings.
Carsten Dominik <dominik@science.uva.nl>
parents: 67342
diff changeset
3144 t)
7b2c13a9190d (org-insert-heading): Try to do items before headings.
Carsten Dominik <dominik@science.uva.nl>
parents: 67342
diff changeset
3145 (error nil)))
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
3146 (let* ((bul (match-string 0))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
3147 (eow (save-excursion (beginning-of-line 1) (looking-at "[ \t]*")
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
3148 (match-end 0)))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
3149 (eowcol (save-excursion (goto-char eow) (current-column))))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
3150 (cond
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
3151 ((and (org-at-item-p) (<= (point) eow))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
3152 ;; before the bullet
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
3153 (beginning-of-line 1)
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
3154 (open-line 1))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
3155 ((<= (point) eow)
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
3156 (beginning-of-line 1))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
3157 (t (newline)))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
3158 (insert bul)
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
3159 (just-one-space))
67380
7b2c13a9190d (org-insert-heading): Try to do items before headings.
Carsten Dominik <dominik@science.uva.nl>
parents: 67342
diff changeset
3160 (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
3161 t))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3162
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
3163 (defun org-insert-todo-heading (arg)
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
3164 "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
3165 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
3166 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
3167 (interactive "P")
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
3168 (org-insert-heading)
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
3169 (save-excursion
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
3170 (org-back-to-heading)
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
3171 (outline-previous-heading)
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
3172 (looking-at org-todo-line-regexp))
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
3173 (if (or arg
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3174 (not (match-beginning 2))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3175 (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
3176 (insert (car org-todo-keywords) " ")
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
3177 (insert (match-string 2) " ")))
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
3178
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
3179 (defun org-promote-subtree ()
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3180 "Promote the entire subtree.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3181 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
3182 (interactive)
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
3183 (save-excursion
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
3184 (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
3185
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
3186 (defun org-demote-subtree ()
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3187 "Demote the entire subtree. See `org-demote'.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3188 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
3189 (interactive)
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
3190 (save-excursion
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
3191 (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
3192
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
3193 (defun org-do-promote ()
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3194 "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
3195 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
3196 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
3197 (interactive)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3198 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3199 (if (org-region-active-p)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3200 (org-map-region 'org-promote (region-beginning) (region-end))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3201 (org-promote)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3202 (org-fix-position-after-promote))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3203
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
3204 (defun org-do-demote ()
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3205 "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
3206 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
3207 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
3208 (interactive)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3209 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3210 (if (org-region-active-p)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3211 (org-map-region 'org-demote (region-beginning) (region-end))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3212 (org-demote)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3213 (org-fix-position-after-promote))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3214
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3215 (defun org-fix-position-after-promote ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3216 "Make sure that after pro/demotion cursor position is right."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3217 (and (equal (char-after) ?\ )
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3218 (equal (char-before) ?*)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3219 (forward-char 1)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3220
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
3221 (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
3222 "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
3223 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
3224 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
3225 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
3226 (if org-odd-levels-only
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
3227 (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
3228 ((> 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
3229 ((< 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
3230 (max 1 (+ level change))))
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
3231
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3232 (defun org-promote ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3233 "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
3234 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
3235 in the region."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3236 (org-back-to-heading t)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3237 (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
3238 (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
3239 (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
3240 (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
3241 (replace-match up-head nil t)
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
3242 ;; Fixup tag positioning
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
3243 (and org-auto-align-tags (org-set-tags nil t))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3244 (if org-adapt-indentation
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
3245 (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
3246 (if (> diff 1) "^ ? ?\\S-" "^ ?\\S-")))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3247
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3248 (defun org-demote ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3249 "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
3250 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
3251 in the region."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3252 (org-back-to-heading t)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3253 (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
3254 (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
3255 (diff (abs (- level (length down-head)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3256 (replace-match down-head nil t)
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
3257 ;; Fixup tag positioning
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
3258 (and org-auto-align-tags (org-set-tags nil t))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3259 (if org-adapt-indentation
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
3260 (org-fixup-indentation "^ " (if (> diff 1) " " " ") "^\\S-"))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3261
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3262 (defun org-map-tree (fun)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3263 "Call FUN for every heading underneath the current one."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3264 (org-back-to-heading)
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
3265 (let ((level (funcall outline-level)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3266 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3267 (funcall fun)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3268 (while (and (progn
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3269 (outline-next-heading)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3270 (> (funcall outline-level) level))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3271 (not (eobp)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3272 (funcall fun)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3273
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3274 (defun org-map-region (fun beg end)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3275 "Call FUN for every heading between BEG and END."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3276 (let ((org-ignore-region t))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3277 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3278 (setq end (copy-marker end))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3279 (goto-char beg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3280 (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
3281 (< (point) end))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3282 (funcall fun))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3283 (while (and (progn
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3284 (outline-next-heading)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3285 (< (point) end))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3286 (not (eobp)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3287 (funcall fun)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3288
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3289 (defun org-fixup-indentation (from to prohibit)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3290 "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
3291 However, if the regexp PROHIBIT matches at all, don't do anything.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3292 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
3293 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
3294 is changed at all."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3295 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3296 (let ((end (save-excursion (outline-next-heading)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3297 (point-marker))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3298 (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
3299 (while (re-search-forward from end t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3300 (replace-match to)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3301 (beginning-of-line 2)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3302 (move-marker end nil))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3303
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3304 ;;; Vertical tree motion, cutting and pasting of subtrees
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3305
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3306 (defun org-move-subtree-up (&optional arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3307 "Move the current subtree up past ARG headlines of the same level."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3308 (interactive "p")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3309 (org-move-subtree-down (- (prefix-numeric-value arg))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3310
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3311 (defun org-move-subtree-down (&optional arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3312 "Move the current subtree down past ARG headlines of the same level."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3313 (interactive "p")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3314 (setq arg (prefix-numeric-value arg))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3315 (let ((movfunc (if (> arg 0) 'outline-get-next-sibling
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3316 'outline-get-last-sibling))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3317 (ins-point (make-marker))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3318 (cnt (abs arg))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3319 beg end txt folded)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3320 ;; Select the tree
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3321 (org-back-to-heading)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3322 (setq beg (point))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3323 (save-match-data
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3324 (save-excursion (outline-end-of-heading)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3325 (setq folded (org-invisible-p)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3326 (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
3327 (outline-next-heading)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3328 (setq end (point))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3329 ;; Find insertion point, with error handling
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3330 (goto-char beg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3331 (while (> cnt 0)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3332 (or (and (funcall movfunc) (looking-at outline-regexp))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3333 (progn (goto-char beg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3334 (error "Cannot move past superior level or buffer limit")))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3335 (setq cnt (1- cnt)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3336 (if (> arg 0)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3337 ;; Moving forward - still need to move over subtree
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3338 (progn (outline-end-of-subtree)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3339 (outline-next-heading)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3340 (if (not (or (looking-at (concat "^" outline-regexp))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3341 (bolp)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3342 (newline))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3343 (move-marker ins-point (point))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3344 (setq txt (buffer-substring beg end))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3345 (delete-region beg end)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3346 (insert txt)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3347 (goto-char ins-point)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3348 (if folded (hide-subtree))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3349 (move-marker ins-point nil)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3350
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3351 (defvar org-subtree-clip ""
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3352 "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
3353 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
3354 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
3355
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3356 (defvar org-subtree-clip-folded nil
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
3357 "Was the last copied subtree folded?
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3358 This is used to fold the tree back after pasting.")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3359
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
3360 (defun org-cut-subtree ()
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3361 "Cut the current subtree into the clipboard.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3362 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
3363 (interactive)
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
3364 (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
3365
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
3366 (defun org-copy-subtree (&optional cut)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3367 "Cut the current subtree into the clipboard.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3368 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
3369 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
3370 (interactive)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3371 (let (beg end folded)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3372 (org-back-to-heading)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3373 (setq beg (point))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3374 (save-match-data
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3375 (save-excursion (outline-end-of-heading)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3376 (setq folded (org-invisible-p)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3377 (outline-end-of-subtree))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3378 (if (equal (char-after) ?\n) (forward-char 1))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3379 (setq end (point))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3380 (goto-char beg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3381 (when (> end beg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3382 (setq org-subtree-clip-folded folded)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3383 (if cut (kill-region beg end) (copy-region-as-kill beg end))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3384 (setq org-subtree-clip (current-kill 0))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3385 (message "%s: Subtree with %d characters"
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3386 (if cut "Cut" "Copied")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3387 (length org-subtree-clip)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3388
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3389 (defun org-paste-subtree (&optional level tree)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3390 "Paste the clipboard as a subtree, with modification of headline level.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3391 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
3392 level. By default, the new level is derived from the visible headings
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3393 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
3394 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
3395 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
3396 This makes sure that the subtree remains an independent subtree and does
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3397 not swallow low level entries.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3398
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3399 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
3400 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
3401 cursor is after \"*****\", then the tree will be shifted to level 5.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3402
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3403 If you want to insert the tree as is, just use \\[yank].
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3404
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3405 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
3406 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3407 (unless (org-kill-is-subtree-p tree)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3408 (error
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3409 (substitute-command-keys
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3410 "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
3411 (let* ((txt (or tree (current-kill 0)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3412 (^re (concat "^\\(" outline-regexp "\\)"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3413 (re (concat "\\(" outline-regexp "\\)"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3414 (^re_ (concat "\\(" outline-regexp "\\)[ \t]*"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3415
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3416 (old-level (if (string-match ^re txt)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3417 (- (match-end 0) (match-beginning 0))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3418 -1))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3419 (force-level (cond (level (prefix-numeric-value level))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3420 ((string-match
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3421 ^re_ (buffer-substring (point-at-bol) (point)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3422 (- (match-end 0) (match-beginning 0)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3423 (t nil)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3424 (previous-level (save-excursion
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3425 (condition-case nil
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3426 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3427 (outline-previous-visible-heading 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3428 (if (looking-at re)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3429 (- (match-end 0) (match-beginning 0))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3430 1))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3431 (error 1))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3432 (next-level (save-excursion
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3433 (condition-case nil
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3434 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3435 (outline-next-visible-heading 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3436 (if (looking-at re)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3437 (- (match-end 0) (match-beginning 0))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3438 1))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3439 (error 1))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3440 (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
3441 (shift (if (or (= old-level -1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3442 (= new-level -1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3443 (= old-level new-level))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3444 0
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3445 (- new-level old-level)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3446 (shift1 shift)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3447 (delta (if (> shift 0) -1 1))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3448 (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
3449 (org-odd-levels-only nil)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3450 beg end)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3451 ;; Remove the forces level indicator
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3452 (if force-level
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3453 (delete-region (point-at-bol) (point)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3454 ;; Make sure we start at the beginning of an empty line
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3455 (if (not (bolp)) (insert "\n"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3456 (if (not (looking-at "[ \t]*$"))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3457 (progn (insert "\n") (backward-char 1)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3458 ;; Paste
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3459 (setq beg (point))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3460 (insert txt)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3461 (setq end (point))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3462 (goto-char beg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3463 ;; Shift if necessary
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3464 (if (= shift 0)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3465 (message "Pasted at level %d, without shift" new-level)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3466 (save-restriction
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3467 (narrow-to-region beg end)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3468 (while (not (= shift 0))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3469 (org-map-region func (point-min) (point-max))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3470 (setq shift (+ delta shift)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3471 (goto-char (point-min))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3472 (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
3473 new-level shift1)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3474 (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
3475 org-subtree-clip-folded)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3476 ;; 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
3477 (hide-subtree))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3478
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3479 (defun org-kill-is-subtree-p (&optional txt)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3480 "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
3481 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
3482 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
3483 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
3484 which is OK for `org-paste-subtree'.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3485 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
3486 (let* ((kill (or txt (current-kill 0) ""))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3487 (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
3488 (- (match-end 0) (match-beginning 0))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3489 (re (concat "^" outline-regexp))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3490 (start 1))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3491 (if (not start-level)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3492 nil ;; does not even start with a heading
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3493 (catch 'exit
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3494 (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
3495 (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
3496 (throw 'exit nil)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3497 t))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3498
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
3499 ;;; Plain list items
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3500
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3501 (defun org-at-item-p ()
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3502 "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
3503 (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
3504 (save-excursion
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3505 (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
3506 (looking-at
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3507 (cond
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3508 ((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
3509 ((= llt ?.) "\\([ \t]*\\([-+]\\|\\([0-9]+\\.\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)")
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3510 ((= llt ?\)) "\\([ \t]*\\([-+]\\|\\([0-9]+)\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)")
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3511 (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
3512
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3513 (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
3514 "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
3515 (save-excursion
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3516 (beginning-of-line 1)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3517 (skip-chars-forward " \t")
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3518 (current-column)))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3519
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3520 (defun org-beginning-of-item ()
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3521 "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
3522 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
3523 (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
3524 (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
3525 (beginning-of-line 2) (point)))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3526 ind ind1)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3527 (if (org-at-item-p)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3528 (beginning-of-line 1)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3529 (beginning-of-line 1)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3530 (skip-chars-forward " \t")
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3531 (setq ind (current-column))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3532 (if (catch 'exit
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3533 (while t
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3534 (beginning-of-line 0)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3535 (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
3536 (unless (looking-at " \t]*$")
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3537 (skip-chars-forward " \t")
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3538 (setq ind1 (current-column))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3539 (if (< ind1 ind)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3540 (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
3541 nil
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3542 (goto-char pos)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3543 (error "Not in an item")))))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3544
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3545 (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
3546 "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
3547 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
3548 (let ((pos (point))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3549 (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
3550 (ind (save-excursion
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3551 (org-beginning-of-item)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3552 (skip-chars-forward " \t")
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3553 (current-column)))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3554 ind1)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3555 (if (catch 'exit
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3556 (while t
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3557 (beginning-of-line 2)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3558 (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
3559 (unless (looking-at "[ \t]*$")
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3560 (skip-chars-forward " \t")
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3561 (setq ind1 (current-column))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3562 (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
3563 (beginning-of-line 1)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3564 (goto-char pos)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3565 (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
3566
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3567 (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
3568 "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
3569 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
3570 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
3571 (interactive "p")
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3572 (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
3573 (org-beginning-of-item)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3574 (setq beg (point))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3575 (setq ind (org-get-indentation))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3576 (org-end-of-item)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3577 (setq end (point))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3578 (setq ind1 (org-get-indentation))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3579 (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
3580 (progn
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3581 (org-end-of-item)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3582 (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
3583 (save-excursion
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3584 (delete-region beg end))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3585 (setq pos (point))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3586 (insert txt)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3587 (goto-char pos)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3588 (org-maybe-renumber-ordered-list))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3589 (goto-char pos)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3590 (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
3591
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3592 (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
3593 "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
3594 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
3595 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
3596 (interactive "p")
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3597 (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
3598 (org-beginning-of-item)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3599 (setq beg (point))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3600 (setq ind (org-get-indentation))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3601 (org-end-of-item)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3602 (setq end (point))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3603 (goto-char beg)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3604 (catch 'exit
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3605 (while t
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3606 (beginning-of-line 0)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3607 (if (looking-at "[ \t]*$")
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3608 nil
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3609 (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
3610 (throw 'exit t)))))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3611 (condition-case nil
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3612 (org-beginning-of-item)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3613 (error (goto-char beg)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3614 (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
3615 (setq ind1 (org-get-indentation))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3616 (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
3617 (progn
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3618 (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
3619 (save-excursion
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3620 (delete-region beg end))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3621 (setq pos (point))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3622 (insert txt)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3623 (goto-char pos)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3624 (org-maybe-renumber-ordered-list))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3625 (goto-char pos)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3626 (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
3627
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3628 (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
3629 "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
3630 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
3631 doing the renumbering."
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3632 (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
3633 (org-at-item-p)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3634 (match-beginning 3)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3635 (org-renumber-ordered-list 1)))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3636
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3637 (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
3638 "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
3639 (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
3640 (catch 'exit
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3641 (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
3642 (setq c (aref s n))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3643 (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
3644 ((= 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
3645 (t (throw 'exit t)))))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3646 i))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3647
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3648 (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
3649 "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
3650 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
3651 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
3652 (interactive "p")
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3653 (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
3654 (match-beginning 3))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3655 (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
3656 (let ((line (org-current-line))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3657 (col (current-column))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3658 (ind (org-get-string-indentation
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3659 (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
3660 ;; (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
3661 ind1 (n (1- arg)))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3662 ;; find where this list begins
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3663 (catch 'exit
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3664 (while t
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3665 (catch 'next
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3666 (beginning-of-line 0)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3667 (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
3668 (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
3669 (if (or (< ind1 ind)
7b2c13a9190d (org-insert-heading): Try to do items before headings.
Carsten Dominik <dominik@science.uva.nl>
parents: 67342
diff changeset
3670 (and (= ind1 ind)
7b2c13a9190d (org-insert-heading): Try to do items before headings.
Carsten Dominik <dominik@science.uva.nl>
parents: 67342
diff changeset
3671 (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
3672 (throw 'exit t)))))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3673 ;; 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
3674 (catch 'exit
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3675 (while t
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3676 (catch 'next
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3677 (beginning-of-line 2)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3678 (if (eobp) (throw 'exit nil))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3679 (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
3680 (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
3681 (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
3682 (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
3683 (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
3684 (if (not (match-beginning 3))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3685 (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
3686 (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
3687 (goto-char (match-beginning 3))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3688 (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
3689 (goto-line line)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3690 (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
3691
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3692 (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
3693 (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
3694
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3695 (defun org-outdent-item (arg)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3696 "Outdent a local list item."
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3697 (interactive "p")
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3698 (org-indent-item (- arg)))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3699
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3700 (defun org-indent-item (arg)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3701 "Indent a local list item."
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3702 (interactive "p")
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3703 (unless (org-at-item-p)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3704 (error "Not on an item"))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3705 (let (beg end ind ind1)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3706 (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
3707 (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
3708 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
3709 (org-beginning-of-item)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3710 (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
3711 (org-end-of-item)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3712 (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
3713 (goto-char beg)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3714 (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
3715 (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
3716 (while (< (point) end)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3717 (beginning-of-line 1)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3718 (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
3719 (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
3720 (indent-to-column (+ ind1 arg))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3721 (beginning-of-line 2))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3722 (goto-char beg)))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3723
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3724 ;;; Archiving
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3725
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
3726 (defun org-archive-subtree ()
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
3727 "Move the current subtree to the archive.
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
3728 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
3729 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
3730 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
3731 (interactive)
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
3732 ;; Save all relevant TODO keyword-relatex variables
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
3733 (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
3734 (tr-org-todo-keywords org-todo-keywords)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3735 (tr-org-todo-interpretation org-todo-interpretation)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3736 (tr-org-done-string org-done-string)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3737 (tr-org-todo-regexp org-todo-regexp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3738 (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
3739 (this-buffer (current-buffer))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3740 file heading buffer level newfile-p)
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
3741 (if (string-match "\\(.*\\)::\\(.*\\)" org-archive-location)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3742 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3743 (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
3744 (file-name-nondirectory buffer-file-name))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3745 heading (match-string 2 org-archive-location)))
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
3746 (error "Invalid `org-archive-location'"))
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
3747 (if (> (length file) 0)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3748 (setq newfile-p (not (file-exists-p file))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3749 buffer (find-file-noselect file))
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
3750 (setq buffer (current-buffer)))
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
3751 (unless buffer
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
3752 (error "Cannot access file \"%s\"" file))
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
3753 (if (and (> (length heading) 0)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3754 (string-match "^\\*+" heading))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3755 (setq level (match-end 0))
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
3756 (setq heading nil level 0))
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
3757 (save-excursion
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
3758 ;; 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
3759 ;; 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
3760 ;; 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
3761 (let (this-command) (org-copy-subtree))
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
3762 (set-buffer buffer)
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
3763 ;; Enforce org-mode for the archive buffer
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
3764 (if (not (eq major-mode 'org-mode))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3765 ;; Force the mode for future visits.
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3766 (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
3767 (call-interactively 'org-mode)))
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
3768 (when newfile-p
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3769 (goto-char (point-max))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3770 (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
3771 (buffer-file-name this-buffer))))
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
3772 ;; Force the TODO keywords of the original buffer
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
3773 (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
3774 (org-todo-keywords tr-org-todo-keywords)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3775 (org-todo-interpretation tr-org-todo-interpretation)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3776 (org-done-string tr-org-done-string)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3777 (org-todo-regexp tr-org-todo-regexp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3778 (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
3779 (goto-char (point-min))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3780 (if heading
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3781 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3782 (if (re-search-forward
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3783 (concat "\\(^\\|\r\\)"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3784 (regexp-quote heading) "[ \t]*\\($\\|\r\\)")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3785 nil t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3786 (goto-char (match-end 0))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3787 ;; 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
3788 (goto-char (point-max))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3789 (or (bolp) (insert "\n"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3790 (insert "\n" heading "\n")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3791 (end-of-line 0))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3792 ;; 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
3793 (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
3794 (if (re-search-forward
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3795 (concat "^" (regexp-quote (make-string level ?*)) "[ \t]")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3796 nil t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3797 (progn (goto-char (match-beginning 0)) (insert "\n")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3798 (beginning-of-line 0))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3799 (goto-char (point-max)) (insert "\n")))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3800 (goto-char (point-max)) (insert "\n"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3801 ;; Paste
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3802 (org-paste-subtree (1+ level))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3803 ;; 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
3804 (if org-archive-mark-done
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3805 (org-todo (length org-todo-keywords)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3806 ;; Move cursor to right after the TODO keyword
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3807 (when org-archive-stamp-time
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3808 (beginning-of-line 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3809 (looking-at org-todo-line-regexp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3810 (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
3811 (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
3812 (org-current-time))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3813 ")"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3814 ;; 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
3815 (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
3816 ;; 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
3817 ;; 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
3818 (let (this-command) (org-cut-subtree))
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
3819 (if (looking-at "[ \t]*$") (kill-line))
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
3820 (message "Subtree archived %s"
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3821 (if (eq this-buffer buffer)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3822 (concat "under heading: " heading)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3823 (concat "in file: " (abbreviate-file-name file))))))
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
3824
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3825 ;;; Completion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3826
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3827 (defun org-complete (&optional arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3828 "Perform completion on word at point.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3829 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
3830 `org-todo-keywords'.
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
3831 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
3832 that are supported for HTML support.
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
3833 If the current word is preceded by \"#+\", completes special words for
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3834 setting file options.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3835 At all other locations, this simply calls `ispell-complete-word'."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3836 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3837 (catch 'exit
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3838 (let* ((end (point))
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
3839 (beg1 (save-excursion
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
3840 (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
3841 (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
3842 (point)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3843 (beg (save-excursion
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3844 (if (equal (char-before (point)) ?\ ) (backward-char 1))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3845 (skip-chars-backward "a-zA-Z0-9_:$")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3846 (point)))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3847 (camel (equal (char-before beg) ?*))
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
3848 (tag (equal (char-before beg1) ?:))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3849 (texp (equal (char-before beg) ?\\))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3850 (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
3851 beg)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3852 "#+"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3853 (completion-ignore-case opt)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3854 (type nil)
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3855 (tbl nil)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3856 (table (cond
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3857 (opt
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3858 (setq type :opt)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3859 (mapcar (lambda (x)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3860 (string-match "^#\\+\\(\\([A-Z_]+:?\\).*\\)" x)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3861 (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
3862 (org-split-string (org-get-current-options) "\n")))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3863 (texp
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3864 (setq type :tex)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3865 org-html-entities)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3866 ((string-match "\\`\\*+[ \t]*\\'"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3867 (buffer-substring (point-at-bol) beg))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3868 (setq type :todo)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3869 (mapcar 'list org-todo-keywords))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3870 (camel
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3871 (setq type :camel)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3872 (save-excursion
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3873 (goto-char (point-min))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3874 (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
3875 (push (list
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
3876 (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
3877 (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
3878 (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
3879 (match-string 3) t)))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3880 tbl)))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3881 tbl)
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
3882 (tag (setq type :tag beg beg1)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
3883 (org-get-buffer-tags))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3884 (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
3885 (pattern (buffer-substring-no-properties beg end))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3886 (completion (try-completion pattern table)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3887 (cond ((eq completion t)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3888 (if (equal type :opt)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3889 (insert (substring (cdr (assoc (upcase pattern) table))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3890 (length pattern)))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3891 ((null completion)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3892 (message "Can't find completion for \"%s\"" pattern)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3893 (ding))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3894 ((not (string= pattern completion))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3895 (delete-region beg end)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3896 (if (string-match " +$" completion)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3897 (setq completion (replace-match "" t t completion)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3898 (insert completion)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3899 (if (get-buffer-window "*Completions*")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3900 (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
3901 (if (assoc completion table)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
3902 (if (eq type :todo) (insert " ")
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
3903 (if (eq type :tag) (insert ":"))))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3904 (if (and (equal type :opt) (assoc completion table))
65583
703495630901 Message format spec fixes (2)
Deepak Goel <deego@gnufans.org>
parents: 65264
diff changeset
3905 (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
3906 "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
3907 (t
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3908 (message "Making completion list...")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3909 (let ((list (sort (all-completions pattern table) 'string<)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3910 (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
3911 (condition-case nil
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
3912 ;; 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
3913 (display-completion-list list pattern)
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
3914 (error (display-completion-list list)))))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3915 (message "Making completion list...%s" "done"))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3916
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3917 ;;; Comments, TODO and DEADLINE
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3918
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3919 (defun org-toggle-comment ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3920 "Change the COMMENT state of an entry."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3921 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3922 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3923 (org-back-to-heading)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3924 (if (looking-at (concat outline-regexp
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3925 "\\( +\\<" org-comment-string "\\>\\)"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3926 (replace-match "" t t nil 1)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3927 (if (looking-at outline-regexp)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3928 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3929 (goto-char (match-end 0))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3930 (insert " " org-comment-string))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3931
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
3932 (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
3933 "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
3934 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
3935 this is nil.")
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
3936
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3937 (defun org-todo (&optional arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3938 "Change the TODO state of an item.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3939 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
3940 like
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3941 *** TODO Write paper
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3942 *** DONE Call mom
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3943
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
3944 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
3945 By default the available states are \"TODO\" and \"DONE\".
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3946 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
3947 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
3948 DONE are present, add TODO at the beginning of the heading.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3949
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
3950 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
3951 prefix arg, switch to that state."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3952 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3953 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3954 (org-back-to-heading)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3955 (if (looking-at outline-regexp) (goto-char (match-end 0)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3956 (or (looking-at (concat " +" org-todo-regexp " *"))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3957 (looking-at " *"))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3958 (let* ((this (match-string 1))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3959 (completion-ignore-case t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3960 (member (member this org-todo-keywords))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3961 (tail (cdr member))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3962 (state (cond
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3963 ((equal arg '(4))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3964 ;; Read a state with completion
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3965 (completing-read "State: " (mapcar (lambda(x) (list x))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3966 org-todo-keywords)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3967 nil t))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3968 ((eq arg 'right)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3969 (if this
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3970 (if tail (car tail) nil)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3971 (car org-todo-keywords)))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3972 ((eq arg 'left)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3973 (if (equal member org-todo-keywords)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3974 nil
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3975 (if this
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3976 (nth (- (length org-todo-keywords) (length tail) 2)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3977 org-todo-keywords)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3978 org-done-string)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3979 (arg
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3980 ;; user requests a specific state
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3981 (nth (1- (prefix-numeric-value arg))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3982 org-todo-keywords))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3983 ((null member) (car org-todo-keywords))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3984 ((null tail) nil) ;; -> first entry
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3985 ((eq org-todo-interpretation 'sequence)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3986 (car tail))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3987 ((memq org-todo-interpretation '(type priority))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3988 (if (eq this-command last-command)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3989 (car tail)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3990 (if (> (length tail) 0) org-done-string nil)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3991 (t nil)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3992 (next (if state (concat " " state " ") " ")))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3993 (replace-match next t t)
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
3994 (setq org-last-todo-state-is-todo
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3995 (not (equal state org-done-string)))
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
3996 (when org-log-done
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
3997 (if (equal state org-done-string)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
3998 (org-log-done)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
3999 (if (not this)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
4000 (org-log-done t))))
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4001 ;; Fixup tag positioning
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4002 (and org-auto-align-tags (org-set-tags nil t))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4003 (run-hooks 'org-after-todo-state-change-hook)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4004 ;; Fixup cursor location if close to the keyword
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4005 (if (and (outline-on-heading-p)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4006 (not (bolp))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4007 (save-excursion (beginning-of-line 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4008 (looking-at org-todo-line-regexp))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4009 (< (point) (+ 2 (or (match-end 2) (match-end 1)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4010 (progn
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4011 (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
4012 (just-one-space))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4013
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
4014 (defun org-log-done (&optional undone)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
4015 "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
4016 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
4017 (interactive)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
4018 (let (beg end col)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
4019 (save-excursion
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
4020 (org-back-to-heading t)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
4021 (setq beg (point))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
4022 (looking-at (concat outline-regexp " *"))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
4023 (goto-char (match-end 0))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
4024 (setq col (current-column))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
4025 (outline-next-heading)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
4026 (setq end (point))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
4027 (goto-char beg)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
4028 (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
4029 "[\r\n]\\([ \t]*"
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
4030 (regexp-quote org-closed-string)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
4031 " *\\[.*?\\][^\n\r]*[\n\r]?\\)") end t)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
4032 (delete-region (match-beginning 1) (match-end 1)))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
4033 (unless undone
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
4034 (org-back-to-heading t)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
4035 (skip-chars-forward "^\n\r")
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
4036 (goto-char (min (1+ (point)) (point-max)))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
4037 (when (not (member (char-before) '(?\r ?\n)))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
4038 (insert "\n"))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
4039 (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
4040 (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
4041 (format-time-string
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
4042 (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
4043 (org-current-time))
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
4044 "\n")))))
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
4045
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4046 (defun org-show-todo-tree (arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4047 "Make a compact tree which shows all headlines marked with TODO.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4048 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
4049 headlines above the match.
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
4050 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
4051 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
4052 of `org-todo-keywords'."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4053 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4054 (let ((case-fold-search nil)
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
4055 (kwd-re
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
4056 (cond ((null arg) org-not-done-regexp)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
4057 ((equal arg '(4)) org-todo-regexp)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
4058 ((<= (prefix-numeric-value arg) (length org-todo-keywords))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
4059 (regexp-quote (nth (1- (prefix-numeric-value arg))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
4060 org-todo-keywords)))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
4061 (t (error "Invalid prefix argument: %s" arg)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4062 (message "%d TODO entries found"
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4063 (org-occur (concat "^" outline-regexp " +" kwd-re )))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4064
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4065 (defun org-deadline ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4066 "Insert the DEADLINE: string to make a deadline.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4067 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
4068 to modify it to the correct date."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4069 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4070 (insert
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4071 org-deadline-string " "
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4072 (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
4073 (org-read-date nil 'to-time)))
65583
703495630901 Message format spec fixes (2)
Deepak Goel <deego@gnufans.org>
parents: 65264
diff changeset
4074 (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
4075 "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
4076
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4077 (defun org-schedule ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4078 "Insert the SCHEDULED: string to schedule a TODO item.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4079 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
4080 to modify it to the correct date."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4081 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4082 (insert
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4083 org-scheduled-string " "
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4084 (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
4085 (org-read-date nil 'to-time)))
65583
703495630901 Message format spec fixes (2)
Deepak Goel <deego@gnufans.org>
parents: 65264
diff changeset
4086 (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
4087 "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
4088
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4089
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4090 (defun org-occur (regexp &optional callback)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4091 "Make a compact tree which shows all matches of REGEXP.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4092 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
4093 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
4094 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
4095 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
4096 that the match should indeed be shown."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4097 (interactive "sRegexp: ")
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
4098 (org-remove-occur-highlights nil nil t)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4099 (setq regexp (org-check-occur-regexp regexp))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4100 (let ((cnt 0))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4101 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4102 (goto-char (point-min))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4103 (hide-sublevels 1)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4104 (while (re-search-forward regexp nil t)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4105 (when (or (not callback)
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
4106 (save-match-data (funcall callback)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4107 (setq cnt (1+ cnt))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
4108 (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
4109 (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
4110 (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
4111 nil 'local)
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
4112 (run-hooks 'org-occur-hook)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4113 (if (interactive-p)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4114 (message "%d match(es) for regexp %s" cnt regexp))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4115 cnt))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4116
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4117 (defun org-show-hierarchy-above ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4118 "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
4119 (catch 'exit
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4120 (if (org-on-heading-p t)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4121 (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
4122 (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
4123 (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
4124 (save-excursion
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4125 (and org-show-following-heading
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4126 (outline-next-heading)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4127 (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
4128 (when org-show-hierarchy-above
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4129 (save-excursion ; show all higher headings
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4130 (while (and (condition-case nil
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4131 (progn (org-up-heading-all 1) t)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4132 (error nil))
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4133 (not (bobp)))
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4134 (org-flag-heading nil))))))
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4135
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4136 ;; Overlay compatibility functions
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4137 (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
4138 (if (featurep 'xemacs)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4139 (make-extent beg end buffer)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4140 (make-overlay beg end buffer)))
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4141 (defun org-delete-overlay (ovl)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4142 (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
4143 (defun org-detatch-overlay (ovl)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4144 (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
4145 (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
4146 (if (featurep 'xemacs)
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4147 (set-extent-endpoints ovl beg end buffer)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4148 (move-overlay ovl beg end buffer)))
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4149 (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
4150 (if (featurep 'xemacs)
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4151 (set-extent-property ovl prop value)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4152 (overlay-put ovl prop value)))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
4153
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
4154 (defvar org-occur-highlights nil)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
4155 (defun org-highlight-new-match (beg end)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
4156 "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
4157 (let ((ov (org-make-overlay beg end)))
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4158 (org-overlay-put ov 'face 'secondary-selection)
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
4159 (push ov org-occur-highlights)))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
4160
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
4161 (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
4162 "Remove the occur highlights from the buffer.
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
4163 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
4164 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
4165 (interactive)
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4166 (mapc 'org-delete-overlay org-occur-highlights)
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
4167 (setq org-occur-highlights nil)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
4168 (unless noremove
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
4169 (remove-hook 'before-change-functions
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
4170 '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
4171
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4172 ;;; Priorities
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4173
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4174 (defvar org-priority-regexp ".*?\\(\\[#\\([A-Z]\\)\\] ?\\)"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4175 "Regular expression matching the priority indicator.")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4176
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
4177 (defvar org-remove-priority-next-time nil)
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
4178
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4179 (defun org-priority-up ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4180 "Increase the priority of the current item."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4181 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4182 (org-priority 'up))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4183
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4184 (defun org-priority-down ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4185 "Decrease the priority of the current item."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4186 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4187 (org-priority 'down))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4188
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4189 (defun org-priority (&optional action)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4190 "Change the priority of an item by ARG.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4191 ACTION can be set, up, or down."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4192 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4193 (setq action (or action 'set))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4194 (let (current new news have remove)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4195 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4196 (org-back-to-heading)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4197 (if (looking-at org-priority-regexp)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4198 (setq current (string-to-char (match-string 2))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4199 have t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4200 (setq current org-default-priority))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4201 (cond
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4202 ((eq action 'set)
65583
703495630901 Message format spec fixes (2)
Deepak Goel <deego@gnufans.org>
parents: 65264
diff changeset
4203 (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
4204 (setq new (read-char-exclusive))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4205 (cond ((equal new ?\ ) (setq remove t))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4206 ((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
4207 (error "Priority must be between `%c' and `%c'"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4208 ?A org-lowest-priority))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4209 ((eq action 'up)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4210 (setq new (1- current)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4211 ((eq action 'down)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4212 (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
4213 (t (error "Invalid action")))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4214 (setq new (min (max ?A (upcase new)) org-lowest-priority))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4215 (setq news (format "%c" new))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4216 (if have
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4217 (if remove
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4218 (replace-match "" t t nil 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4219 (replace-match news t t nil 2))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4220 (if remove
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4221 (error "No priority cookie found in line")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4222 (looking-at org-todo-line-regexp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4223 (if (match-end 2)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4224 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4225 (goto-char (match-end 2))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4226 (insert " [#" news "]"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4227 (goto-char (match-beginning 3))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4228 (insert "[#" news "] ")))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4229 (if remove
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4230 (message "Priority removed")
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4231 (message "Priority of current item set to %s" news))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4232
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4233
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4234 (defun org-get-priority (s)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4235 "Find priority cookie and return priority."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4236 (save-match-data
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4237 (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
4238 (* 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
4239 (* 1000 (- org-lowest-priority
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4240 (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
4241
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4242 ;;; Timestamps
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4243
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4244 (defvar org-last-changed-timestamp nil)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4245
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4246 (defun org-time-stamp (arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4247 "Prompt for a date/time and insert a time stamp.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4248 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
4249 with a prefix argument, the time stamp will contain date and time.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4250 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
4251 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
4252 So if you press just return without typing anything, the time stamp
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4253 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
4254 at the cursor, it will be modified."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4255 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4256 (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
4257 (car org-time-stamp-formats)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4258 (org-time-was-given nil)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4259 time)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4260 (cond
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4261 ((and (org-at-timestamp-p)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4262 (eq last-command 'org-time-stamp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4263 (eq this-command 'org-time-stamp))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4264 (insert "--")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4265 (setq time (let ((this-command this-command))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4266 (org-read-date arg 'totime)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4267 (if org-time-was-given (setq fmt (cdr org-time-stamp-formats)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4268 (insert (format-time-string fmt time)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4269 ((org-at-timestamp-p)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4270 (setq time (let ((this-command this-command))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4271 (org-read-date arg 'totime)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4272 (and (org-at-timestamp-p) (replace-match
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4273 (setq org-last-changed-timestamp
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4274 (format-time-string fmt time))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4275 t t))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4276 (message "Timestamp updated"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4277 (t
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4278 (setq time (let ((this-command this-command))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4279 (org-read-date arg 'totime)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4280 (if org-time-was-given (setq fmt (cdr org-time-stamp-formats)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4281 (insert (format-time-string fmt time))))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4282
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
4283 (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
4284 "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
4285 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
4286 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
4287 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
4288 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
4289 (interactive "P")
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
4290 (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
4291 (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
4292 (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
4293 time)
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
4294 (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
4295 (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
4296 (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
4297 (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
4298
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4299 (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
4300 (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
4301 (org-detatch-overlay org-date-ovl)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4302
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4303 (defun org-read-date (&optional with-time to-time)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4304 "Read a date and make things smooth for the user.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4305 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
4306 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
4307 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
4308 hour and minute. For example,
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4309 3-2-5 --> 2003-02-05
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4310 feb 15 --> currentyear-02-15
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4311 sep 12 9 --> 2009-09-12
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4312 12:45 --> today 12:45
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4313 22 sept 0:34 --> currentyear-09-22 0:34
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4314 12 --> currentyear-currentmonth-12
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4315 Fri --> nearest Friday (today or later)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4316 etc.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4317 The function understands only English month and weekday abbreviations,
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4318 but this can be configured with the variables `parse-time-months' and
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4319 `parse-time-weekdays'.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4320
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4321 While prompting, a calendar is popped up - you can also select the
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4322 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
4323 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
4324 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
4325 \(setq org-popup-calendar-for-date-prompt nil)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4326
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4327 With optional argument TO-TIME, the date will immediately be converted
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4328 to an internal time.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4329 With an optional argument WITH-TIME, the prompt will suggest to also
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4330 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
4331 enter a time, and this function will inform the calling routine about
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4332 this change. The calling routine may then choose to change the format
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4333 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
4334 (require 'parse-time)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4335 (let* ((org-time-stamp-rounding-minutes
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4336 (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
4337 (ct (org-current-time))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4338 (default-time
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4339 ;; 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
4340 ;; the range start.
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4341 (if (save-excursion
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4342 (re-search-backward
69997
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
4343 (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
4344 (- (point) 20) t))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4345 (apply
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4346 'encode-time
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4347 (mapcar (lambda(x) (or x 0))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4348 (parse-time-string (match-string 1))))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4349 ct))
66689
a9a692f50d60 (org-read-date, org-goto-calendar)
Carsten Dominik <dominik@science.uva.nl>
parents: 66409
diff changeset
4350 (calendar-move-hook nil)
70585
af0fd91baddc (org-read-date, org-goto-calendar, org-agenda-goto-calendar): Bind
Carsten Dominik <dominik@science.uva.nl>
parents: 70162
diff changeset
4351 (view-calendar-holidays-initially nil)
66689
a9a692f50d60 (org-read-date, org-goto-calendar)
Carsten Dominik <dominik@science.uva.nl>
parents: 66409
diff changeset
4352 (view-diary-entries-initially nil)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4353 (timestr (format-time-string
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4354 (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
4355 (prompt (format "YYYY-MM-DD [%s]: " timestr))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4356 ans ans1 ans2
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4357 second minute hour day month year tl wday wday1)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4358
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4359 (if org-popup-calendar-for-date-prompt
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4360 (save-excursion
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4361 (save-window-excursion
66689
a9a692f50d60 (org-read-date, org-goto-calendar)
Carsten Dominik <dominik@science.uva.nl>
parents: 66409
diff changeset
4362 (calendar)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4363 (calendar-forward-day (- (time-to-days default-time)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4364 (calendar-absolute-from-gregorian
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4365 (calendar-current-date))))
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4366 (org-eval-in-calendar nil)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4367 (let* ((old-map (current-local-map))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4368 (map (copy-keymap calendar-mode-map))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4369 (minibuffer-local-map (copy-keymap minibuffer-local-map)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4370 (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
4371 (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
4372 'org-calendar-select-mouse)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4373 (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
4374 'org-calendar-select-mouse)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4375 (define-key minibuffer-local-map [(meta shift left)]
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4376 (lambda () (interactive)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4377 (org-eval-in-calendar '(calendar-backward-month 1))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4378 (define-key minibuffer-local-map [(meta shift right)]
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4379 (lambda () (interactive)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4380 (org-eval-in-calendar '(calendar-forward-month 1))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4381 (define-key minibuffer-local-map [(shift up)]
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4382 (lambda () (interactive)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4383 (org-eval-in-calendar '(calendar-backward-week 1))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4384 (define-key minibuffer-local-map [(shift down)]
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4385 (lambda () (interactive)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4386 (org-eval-in-calendar '(calendar-forward-week 1))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4387 (define-key minibuffer-local-map [(shift left)]
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4388 (lambda () (interactive)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4389 (org-eval-in-calendar '(calendar-backward-day 1))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4390 (define-key minibuffer-local-map [(shift right)]
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4391 (lambda () (interactive)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4392 (org-eval-in-calendar '(calendar-forward-day 1))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4393 (define-key minibuffer-local-map ">"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4394 (lambda () (interactive)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4395 (org-eval-in-calendar '(scroll-calendar-left 1))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4396 (define-key minibuffer-local-map "<"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4397 (lambda () (interactive)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4398 (org-eval-in-calendar '(scroll-calendar-right 1))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4399 (unwind-protect
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4400 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4401 (use-local-map map)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4402 (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
4403 (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
4404 (setq ans (or ans1 ans ans2)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4405 (use-local-map old-map)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4406 ;; Naked prompt only
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4407 (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
4408 (org-detatch-overlay org-date-ovl)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4409
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4410 (if (string-match
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4411 "^ *\\(\\([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
4412 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4413 (setq year (if (match-end 2)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4414 (string-to-number (match-string 2 ans))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4415 (string-to-number (format-time-string "%Y")))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4416 month (string-to-number (match-string 3 ans))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4417 day (string-to-number (match-string 4 ans)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4418 (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
4419 (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
4420 t nil ans))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4421 (setq tl (parse-time-string ans)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4422 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
4423 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
4424 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
4425 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
4426 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
4427 second (or (nth 0 tl) 0)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4428 wday (nth 6 tl))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4429 (when (and wday (not (nth 3 tl)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4430 ;; 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
4431 ;; on or after the derived date.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4432 (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
4433 (unless (equal wday wday1)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4434 (setq day (+ day (% (- wday wday1 -7) 7)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4435 (if (and (boundp 'org-time-was-given)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4436 (nth 2 tl))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4437 (setq org-time-was-given t))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4438 (if (< year 100) (setq year (+ 2000 year)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4439 (if to-time
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4440 (encode-time second minute hour day month year)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4441 (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
4442 (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
4443 (format "%04d-%02d-%02d" year month day)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4444
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4445 (defun org-eval-in-calendar (form)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4446 "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
4447 Also, store the cursor date in variable ans2."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4448 (let ((sw (selected-window)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4449 (select-window (get-buffer-window "*Calendar*"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4450 (eval form)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4451 (when (calendar-cursor-to-date)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4452 (let* ((date (calendar-cursor-to-date))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4453 (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
4454 (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
4455 (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
4456 (select-window sw)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4457
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4458 (defun org-calendar-select ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4459 "Return to `org-read-date' with the date currently selected.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4460 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
4461 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4462 (when (calendar-cursor-to-date)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4463 (let* ((date (calendar-cursor-to-date))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4464 (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
4465 (setq ans1 (format-time-string "%Y-%m-%d" time)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4466 (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
4467
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4468 (defun org-calendar-select-mouse (ev)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4469 "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
4470 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
4471 (interactive "e")
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4472 (mouse-set-point ev)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4473 (when (calendar-cursor-to-date)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4474 (let* ((date (calendar-cursor-to-date))
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4475 (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
4476 (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
4477 (if (active-minibuffer-window) (exit-minibuffer))))
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4478
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4479 (defun org-check-deadlines (ndays)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4480 "Check if there are any deadlines due or past due.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4481 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
4482 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
4483 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
4484 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
4485 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4486 (let* ((org-warn-days
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4487 (cond
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4488 ((equal ndays '(4)) 100000)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4489 (ndays (prefix-numeric-value ndays))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4490 (t org-deadline-warning-days)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4491 (case-fold-search nil)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4492 (regexp (concat "\\<" org-deadline-string " *<\\([^>]+\\)>"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4493 (callback
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4494 (lambda ()
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4495 (and (let ((d1 (time-to-days (current-time)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4496 (d2 (time-to-days
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4497 (org-time-string-to-time (match-string 1)))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4498 (< (- d2 d1) org-warn-days))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4499 (not (org-entry-is-done-p))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4500 (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
4501 (org-occur regexp callback)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4502 org-warn-days)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4503
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4504 (defun org-evaluate-time-range (&optional to-buffer)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4505 "Evaluate a time range by computing the difference between start and end.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4506 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
4507 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
4508 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
4509 next column.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4510 For time difference computation, a year is assumed to be exactly 365
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4511 days in order to avoid rounding problems."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4512 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4513 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4514 (unless (org-at-date-range-p)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4515 (goto-char (point-at-bol))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4516 (re-search-forward org-tr-regexp (point-at-eol) t))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4517 (if (not (org-at-date-range-p))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4518 (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
4519 (let* ((ts1 (match-string 1))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4520 (ts2 (match-string 2))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4521 (havetime (or (> (length ts1) 15) (> (length ts2) 15)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4522 (match-end (match-end 0))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4523 (time1 (org-time-string-to-time ts1))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4524 (time2 (org-time-string-to-time ts2))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4525 (t1 (time-to-seconds time1))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4526 (t2 (time-to-seconds time2))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4527 (diff (abs (- t2 t1)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4528 (negative (< (- t2 t1) 0))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4529 ;; (ys (floor (* 365 24 60 60)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4530 (ds (* 24 60 60))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4531 (hs (* 60 60))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4532 (fy "%dy %dd %02d:%02d")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4533 (fy1 "%dy %dd")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4534 (fd "%dd %02d:%02d")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4535 (fd1 "%dd")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4536 (fh "%02d:%02d")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4537 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
4538 (if havetime
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4539 (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
4540 y 0
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4541 d (floor (/ diff ds)) diff (mod diff ds)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4542 h (floor (/ diff hs)) diff (mod diff hs)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4543 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
4544 (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
4545 y 0
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
4546 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
4547 h 0 m 0))
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
4548 (if (not to-buffer)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4549 (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
4550 (when (org-at-table-p)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4551 (goto-char match-end)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4552 (setq align t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4553 (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
4554 (if (looking-at
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4555 "\\( *-? *[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
4556 (replace-match ""))
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
4557 (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
4558 (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
4559 (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
4560 (insert " " (format fh h m))))
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
4561 (if align (org-table-align))
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
4562 (message "Time difference inserted"))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4563
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4564 (defun org-make-tdiff-string (y d h m)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4565 (let ((fmt "")
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4566 (l nil))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4567 (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
4568 l (push y l)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4569 (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
4570 l (push d l)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4571 (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
4572 l (push h l)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4573 (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
4574 l (push m l)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4575 (apply 'format fmt (nreverse l))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4576
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4577 (defun org-time-string-to-time (s)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4578 (apply 'encode-time (org-parse-time-string s)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4579
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
4580 (defun org-parse-time-string (s &optional nodefault)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4581 "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
4582 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
4583 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
4584 hour and minute fields will be nil if not given."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4585 (if (string-match org-ts-regexp1 s)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4586 (list 0
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4587 (if (or (match-beginning 8) (not nodefault))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4588 (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
4589 (if (or (match-beginning 7) (not nodefault))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4590 (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
4591 (string-to-number (match-string 4 s))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4592 (string-to-number (match-string 3 s))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4593 (string-to-number (match-string 2 s))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4594 nil nil nil)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4595 (make-list 9 0)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4596
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4597 (defun org-timestamp-up (&optional arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4598 "Increase the date item at the cursor by one.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4599 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
4600 the day, change that.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4601 With prefix ARG, change by that many units."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4602 (interactive "p")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4603 (org-timestamp-change (prefix-numeric-value arg)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4604
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4605 (defun org-timestamp-down (&optional arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4606 "Decrease the date item at the cursor by one.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4607 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
4608 the day, change that.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4609 With prefix ARG, change by that many units."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4610 (interactive "p")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4611 (org-timestamp-change (- (prefix-numeric-value arg))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4612
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4613 (defun org-timestamp-up-day (&optional arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4614 "Increase the date in the time stamp by one day.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4615 With prefix ARG, change that many days."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4616 (interactive "p")
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
4617 (if (and (not (org-at-timestamp-p))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
4618 (org-on-heading-p))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
4619 (org-todo 'up)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
4620 (org-timestamp-change (prefix-numeric-value arg) 'day)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4621
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4622 (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
4623 "Decrease the date in the time stamp by one day.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4624 With prefix ARG, change that many days."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4625 (interactive "p")
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
4626 (if (and (not (org-at-timestamp-p))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
4627 (org-on-heading-p))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
4628 (org-todo 'down)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
4629 (org-timestamp-change (- (prefix-numeric-value arg)) 'day)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4630
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4631 (defsubst org-pos-in-match-range (pos n)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4632 (and (match-beginning n)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4633 (<= (match-beginning n) pos)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4634 (>= (match-end n) pos)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4635
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4636 (defun org-at-timestamp-p ()
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
4637 "Determine if the cursor is in or at a timestamp."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4638 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4639 (let* ((tsr org-ts-regexp2)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4640 (pos (point))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4641 (ans (or (looking-at tsr)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4642 (save-excursion
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4643 (skip-chars-backward "^<\n\r\t")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4644 (if (> (point) 1) (backward-char 1))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4645 (and (looking-at tsr)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4646 (> (- (match-end 0) pos) -1))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4647 (and (boundp 'org-ts-what)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4648 (setq org-ts-what
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4649 (cond
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4650 ((org-pos-in-match-range pos 2) 'year)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4651 ((org-pos-in-match-range pos 3) 'month)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4652 ((org-pos-in-match-range pos 7) 'hour)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4653 ((org-pos-in-match-range pos 8) 'minute)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4654 ((or (org-pos-in-match-range pos 4)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4655 (org-pos-in-match-range pos 5)) 'day)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4656 (t 'day))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4657 ans))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4658
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4659 (defun org-timestamp-change (n &optional what)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4660 "Change the date in the time stamp at point.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4661 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
4662 `year', `minute', `second'. If WHAT is not given, the cursor position
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4663 in the timestamp determines what will be changed."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4664 (let ((fmt (car org-time-stamp-formats))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4665 org-ts-what
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4666 (pos (point))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4667 ts time time0)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4668 (if (not (org-at-timestamp-p))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4669 (error "Not at a timestamp"))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4670 (setq org-ts-what (or what org-ts-what))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4671 (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
4672 (- (match-end 0) (match-beginning 0))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4673 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4674 (cdr org-time-stamp-formats)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4675 (car org-time-stamp-formats)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4676 (setq ts (match-string 0))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4677 (replace-match "")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4678 (setq time0 (org-parse-time-string ts))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4679 (setq time
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4680 (apply 'encode-time
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4681 (append
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4682 (list (or (car time0) 0))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4683 (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
4684 (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
4685 (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
4686 (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
4687 (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
4688 (nthcdr 6 time0))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4689 (if (eq what 'calendar)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4690 (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
4691 (save-excursion
f915fc860323 (org-open-at-point): Fixed bug with matching a link.
Carsten Dominik <dominik@science.uva.nl>
parents: 68245
diff changeset
4692 (save-match-data
f915fc860323 (org-open-at-point): Fixed bug with matching a link.
Carsten Dominik <dominik@science.uva.nl>
parents: 68245
diff changeset
4693 (set-buffer "*Calendar*")
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4694 (calendar-cursor-to-date)))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4695 (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
4696 (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
4697 (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
4698 (setcar time0 (or (car time0) 0))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4699 (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
4700 (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
4701 (setq time (apply 'encode-time time0))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4702 (insert (setq org-last-changed-timestamp (format-time-string fmt time)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4703 (goto-char pos)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4704 ;; Try to recenter the calendar window, if any
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4705 (if (and org-calendar-follow-timestamp-change
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4706 (get-buffer-window "*Calendar*" t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4707 (memq org-ts-what '(day month year)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4708 (org-recenter-calendar (time-to-days time)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4709
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4710 (defun org-recenter-calendar (date)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4711 "If the calendar is visible, recenter it to DATE."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4712 (let* ((win (selected-window))
66689
a9a692f50d60 (org-read-date, org-goto-calendar)
Carsten Dominik <dominik@science.uva.nl>
parents: 66409
diff changeset
4713 (cwin (get-buffer-window "*Calendar*" t))
a9a692f50d60 (org-read-date, org-goto-calendar)
Carsten Dominik <dominik@science.uva.nl>
parents: 66409
diff changeset
4714 (calendar-move-hook nil))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4715 (when cwin
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4716 (select-window cwin)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4717 (calendar-goto-date (if (listp date) date
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4718 (calendar-gregorian-from-absolute date)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4719 (select-window win))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4720
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4721 (defun org-goto-calendar (&optional arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4722 "Go to the Emacs calendar at the current date.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4723 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
4724 A prefix ARG can be used to force the current date."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4725 (interactive "P")
66689
a9a692f50d60 (org-read-date, org-goto-calendar)
Carsten Dominik <dominik@science.uva.nl>
parents: 66409
diff changeset
4726 (let ((tsr org-ts-regexp) diff
a9a692f50d60 (org-read-date, org-goto-calendar)
Carsten Dominik <dominik@science.uva.nl>
parents: 66409
diff changeset
4727 (calendar-move-hook nil)
70585
af0fd91baddc (org-read-date, org-goto-calendar, org-agenda-goto-calendar): Bind
Carsten Dominik <dominik@science.uva.nl>
parents: 70162
diff changeset
4728 (view-calendar-holidays-initially nil)
66689
a9a692f50d60 (org-read-date, org-goto-calendar)
Carsten Dominik <dominik@science.uva.nl>
parents: 66409
diff changeset
4729 (view-diary-entries-initially nil))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4730 (if (or (org-at-timestamp-p)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4731 (save-excursion
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4732 (beginning-of-line 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4733 (looking-at (concat ".*" tsr))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4734 (let ((d1 (time-to-days (current-time)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4735 (d2 (time-to-days
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4736 (org-time-string-to-time (match-string 1)))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4737 (setq diff (- d2 d1))))
66689
a9a692f50d60 (org-read-date, org-goto-calendar)
Carsten Dominik <dominik@science.uva.nl>
parents: 66409
diff changeset
4738 (calendar)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4739 (calendar-goto-today)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4740 (if (and diff (not arg)) (calendar-forward-day diff))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4741
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4742 (defun org-date-from-calendar ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4743 "Insert time stamp corresponding to cursor date in *Calendar* buffer.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4744 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
4745 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4746 (org-timestamp-change 0 'calendar))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4747
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4748 ;;; Agenda, and Diary Integration
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4749
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4750 ;;; Define the mode
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4751
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4752 (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
4753 "Keymap for `org-agenda-mode'.")
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4754
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4755 (defvar org-agenda-menu) ; defined later in this file.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4756 (defvar org-agenda-follow-mode nil)
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
4757 (defvar org-agenda-show-log nil)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4758 (defvar org-agenda-buffer-name "*Org Agenda*")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4759 (defvar org-agenda-redo-command nil)
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
4760 (defvar org-agenda-mode-hook nil)
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4761 (defvar org-agenda-type nil)
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
4762 (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
4763
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4764 ;;;###autoload
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4765 (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
4766 "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
4767
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
4768 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
4769
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
4770 \\{org-agenda-mode-map}"
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4771 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4772 (kill-all-local-variables)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4773 (setq major-mode 'org-agenda-mode)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4774 (setq mode-name "Org-Agenda")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4775 (use-local-map org-agenda-mode-map)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4776 (easy-menu-add org-agenda-menu)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4777 (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
4778 (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
4779 (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
4780 (unless org-agenda-keep-modes
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
4781 (setq org-agenda-follow-mode nil
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
4782 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
4783 (easy-menu-change
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4784 '("Agenda") "Agenda Files"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4785 (append
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
4786 (list
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
4787 (vector
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
4788 (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
4789 "Restricted to single file"
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
4790 "Edit File List")
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4791 '(org-edit-agenda-file-list)
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
4792 (not (get 'org-agenda-files 'org-restrict)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4793 "--")
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
4794 (mapcar 'org-file-menu-entry (org-agenda-files))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4795 (org-agenda-set-mode-name)
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
4796 (apply
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
4797 (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
4798 (list 'org-agenda-mode-hook)))
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
4799
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
4800 (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
4801 (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
4802 (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
4803 (define-key org-agenda-mode-map " " 'org-agenda-show)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4804 (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
4805 (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
4806 (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
4807 (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
4808 (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
4809 (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
4810 (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
4811 (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
4812 (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
4813 (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
4814 (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
4815 (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
4816
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
4817 (define-key org-agenda-mode-map ">" 'org-agenda-date-prompt)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4818 (let ((l '(1 2 3 4 5 6 7 8 9 0)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4819 (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
4820 (int-to-string (pop l)) 'digit-argument)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4821
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4822 (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
4823 (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
4824 (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
4825 (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
4826 (define-key org-agenda-mode-map "r" 'org-agenda-redo)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4827 (define-key org-agenda-mode-map "q" 'org-agenda-quit)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4828 (define-key org-agenda-mode-map "x" 'org-agenda-exit)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4829 (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
4830 (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
4831 (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
4832 (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
4833 (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
4834 (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
4835 (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
4836 (define-key org-agenda-mode-map "\C-c," 'org-agenda-priority)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4837 (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
4838 (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
4839 (eval-after-load "calendar"
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
4840 '(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
4841 '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
4842 (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
4843 (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
4844 (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
4845 (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
4846 (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
4847 (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
4848 (define-key org-agenda-mode-map "H" 'org-agenda-holidays)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4849 (define-key org-agenda-mode-map "+" 'org-agenda-priority-up)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4850 (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
4851 (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
4852 (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
4853 (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
4854 (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
4855 (define-key org-agenda-mode-map [(right)] 'org-agenda-later)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4856 (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
4857 (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
4858 (defvar org-agenda-keymap (copy-keymap org-agenda-mode-map)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4859 "Local keymap for agenda entries from Org-mode.")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4860
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
4861 (define-key org-agenda-keymap
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4862 (if (featurep 'xemacs) [(button2)] [(mouse-2)]) 'org-agenda-goto-mouse)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4863 (define-key org-agenda-keymap
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4864 (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
4865 (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
4866 (define-key org-agenda-keymap [follow-link] 'mouse-face))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4867 (easy-menu-define org-agenda-menu org-agenda-mode-map "Agenda menu"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4868 '("Agenda"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4869 ("Agenda Files")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4870 "--"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4871 ["Show" org-agenda-show t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4872 ["Go To (other window)" org-agenda-goto t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4873 ["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
4874 ["Follow Mode" org-agenda-follow-mode
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4875 :style toggle :selected org-agenda-follow-mode :active t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4876 "--"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4877 ["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
4878 ("Tags"
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
4879 ["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
4880 ["Set Tags" org-agenda-set-tags t])
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4881 ("Reschedule"
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4882 ["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
4883 ["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
4884 "--"
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4885 ["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
4886 ("Priority"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4887 ["Set Priority" org-agenda-priority t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4888 ["Increase Priority" org-agenda-priority-up t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4889 ["Decrease Priority" org-agenda-priority-down t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4890 ["Show Priority" org-agenda-show-priority t])
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4891 "--"
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4892 ;; ["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
4893 ["Rebuild buffer" org-agenda-redo t]
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4894 "--"
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4895 ["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
4896 ["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
4897 ["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
4898 "--"
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4899 ["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
4900 :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
4901 ["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
4902 :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
4903 "--"
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
4904 ["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
4905 :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
4906 ["Include Diary" org-agenda-toggle-diary
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4907 :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
4908 ["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
4909 :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
4910 "--"
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4911 ["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
4912 ("Calendar Commands"
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4913 ["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
4914 ["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
4915 ["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
4916 ["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
4917 ["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
4918 ["Create iCalendar file" org-export-icalendar-combine-agenda-files t]
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4919 "--"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4920 ["Quit" org-agenda-quit t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4921 ["Exit and Release Buffers" org-agenda-exit t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4922 ))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4923
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
4924 ;;;###autoload
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
4925 (defun org-agenda (arg)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
4926 "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
4927 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
4928 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
4929
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
4930 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
4931 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
4932 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
4933 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
4934 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
4935 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
4936 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
4937
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4938 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
4939 `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
4940 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
4941
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
4942 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
4943 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
4944 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
4945 (interactive "P")
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4946 (catch 'exit
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
4947 (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
4948 (custom org-agenda-custom-commands)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4949 c entry key type string)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4950 (put 'org-agenda-files 'org-restrict nil)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4951 (save-window-excursion
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4952 (delete-other-windows)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4953 (switch-to-buffer-other-window " *Agenda Commands*")
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4954 (erase-buffer)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4955 (insert
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4956 "Press key for an agenda command:
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4957 --------------------------------
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4958 a Agenda for current week or day
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4959 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
4960 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
4961 C Configure your own agenda commands")
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4962 (while (setq entry (pop custom))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4963 (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
4964 (insert (format "\n%-4s%-14s: %s"
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4965 key
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4966 (cond
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4967 ((eq type 'tags) "Tags query")
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4968 ((eq type 'todo) "TODO keyword")
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4969 ((eq type 'tags-tree) "Tags tree")
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4970 ((eq type 'todo-tree) "TODO kwd tree")
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4971 ((eq type 'occur-tree) "Occur tree")
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4972 (t "???"))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4973 (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
4974 (goto-char (point-min))
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4975 (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
4976 (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
4977 (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
4978 (setq c (read-char-exclusive))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4979 (message "")
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4980 (when (equal c ?1)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4981 (if restrict-ok
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
4982 (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
4983 (error "Cannot restrict agenda to current buffer"))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4984 (message "Press key for agenda command%s"
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4985 (if restrict-ok " (restricted to current file)" ""))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4986 (setq c (read-char-exclusive))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4987 (message "")))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4988 (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
4989 ;; 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
4990 (cond
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4991 ((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
4992 ((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
4993 ((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
4994 ((equal c ?T)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4995 (setq current-prefix-arg (or arg '(4)))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4996 (call-interactively 'org-todo-list))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4997 ((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
4998 ((equal c ?M)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4999 (setq current-prefix-arg (or arg '(4)))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
5000 (call-interactively 'org-tags-view))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
5001 ((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
5002 (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
5003 (cond
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
5004 ((eq type 'tags)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
5005 (org-tags-view current-prefix-arg string))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
5006 ((eq type 'todo)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
5007 (org-todo-list string))
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5008 ((eq type 'tags-tree)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5009 (org-check-for-org-mode)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5010 (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
5011 ((eq type 'todo-tree)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5012 (org-check-for-org-mode)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5013 (org-occur (concat "^" outline-regexp "[ \t]*"
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5014 (regexp-quote string) "\\>")))
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5015 ((eq type 'occur-tree)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5016 (org-check-for-org-mode)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5017 (org-occur string))
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
5018 (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
5019 (t (error "Invalid key"))))))
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
5020
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5021 (defun org-check-for-org-mode ()
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5022 "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
5023 (or (eq major-mode 'org-mode)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5024 (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
5025 major-mode)))
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5026
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
5027 (defun org-fit-agenda-window ()
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
5028 "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
5029 (and org-fit-agenda-window
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
5030 (fboundp 'fit-window-to-buffer)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
5031 (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
5032 (/ (frame-height) 2))))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
5033
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5034 (defun org-agenda-files (&optional unrestricted)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5035 "Get the list of agenda files.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5036 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
5037 is currently in place."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5038 (cond
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5039 ((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
5040 ((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
5041 ((listp org-agenda-files) org-agenda-files)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5042 (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
5043
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5044 (defvar org-window-configuration)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5045
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5046 (defun org-edit-agenda-file-list ()
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5047 "Edit the list of agenda files.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5048 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
5049 `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
5050 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
5051 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
5052 (interactive)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5053 (if (stringp org-agenda-files)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5054 (let ((cw (current-window-configuration)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5055 (find-file org-agenda-files)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5056 (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
5057 (org-add-hook 'after-save-hook
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5058 (lambda ()
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5059 (set-window-configuration
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5060 (prog1 org-window-configuration
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5061 (kill-buffer (current-buffer))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5062 (org-install-agenda-files-menu)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5063 (message "New agenda file list installed"))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5064 nil 'local)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5065 (message (substitute-command-keys
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5066 "Edit list and finish with \\[save-buffer]")))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5067 (customize-variable 'org-agenda-files)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5068
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5069 (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
5070 "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
5071 (if (stringp org-agenda-files)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5072 (let ((f org-agenda-files) b)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5073 (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
5074 (with-temp-file f
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5075 (insert (mapconcat 'identity list "\n") "\n")))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5076 (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
5077 (setq org-agenda-files list)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5078 (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
5079
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5080 (defun org-read-agenda-file-list ()
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5081 "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
5082 (when (stringp org-agenda-files)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5083 (with-temp-buffer
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5084 (insert-file-contents org-agenda-files)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5085 (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
5086
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5087 (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
5088 "List of all currently active markers created by `org-agenda'.")
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5089 (defvar org-agenda-last-marker-time (time-to-seconds (current-time))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5090 "Creation time of the last agenda marker.")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5091
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
5092 (defun org-agenda-new-marker (&optional pos)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5093 "Return a new agenda marker.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5094 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
5095 no longer in use."
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
5096 (let ((m (copy-marker (or pos (point)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5097 (setq org-agenda-last-marker-time (time-to-seconds (current-time)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5098 (push m org-agenda-markers)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5099 m))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5100
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5101 (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
5102 "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
5103 (if (or force
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5104 (> (- (time-to-seconds (current-time))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5105 org-agenda-last-marker-time)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5106 5))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5107 (while org-agenda-markers
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5108 (move-marker (pop org-agenda-markers) nil))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5109
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5110 (defvar org-agenda-new-buffers nil
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5111 "Buffers created to visit agenda files.")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5112
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5113 (defun org-get-agenda-file-buffer (file)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5114 "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
5115 it to the list of buffers which might be released later."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5116 (let ((buf (find-buffer-visiting file)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5117 (if buf
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5118 buf ; just return it
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5119 ;; Make a new buffer and remember it
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5120 (setq buf (find-file-noselect file))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5121 (if buf (push buf org-agenda-new-buffers))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5122 buf)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5123
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5124 (defun org-release-buffers (blist)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5125 "Release all buffers in list, asking the user for confirmation when needed.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5126 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
5127 \(if the user agrees) and then killed."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5128 (let (buf file)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5129 (while (setq buf (pop blist))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5130 (setq file (buffer-file-name buf))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5131 (when (and (buffer-modified-p buf)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5132 file
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5133 (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
5134 (with-current-buffer buf (save-buffer)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5135 (kill-buffer buf))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5136
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
5137 (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
5138
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5139 (defun org-timeline (&optional include-all keep-modes)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5140 "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
5141 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
5142 \\[universal-argument] prefix, all unfinished TODO items will also be shown,
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5143 under the current date.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5144 If the buffer contains an active region, only check the region for
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5145 dates."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5146 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5147 (require 'calendar)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5148 (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
5149 (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
5150 (let* ((dopast t)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
5151 (dotodo include-all)
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5152 (doclosed org-agenda-show-log)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5153 (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
5154 (entry buffer-file-name)
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
5155 (org-agenda-files (list buffer-file-name))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5156 (date (calendar-current-date))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5157 (win (selected-window))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5158 (pos1 (point))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5159 (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
5160 (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
5161 (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
5162 t doclosed)) ; always include today
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5163 (today (time-to-days (current-time)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5164 (org-respect-restriction t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5165 (past t)
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5166 args
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5167 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
5168 (setq org-agenda-redo-command
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5169 (list 'progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5170 (list 'switch-to-buffer-other-window (current-buffer))
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5171 (list 'org-timeline (list 'quote include-all) t)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5172 (if (not dopast)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5173 ;; Remove past dates from the list of dates.
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5174 (setq day-numbers (delq nil (mapcar (lambda(x)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5175 (if (>= x today) x nil))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5176 day-numbers))))
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
5177 (switch-to-buffer-other-window
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5178 (get-buffer-create org-agenda-buffer-name))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5179 (setq buffer-read-only nil)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5180 (erase-buffer)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5181 (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
5182 (set (make-local-variable 'org-agenda-type) 'timeline)
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5183 (if doclosed (push :closed args))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5184 (push :timestamp args)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5185 (if dotodo (push :todo args))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5186 (while (setq d (pop day-numbers))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5187 (if (and (>= d today)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5188 dopast
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5189 past)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5190 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5191 (setq past nil)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5192 (insert (make-string 79 ?-) "\n")))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5193 (setq date (calendar-gregorian-from-absolute d))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5194 (setq s (point))
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5195 (setq rtn (apply 'org-agenda-get-day-entries
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5196 entry date args))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5197 (if (or rtn (equal d today))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5198 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5199 (insert (calendar-day-name date) " "
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5200 (number-to-string (extract-calendar-day date)) " "
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5201 (calendar-month-name (extract-calendar-month date)) " "
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5202 (number-to-string (extract-calendar-year date)) "\n")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5203 (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
5204 'org-level-3)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5205 (if (equal d today)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5206 (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
5207 (insert (org-finalize-agenda-entries rtn) "\n")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5208 (put-text-property s (1- (point)) 'day d))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5209 (goto-char (point-min))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5210 (setq buffer-read-only t)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5211 (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
5212 (point-min)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5213 (when (not org-select-timeline-window)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5214 (select-window win)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5215 (goto-char pos1))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5216
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5217 ;;;###autoload
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
5218 (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
5219 "Produce a weekly view from all files in variable `org-agenda-files'.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5220 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
5221 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
5222 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
5223 also be shown, under the current date.
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5224 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
5225 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
5226 to turn on logging.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5227 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
5228 given in `org-agenda-start-on-weekday'.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5229 NDAYS defaults to `org-agenda-ndays'."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5230 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5231 (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
5232 (org-compile-prefix-format org-agenda-prefix-format)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5233 (require 'calendar)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5234 (let* ((org-agenda-start-on-weekday
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5235 (if (or (equal ndays 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5236 (and (null ndays) (equal 1 org-agenda-ndays)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5237 nil org-agenda-start-on-weekday))
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5238 (org-agenda-keep-modes keep-modes)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5239 (thefiles (org-agenda-files))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5240 (files thefiles)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5241 (win (selected-window))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5242 (today (time-to-days (current-time)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5243 (sd (or start-day today))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5244 (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
5245 (< org-agenda-ndays 7))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5246 sd
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5247 (let* ((nt (calendar-day-of-week
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5248 (calendar-gregorian-from-absolute sd)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5249 (n1 org-agenda-start-on-weekday)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5250 (d (- nt n1)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5251 (- sd (+ (if (< d 0) 7 0) d)))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5252 (day-numbers (list start))
70019
a186cf26482b *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 70018
diff changeset
5253 (inhibit-redisplay t)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5254 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
5255 (setq org-agenda-redo-command
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
5256 (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
5257 ;; Make the list of days
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
5258 (setq ndays (or ndays org-agenda-ndays)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5259 nd ndays)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5260 (while (> ndays 1)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5261 (push (1+ (car day-numbers)) day-numbers)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5262 (setq ndays (1- ndays)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5263 (setq day-numbers (nreverse day-numbers))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5264 (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
5265 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5266 (delete-other-windows)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5267 (switch-to-buffer-other-window
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5268 (get-buffer-create org-agenda-buffer-name))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5269 (setq buffer-read-only nil)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5270 (erase-buffer)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5271 (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
5272 (set (make-local-variable 'org-agenda-type) 'agenda)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5273 (set (make-local-variable 'starting-day) (car day-numbers))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5274 (set (make-local-variable 'include-all-loc) include-all)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5275 (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
5276 (member today day-numbers))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5277 (setq files thefiles
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5278 rtnall nil)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5279 (while (setq file (pop files))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5280 (catch 'nextfile
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5281 (org-check-agenda-file file)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5282 (setq date (calendar-gregorian-from-absolute today)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5283 rtn (org-agenda-get-day-entries
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5284 file date :todo))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5285 (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
5286 (when rtnall
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5287 (insert "ALL CURRENTLY OPEN TODO ITEMS:\n")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5288 (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
5289 (list 'face 'org-level-3))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5290 (insert (org-finalize-agenda-entries rtnall) "\n")))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5291 (while (setq d (pop day-numbers))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5292 (setq date (calendar-gregorian-from-absolute d)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5293 s (point))
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
5294 (if (or (setq todayp (= d today))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5295 (and (not start-pos) (= d sd)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5296 (setq start-pos (point))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5297 (if (and start-pos (not end-pos))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5298 (setq end-pos (point))))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5299 (setq files thefiles
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5300 rtnall nil)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5301 (while (setq file (pop files))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5302 (catch 'nextfile
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5303 (org-check-agenda-file file)
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5304 (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
5305 (setq rtn (org-agenda-get-day-entries
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5306 file date
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5307 :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
5308 (setq rtn (org-agenda-get-day-entries
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5309 file date
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5310 :deadline :scheduled :timestamp)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5311 (setq rtnall (append rtnall rtn))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5312 (if org-agenda-include-diary
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5313 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5314 (require 'diary-lib)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5315 (setq rtn (org-get-entries-from-diary date))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5316 (setq rtnall (append rtnall rtn))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5317 (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
5318 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5319 (insert (format "%-9s %2d %s %4d\n"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5320 (calendar-day-name date)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5321 (extract-calendar-day date)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5322 (calendar-month-name (extract-calendar-month date))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5323 (extract-calendar-year date)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5324 (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
5325 'org-level-3)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5326 (if rtnall (insert
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5327 (org-finalize-agenda-entries
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5328 (org-agenda-add-time-grid-maybe
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5329 rtnall nd todayp))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5330 "\n"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5331 (put-text-property s (1- (point)) 'day d))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5332 (goto-char (point-min))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5333 (setq buffer-read-only t)
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
5334 (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
5335 (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
5336 (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
5337 (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
5338 (recenter -1)
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
5339 (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
5340 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5341 (goto-char (or start-pos 1))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5342 (recenter 1))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5343 (goto-char (or start-pos 1))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5344 (if (not org-select-agenda-window) (select-window win))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5345 (message "")))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5346
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5347 (defvar org-select-this-todo-keyword nil)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5348
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5349 ;;;###autoload
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5350 (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
5351 "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
5352 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
5353 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
5354 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
5355 `org-todo-keywords'."
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5356 (interactive "P")
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5357 (org-agenda-maybe-reset-markers 'force)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5358 (org-compile-prefix-format org-agenda-prefix-format)
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5359 (let* ((org-agenda-keep-modes keep-modes)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5360 (today (time-to-days (current-time)))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5361 (date (calendar-gregorian-from-absolute today))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5362 (win (selected-window))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5363 (kwds org-todo-keywords)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5364 (completion-ignore-case t)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5365 (org-select-this-todo-keyword
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
5366 (if (stringp arg) arg
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
5367 (and arg (integerp arg) (> arg 0)
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
5368 (nth (1- arg) org-todo-keywords))))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5369 rtn rtnall files file pos)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5370 (when (equal arg '(4))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5371 (setq org-select-this-todo-keyword
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5372 (completing-read "Keyword: " (mapcar 'list org-todo-keywords)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5373 nil t)))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5374 (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
5375 (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
5376 (progn
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5377 (delete-other-windows)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5378 (switch-to-buffer-other-window
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5379 (get-buffer-create org-agenda-buffer-name))))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5380 (setq buffer-read-only nil)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5381 (erase-buffer)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5382 (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
5383 (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
5384 (set (make-local-variable 'last-arg) arg)
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5385 (set (make-local-variable 'org-todo-keywords) kwds)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5386 (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
5387 '(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
5388 (setq files (org-agenda-files)
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5389 rtnall nil)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5390 (while (setq file (pop files))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5391 (catch 'nextfile
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5392 (org-check-agenda-file file)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5393 (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
5394 (setq rtnall (append rtnall rtn))))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5395 (insert "Global list of TODO items of type: ")
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5396 (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
5397 (list 'face 'org-level-3))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5398 (setq pos (point))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5399 (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
5400 (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
5401 (setq pos (point))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5402 (insert
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5403 "Available with `N r': (0)ALL "
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5404 (let ((n 0))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5405 (mapconcat (lambda (x)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5406 (format "(%d)%s" (setq n (1+ n)) x))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5407 org-todo-keywords " "))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5408 "\n")
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5409 (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
5410 (when rtnall
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5411 (insert (org-finalize-agenda-entries rtnall) "\n"))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5412 (goto-char (point-min))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5413 (setq buffer-read-only t)
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
5414 (org-fit-agenda-window)
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5415 (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
5416
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5417 (defun org-check-agenda-file (file)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5418 "Make sure FILE exists. If not, ask user what to do."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5419 (when (not (file-exists-p file))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5420 (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
5421 (abbreviate-file-name file))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5422 (let ((r (downcase (read-char-exclusive))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5423 (cond
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5424 ((equal r ?r)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5425 (org-remove-file file)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5426 (throw 'nextfile t))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5427 (t (error "Abort"))))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5428
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5429 (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
5430 "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
5431 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
5432 (if (memq org-agenda-type types)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5433 t
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5434 (if error
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5435 (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
5436 nil)))
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5437
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
5438 (defun org-agenda-quit ()
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5439 "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
5440 (interactive)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5441 (let ((buf (current-buffer)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5442 (if (not (one-window-p)) (delete-window))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5443 (kill-buffer buf)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5444 (org-agenda-maybe-reset-markers 'force)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5445
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
5446 (defun org-agenda-exit ()
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5447 "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
5448 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
5449 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
5450 (interactive)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5451 (org-release-buffers org-agenda-new-buffers)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5452 (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
5453 (org-agenda-quit))
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
5454
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
5455 (defun org-agenda-redo ()
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5456 "Rebuild Agenda.
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5457 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
5458 (interactive)
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5459 (message "Rebuilding agenda buffer...")
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5460 (eval org-agenda-redo-command)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5461 (message "Rebuilding agenda buffer...done"))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5462
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
5463 (defun org-agenda-goto-today ()
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5464 "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
5465 (interactive)
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5466 (org-agenda-check-type t 'timeline 'agenda)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5467 (if (boundp 'starting-day)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5468 (let ((cmd (car org-agenda-redo-command))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5469 (iall (nth 1 org-agenda-redo-command))
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5470 (nday (nth 3 org-agenda-redo-command))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5471 (keep (nth 4 org-agenda-redo-command)))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5472 (eval (list cmd iall nil nday keep)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5473 (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
5474 (point-min)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5475
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5476 (defun org-agenda-later (arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5477 "Go forward in time by `org-agenda-ndays' days.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5478 With prefix ARG, go forward that many times `org-agenda-ndays'."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5479 (interactive "p")
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5480 (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
5481 (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
5482 (+ starting-day (* arg org-agenda-ndays)) nil t))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5483
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5484 (defun org-agenda-earlier (arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5485 "Go back in time by `org-agenda-ndays' days.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5486 With prefix ARG, go back that many times `org-agenda-ndays'."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5487 (interactive "p")
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5488 (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
5489 (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
5490 (- starting-day (* arg org-agenda-ndays)) nil t))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5491
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
5492 (defun org-agenda-week-view ()
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
5493 "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
5494 (interactive)
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5495 (org-agenda-check-type t 'agenda)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
5496 (setq org-agenda-ndays 7)
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
5497 (org-agenda-list include-all-loc
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
5498 (or (get-text-property (point) 'day)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
5499 starting-day)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
5500 nil t)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5501 (org-agenda-set-mode-name)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
5502 (message "Switched to week view"))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
5503
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
5504 (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
5505 "Switch to daily view for agenda."
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
5506 (interactive)
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5507 (org-agenda-check-type t 'agenda)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
5508 (setq org-agenda-ndays 1)
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
5509 (org-agenda-list include-all-loc
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
5510 (or (get-text-property (point) 'day)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
5511 starting-day)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
5512 nil t)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
5513 (org-agenda-set-mode-name)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
5514 (message "Switched to day view"))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5515
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
5516 (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
5517 "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
5518 (interactive "p")
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5519 (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
5520 (beginning-of-line 1)
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
5521 (if (looking-at "^\\S-") (forward-char 1))
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
5522 (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
5523 (progn
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5524 (backward-char 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5525 (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
5526 (goto-char (match-beginning 0)))
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
5527
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
5528 (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
5529 "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
5530 (interactive "p")
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5531 (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
5532 (beginning-of-line 1)
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
5533 (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
5534 (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
5535
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
5536 ;; Initialize the highlight
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5537 (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
5538 (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
5539
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
5540 (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
5541 "Highlight a region with overlay."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5542 (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
5543 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
5544
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
5545 (defun org-unhighlight ()
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
5546 "Detach overlay INDEX."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5547 (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
5548
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
5549
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5550 (defun org-agenda-follow-mode ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5551 "Toggle follow mode in an agenda buffer."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5552 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5553 (setq org-agenda-follow-mode (not org-agenda-follow-mode))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5554 (org-agenda-set-mode-name)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5555 (message "Follow mode is %s"
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5556 (if org-agenda-follow-mode "on" "off")))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5557
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5558 (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
5559 "Toggle log mode in an agenda buffer."
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5560 (interactive)
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5561 (org-agenda-check-type t 'agenda 'timeline)
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5562 (setq org-agenda-show-log (not org-agenda-show-log))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5563 (org-agenda-set-mode-name)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5564 (org-agenda-redo)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5565 (message "Log mode is %s"
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5566 (if org-agenda-show-log "on" "off")))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5567
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5568 (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
5569 "Toggle diary inclusion in an agenda buffer."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5570 (interactive)
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5571 (org-agenda-check-type t 'agenda)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5572 (setq org-agenda-include-diary (not org-agenda-include-diary))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5573 (org-agenda-redo)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5574 (org-agenda-set-mode-name)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5575 (message "Diary inclusion turned %s"
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5576 (if org-agenda-include-diary "on" "off")))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5577
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
5578 (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
5579 "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
5580 (interactive)
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5581 (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
5582 (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
5583 (org-agenda-redo)
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
5584 (org-agenda-set-mode-name)
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
5585 (message "Time-grid turned %s"
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5586 (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
5587
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5588 (defun org-agenda-set-mode-name ()
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
5589 "Set the mode name to indicate all the small mode settings."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5590 (setq mode-name
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5591 (concat "Org-Agenda"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5592 (if (equal org-agenda-ndays 1) " Day" "")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5593 (if (equal org-agenda-ndays 7) " Week" "")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5594 (if org-agenda-follow-mode " Follow" "")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5595 (if org-agenda-include-diary " Diary" "")
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5596 (if org-agenda-use-time-grid " Grid" "")
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5597 (if org-agenda-show-log " Log" "")))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5598 (force-mode-line-update))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5599
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5600 (defun org-agenda-post-command-hook ()
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
5601 (and (eolp) (not (bolp)) (backward-char 1))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5602 (if (and org-agenda-follow-mode
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5603 (get-text-property (point) 'org-marker))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5604 (org-agenda-show)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5605
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
5606 (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
5607
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5608 (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
5609 "Get the (Emacs Calendar) diary entries for DATE."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5610 (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
5611 (diary-display-hook '(fancy-diary-display))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5612 (list-diary-entries-hook
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5613 (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
5614 (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
5615 (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
5616 entries
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
5617 (org-disable-agenda-to-diary t))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5618 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5619 (save-window-excursion
69997
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
5620 (list-diary-entries date 1))) ;; Keep this name for now, compatibility
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5621 (if (not (get-buffer fancy-diary-buffer))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5622 (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
5623 (with-current-buffer fancy-diary-buffer
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5624 (setq buffer-read-only nil)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5625 (if (= (point-max) 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5626 ;; No entries
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5627 (setq entries nil)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5628 ;; Omit the date and other unnecessary stuff
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5629 (org-agenda-cleanup-fancy-diary)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5630 ;; 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
5631 (if (= (point-max) 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5632 (setq entries nil)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5633 (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
5634 (set-buffer-modified-p nil)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5635 (kill-buffer fancy-diary-buffer)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5636 (when entries
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5637 (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
5638 (setq entries
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5639 (mapcar
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5640 (lambda (x)
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
5641 (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
5642 ;; 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
5643 (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
5644 entries)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5645
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
5646 (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
5647 "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
5648 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
5649 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
5650 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
5651 (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
5652 (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
5653 (progn
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5654 (replace-match "")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5655 (re-search-forward "\n=+$" nil t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5656 (replace-match "")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5657 (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
5658 (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
5659 (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
5660 (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
5661 (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
5662 (replace-match ""))
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
5663 (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
5664 (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
5665 (replace-match "")))
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
5666
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
5667 ;; 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
5668 (eval-after-load "diary-lib"
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
5669 '(if (boundp 'diary-modify-entry-list-string-function)
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
5670 ;; 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
5671 nil
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
5672 ;; 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
5673 (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
5674 "Make the position visible."
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
5675 (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
5676 (stringp string)
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
5677 buffer-file-name)
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
5678 (setq string (org-modify-diary-entry-string string))))))
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
5679
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
5680 (defun org-modify-diary-entry-string (string)
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
5681 "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
5682 (org-add-props string nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5683 'mouse-face 'highlight
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5684 'keymap org-agenda-keymap
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5685 '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
5686 (abbreviate-file-name buffer-file-name))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5687 'org-agenda-diary-link t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5688 '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
5689
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
5690 (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
5691 "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
5692 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
5693 ;; 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
5694 (when org-disable-agenda-to-diary
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
5695 (condition-case nil
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
5696 (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
5697 (error
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
5698 (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
5699
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
5700 (defun org-cycle-agenda-files ()
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
5701 "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
5702 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
5703 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
5704 (interactive)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5705 (let* ((fs (org-agenda-files t))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5706 (files (append fs (list (car fs))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5707 (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
5708 file)
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
5709 (unless files (error "No agenda files"))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
5710 (catch 'exit
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
5711 (while (setq file (pop files))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
5712 (if (equal (file-truename file) tcf)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
5713 (when (car files)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
5714 (find-file (car files))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
5715 (throw 'exit t))))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5716 (find-file (car fs)))))
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
5717
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
5718 (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
5719 "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
5720 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
5721 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
5722 (interactive)
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
5723 (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
5724
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
5725 (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
5726 "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
5727 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
5728 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
5729 end of the list."
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
5730 (interactive "P")
68294
f915fc860323 (org-open-at-point): Fixed bug with matching a link.
Carsten Dominik <dominik@science.uva.nl>
parents: 68245
diff changeset
5731 (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
5732 (cons (file-truename x) x))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5733 (org-agenda-files t)))
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
5734 (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
5735 x had)
f915fc860323 (org-open-at-point): Fixed bug with matching a link.
Carsten Dominik <dominik@science.uva.nl>
parents: 68245
diff changeset
5736 (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
5737
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
5738 (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
5739 (if to-end
f915fc860323 (org-open-at-point): Fixed bug with matching a link.
Carsten Dominik <dominik@science.uva.nl>
parents: 68245
diff changeset
5740 (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
5741 (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
5742 (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
5743 (org-install-agenda-files-menu)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
5744 (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
5745 (if had "moved" "added") (if to-end "end" "front"))))
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 (defun org-remove-file (&optional file)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5748 "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
5749 These are the files which are being checked for agenda entries.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5750 Optional argument FILE means, use this file instead of the current."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5751 (interactive)
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
5752 (let* ((file (or file buffer-file-name))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5753 (true-file (file-truename file))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5754 (afile (abbreviate-file-name file))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5755 (files (delq nil (mapcar
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5756 (lambda (x)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5757 (if (equal true-file
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5758 (file-truename x))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5759 nil x))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5760 (org-agenda-files t)))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5761 (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
5762 (progn
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5763 (org-store-new-agenda-file-list files)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5764 (org-install-agenda-files-menu)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5765 (message "Removed file: %s" afile))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5766 (message "File was not in list: %s" afile))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5767
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5768 (defun org-file-menu-entry (file)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5769 (vector file (list 'find-file file) t))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5770
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5771 (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
5772 "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
5773 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
5774 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
5775 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
5776 inactive time stamps (those in square brackets) are included."
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5777 (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
5778 dates date day day1 day2 ts1 ts2)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5779 (if force-today
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5780 (setq dates (list (time-to-days (current-time)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5781 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5782 (goto-char beg)
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5783 (while (re-search-forward re end t)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5784 (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
5785 (substring (match-string 1) 0 10))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5786 (or (memq day dates) (push day dates)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5787 (unless no-ranges
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5788 (goto-char beg)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5789 (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
5790 (setq ts1 (substring (match-string 1) 0 10)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5791 ts2 (substring (match-string 2) 0 10)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5792 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
5793 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
5794 (while (< (setq day1 (1+ day1)) day2)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5795 (or (memq day1 dates) (push day1 dates)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5796 (sort dates '<))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5797
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5798 ;;;###autoload
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5799 (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
5800 "Return diary information from org-files.
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
5801 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
5802 It accesses org files and extracts information from those files to be
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5803 listed in the diary. The function accepts arguments specifying what
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5804 items should be listed. The following arguments are allowed:
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5805
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5806 :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
5807 date range matching the selected date. Deadlines will
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5808 also be listed, on the expiration day.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5809
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5810 :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
5811 `org-deadline-warning-days'. The listing occurs only
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5812 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
5813 an entry is marked DONE, it is no longer listed.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5814
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5815 :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
5816 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
5817 scheduled earlier and are not yet marked DONE.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5818
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5819 :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
5820 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
5821 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
5822 diary for *today*, not at any other date.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5823
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5824 The call in the diary file should look like this:
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5825
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5826 &%%(org-diary) ~/path/to/some/orgfile.org
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5827
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5828 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
5829 all files listed in `org-agenda-files' will be checked automatically:
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5830
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5831 &%%(org-diary)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5832
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5833 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
5834 arguments (:deadline :scheduled :timestamp) are used. So the example above may
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5835 also be written as
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5836
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5837 &%%(org-diary :deadline :timestamp :scheduled)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5838
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5839 The function expects the lisp variables `entry' and `date' to be provided
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5840 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
5841 function from a program - use `org-agenda-get-day-entries' instead."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5842 (org-agenda-maybe-reset-markers)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
5843 (org-compile-prefix-format org-agenda-prefix-format)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5844 (setq args (or args '(:deadline :scheduled :timestamp)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5845 (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
5846 (list entry)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5847 (org-agenda-files t)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5848 file rtn results)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5849 ;; 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
5850 ;; 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
5851 (if org-disable-agenda-to-diary (setq files nil))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5852 (while (setq file (pop files))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5853 (setq rtn (apply 'org-agenda-get-day-entries file date args))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5854 (setq results (append results rtn)))
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
5855 (if results
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
5856 (concat (org-finalize-agenda-entries results) "\n"))))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5857 (defvar org-category-table nil)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5858 (defun org-get-category-table ()
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5859 "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
5860 (let (tbl)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5861 (save-excursion
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5862 (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
5863 (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
5864 (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
5865 tbl))
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5866 (defun org-get-category (&optional pos)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5867 "Get the category applying to position POS."
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5868 (if (not org-category-table)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5869 (cond
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5870 ((null org-category)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5871 (setq org-category
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
5872 (if buffer-file-name
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5873 (file-name-sans-extension
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
5874 (file-name-nondirectory buffer-file-name))
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5875 "???")))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5876 ((symbolp org-category) (symbol-name org-category))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5877 (t org-category))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5878 (let ((tbl org-category-table)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5879 (pos (or pos (point))))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5880 (while (and tbl (> (caar tbl) pos))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5881 (pop tbl))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5882 (or (cdar tbl) (cdr (nth (1- (length org-category-table))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5883 org-category-table))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5884
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5885 (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
5886 "Does the work for `org-diary' and `org-agenda'.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5887 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
5888 the one returned by `calendar-current-date'. ARGS are symbols indicating
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5889 which kind of entries should be extracted. For details about these, see
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5890 the documentation of `org-diary'."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5891 (setq args (or args '(:deadline :scheduled :timestamp)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5892 (let* ((org-startup-with-deadline-check nil)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5893 (org-startup-folded nil)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5894 (org-startup-align-all-tables nil)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5895 (buffer (if (file-exists-p file)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5896 (org-get-agenda-file-buffer file)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5897 (error "No such file %s" file)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5898 arg results rtn)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5899 (if (not buffer)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5900 ;; 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
5901 (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
5902 (with-current-buffer buffer
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5903 (unless (eq major-mode 'org-mode)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5904 (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
5905 (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
5906 (let ((case-fold-search nil))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5907 (save-excursion
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5908 (save-restriction
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5909 (if org-respect-restriction
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5910 (if (org-region-active-p)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5911 ;; Respect a region to restrict search
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5912 (narrow-to-region (region-beginning) (region-end)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5913 ;; 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
5914 ;; get rid of any restriction
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5915 (widen))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5916 ;; 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
5917 (while (setq arg (pop args))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5918 (cond
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5919 ((and (eq arg :todo)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5920 (equal date (calendar-current-date)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5921 (setq rtn (org-agenda-get-todos))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5922 (setq results (append results rtn)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5923 ((eq arg :timestamp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5924 (setq rtn (org-agenda-get-blocks))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5925 (setq results (append results rtn))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5926 (setq rtn (org-agenda-get-timestamps))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5927 (setq results (append results rtn)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5928 ((eq arg :scheduled)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5929 (setq rtn (org-agenda-get-scheduled))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5930 (setq results (append results rtn)))
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5931 ((eq arg :closed)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5932 (setq rtn (org-agenda-get-closed))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5933 (setq results (append results rtn)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5934 ((and (eq arg :deadline)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5935 (equal date (calendar-current-date)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5936 (setq rtn (org-agenda-get-deadlines))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5937 (setq results (append results rtn))))))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5938 results))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5939
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5940 (defun org-entry-is-done-p ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5941 "Is the current entry marked DONE?"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5942 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5943 (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
5944 (looking-at org-nl-done-regexp))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5945
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5946 (defun org-at-date-range-p ()
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
5947 "Is the cursor inside a date range?"
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5948 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5949 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5950 (catch 'exit
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5951 (let ((pos (point)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5952 (skip-chars-backward "^<\r\n")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5953 (skip-chars-backward "<")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5954 (and (looking-at org-tr-regexp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5955 (>= (match-end 0) pos)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5956 (throw 'exit t))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5957 (skip-chars-backward "^<\r\n")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5958 (skip-chars-backward "<")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5959 (and (looking-at org-tr-regexp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5960 (>= (match-end 0) pos)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5961 (throw 'exit t)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5962 nil)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5963
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5964 (defun org-agenda-get-todos ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5965 "Return the TODO information for agenda display."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5966 (let* ((props (list 'face nil
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5967 'done-face 'org-done
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
5968 'org-not-done-regexp org-not-done-regexp
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5969 'mouse-face 'highlight
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5970 'keymap org-agenda-keymap
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5971 'help-echo
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5972 (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
5973 (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
5974 (regexp (concat "[\n\r]\\*+ *\\("
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5975 (if org-select-this-todo-keyword
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5976 (concat "\\<\\(" org-select-this-todo-keyword
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5977 "\\)\\>")
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5978 org-not-done-regexp)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5979 "[^\n\r]*\\)"))
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
5980 marker priority category tags
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5981 ee txt)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5982 (goto-char (point-min))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5983 (while (re-search-forward regexp nil t)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5984 (goto-char (match-beginning 1))
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5985 (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
5986 category (org-get-category)
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
5987 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
5988 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
5989 priority
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5990 (+ (org-get-priority txt)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5991 (if org-todo-kwd-priority-p
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5992 (- org-todo-kwd-max-priority -2
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5993 (length
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5994 (member (match-string 2) org-todo-keywords)))
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5995 1)))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5996 (org-add-props txt props
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5997 'org-marker marker 'org-hd-marker marker
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5998 'priority priority 'category category)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5999 (push txt ee)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6000 (goto-char (match-end 1)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6001 (nreverse ee)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6002
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6003 (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
6004 "No heading for this item in buffer or region.")
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6005
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6006 (defun org-agenda-get-timestamps ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6007 "Return the date stamp information for agenda display."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6008 (let* ((props (list 'face nil
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
6009 'org-not-done-regexp org-not-done-regexp
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6010 'mouse-face 'highlight
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6011 'keymap org-agenda-keymap
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6012 'help-echo
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6013 (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
6014 (abbreviate-file-name buffer-file-name))))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6015 (regexp (regexp-quote
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6016 (substring
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6017 (format-time-string
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6018 (car org-time-stamp-formats)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6019 (apply 'encode-time ; DATE bound by calendar
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6020 (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
6021 0 11)))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
6022 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
6023 ee txt timestr tags)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6024 (goto-char (point-min))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6025 (while (re-search-forward regexp nil t)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6026 (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
6027 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6028 (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
6029 category (org-get-category (match-beginning 0))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6030 tmp (buffer-substring (max (point-min)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6031 (- (match-beginning 0)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6032 org-ds-keyword-length))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6033 (match-beginning 0))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6034 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
6035 deadlinep (string-match org-deadline-regexp tmp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6036 scheduledp (string-match org-scheduled-regexp tmp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6037 donep (org-entry-is-done-p))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6038 (if (string-match ">" timestr)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6039 ;; 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
6040 (setq timestr (substring timestr 0 (match-end 0))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6041 (save-excursion
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6042 (if (re-search-backward "\\(^\\|\r\\)\\*+" nil t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6043 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6044 (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
6045 (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
6046 tags (org-get-tags-at))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6047 (looking-at "\\*+[ \t]*\\([^\r\n]+\\)")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6048 (setq txt (org-format-agenda-item
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6049 (format "%s%s"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6050 (if deadlinep "Deadline: " "")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6051 (if scheduledp "Scheduled: " ""))
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
6052 (match-string 1) category tags timestr)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6053 (setq txt org-agenda-no-heading-message))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6054 (setq priority (org-get-priority txt))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6055 (org-add-props txt props
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6056 'org-marker marker 'org-hd-marker hdmarker)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6057 (if deadlinep
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6058 (org-add-props txt nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6059 'face (if donep 'org-done 'org-warning)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6060 '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
6061 'category category 'priority (+ 100 priority))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6062 (if scheduledp
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6063 (org-add-props txt nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6064 'face 'org-scheduled-today
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6065 '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
6066 'category category 'priority (+ 99 priority))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6067 (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
6068 (push txt ee))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6069 (outline-next-heading))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6070 (nreverse ee)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6071
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6072 (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
6073 "Return the logged TODO entries for agenda display."
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6074 (let* ((props (list 'mouse-face 'highlight
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
6075 'org-not-done-regexp org-not-done-regexp
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6076 'keymap org-agenda-keymap
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6077 'help-echo
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6078 (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
6079 (abbreviate-file-name buffer-file-name))))
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6080 (regexp (concat
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6081 "\\<" org-closed-string " *\\["
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6082 (regexp-quote
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6083 (substring
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6084 (format-time-string
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6085 (car org-time-stamp-formats)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6086 (apply 'encode-time ; DATE bound by calendar
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6087 (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
6088 1 11))))
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
6089 marker hdmarker priority category tags
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6090 ee txt timestr)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6091 (goto-char (point-min))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6092 (while (re-search-forward regexp nil t)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6093 (if (not (save-match-data (org-at-date-range-p)))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6094 (progn
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6095 (setq marker (org-agenda-new-marker (match-beginning 0))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6096 category (org-get-category (match-beginning 0))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6097 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
6098 ;; donep (org-entry-is-done-p)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6099 )
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6100 (if (string-match "\\]" timestr)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6101 ;; substring should only run to end of time stamp
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6102 (setq timestr (substring timestr 0 (match-end 0))))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6103 (save-excursion
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6104 (if (re-search-backward "\\(^\\|\r\\)\\*+" nil t)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6105 (progn
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6106 (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
6107 (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
6108 tags (org-get-tags-at))
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6109 (looking-at "\\*+[ \t]*\\([^\r\n]+\\)")
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6110 (setq txt (org-format-agenda-item
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6111 "Closed: "
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
6112 (match-string 1) category tags timestr)))
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6113 (setq txt org-agenda-no-heading-message))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6114 (setq priority 100000)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6115 (org-add-props txt props
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6116 '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
6117 'priority priority 'category category
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6118 'undone-face 'org-warning 'done-face 'org-done)
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6119 (push txt ee))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6120 (outline-next-heading))))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6121 (nreverse ee)))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6122
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6123 (defun org-agenda-get-deadlines ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6124 "Return the deadline information for agenda display."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6125 (let* ((wdays org-deadline-warning-days)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6126 (props (list 'mouse-face 'highlight
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
6127 'org-not-done-regexp org-not-done-regexp
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6128 'keymap org-agenda-keymap
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6129 'help-echo
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6130 (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
6131 (abbreviate-file-name buffer-file-name))))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6132 (regexp org-deadline-time-regexp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6133 (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
6134 (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
6135 d2 diff pos pos1 category tags
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6136 ee txt head)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6137 (goto-char (point-min))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6138 (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
6139 (setq pos (1- (match-beginning 1))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6140 d2 (time-to-days
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6141 (org-time-string-to-time (match-string 1)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6142 diff (- d2 d1))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6143 ;; When to show a deadline in the calendar:
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6144 ;; If the expiration is within wdays warning time.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6145 ;; Past-due deadlines are only shown on the current date
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6146 (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
6147 (save-excursion
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
6148 (setq category (org-get-category))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6149 (if (re-search-backward "\\(^\\|\r\\)\\*+[ \t]*" nil t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6150 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6151 (goto-char (match-end 0))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6152 (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
6153 (setq tags (org-get-tags-at pos1))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6154 (setq head (buffer-substring-no-properties
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6155 (point)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6156 (progn (skip-chars-forward "^\r\n")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6157 (point))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6158 (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
6159 (setq txt nil)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6160 (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
6161 (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
6162 (setq txt org-agenda-no-heading-message))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6163 (when txt
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6164 (org-add-props txt props
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6165 'org-marker (org-agenda-new-marker pos)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6166 '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
6167 'priority (+ (- 10 diff) (org-get-priority txt))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6168 'category category
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6169 'face (cond ((<= diff 0) 'org-warning)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6170 ((<= diff 5) 'org-scheduled-previously)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6171 (t nil))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6172 'undone-face (cond
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6173 ((<= diff 0) 'org-warning)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6174 ((<= diff 5) 'org-scheduled-previously)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6175 (t nil))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6176 'done-face 'org-done)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6177 (push txt ee)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6178 ee))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6179
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6180 (defun org-agenda-get-scheduled ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6181 "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
6182 (let* ((props (list 'face 'org-scheduled-previously
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
6183 'org-not-done-regexp org-not-done-regexp
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6184 'undone-face 'org-scheduled-previously
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6185 'done-face 'org-done
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6186 'mouse-face 'highlight
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6187 'keymap org-agenda-keymap
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6188 'help-echo
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6189 (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
6190 (abbreviate-file-name buffer-file-name))))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6191 (regexp org-scheduled-time-regexp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6192 (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
6193 (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
6194 d2 diff pos pos1 category tags
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6195 ee txt head)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6196 (goto-char (point-min))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6197 (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
6198 (setq pos (1- (match-beginning 1))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6199 d2 (time-to-days
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6200 (org-time-string-to-time (match-string 1)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6201 diff (- d2 d1))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6202 ;; When to show a scheduled item in the calendar:
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6203 ;; If it is on or past the date.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6204 (if (and (< diff 0) todayp)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6205 (save-excursion
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
6206 (setq category (org-get-category))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6207 (if (re-search-backward "\\(^\\|\r\\)\\*+[ \t]*" nil t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6208 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6209 (goto-char (match-end 0))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6210 (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
6211 (setq tags (org-get-tags-at))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6212 (setq head (buffer-substring-no-properties
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6213 (point)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6214 (progn (skip-chars-forward "^\r\n") (point))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6215 (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
6216 (setq txt nil)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6217 (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
6218 (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
6219 category tags))))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6220 (setq txt org-agenda-no-heading-message))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6221 (when txt
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6222 (org-add-props txt props
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6223 'org-marker (org-agenda-new-marker pos)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6224 '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
6225 'priority (+ (- 5 diff) (org-get-priority txt))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6226 'category category)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6227 (push txt ee)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6228 ee))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6229
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6230 (defun org-agenda-get-blocks ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6231 "Return the date-range information for agenda display."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6232 (let* ((props (list 'face nil
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
6233 'org-not-done-regexp org-not-done-regexp
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6234 'mouse-face 'highlight
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6235 'keymap org-agenda-keymap
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6236 'help-echo
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6237 (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
6238 (abbreviate-file-name buffer-file-name))))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6239 (regexp org-tr-regexp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6240 (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
6241 marker hdmarker ee txt d1 d2 s1 s2 timestr category tags)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6242 (goto-char (point-min))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6243 (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
6244 (setq timestr (match-string 0)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6245 s1 (match-string 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6246 s2 (match-string 2)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6247 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
6248 d2 (time-to-days (org-time-string-to-time s2)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6249 (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
6250 ;; 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
6251 ;; date stamps will catch the limits.
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6252 (save-excursion
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6253 (setq marker (org-agenda-new-marker (point)))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
6254 (setq category (org-get-category))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6255 (if (re-search-backward "\\(^\\|\r\\)\\*+" nil t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6256 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6257 (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
6258 (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
6259 (setq tags (org-get-tags-at))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6260 (looking-at "\\*+[ \t]*\\([^\r\n]+\\)")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6261 (setq txt (org-format-agenda-item
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6262 (format (if (= d1 d2) "" "(%d/%d): ")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6263 (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
6264 (match-string 1) category tags
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
6265 (if (= d0 d1) timestr))))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6266 (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
6267 (org-add-props txt props
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6268 'org-marker marker 'org-hd-marker hdmarker
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6269 'priority (org-get-priority txt) 'category category)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6270 (push txt ee)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6271 (outline-next-heading))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6272 ;; Sort the entries by expiration date.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6273 (nreverse ee)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6274
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6275 (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
6276 (concat
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6277 "\\(\\<[012]?[0-9]"
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6278 "\\(\\(:\\([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
6279 "\\(--?"
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6280 "\\(\\<[012]?[0-9]"
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6281 "\\(\\(:\\([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
6282 "\\)?")
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6283 "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
6284 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
6285 groups carry important information:
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6286 0 the full match
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6287 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
6288 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
6289
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6290 (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
6291 (concat
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6292 "<\\([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
6293 "\\([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
6294 "\\(--?"
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6295 "<\\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
6296 "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
6297 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
6298 0 the full match
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6299 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
6300 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
6301 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
6302
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6303 (defvar org-prefix-has-time nil
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6304 "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
6305 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
6306 (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
6307 "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
6308 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
6309
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
6310 (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
6311 "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
6312 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
6313 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
6314 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
6315 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
6316 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
6317 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
6318 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
6319 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
6320 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
6321 `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
6322 (save-match-data
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6323 ;; 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
6324 (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
6325 (let* ((category (or category
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6326 org-category
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
6327 (if buffer-file-name
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6328 (file-name-sans-extension
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
6329 (file-name-nondirectory buffer-file-name))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6330 "")))
69997
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
6331 (tag (if tags (nth (1- (length tags)) tags) ""))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6332 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
6333 (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
6334 (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
6335 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
6336 (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
6337 ;; 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
6338 (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
6339 (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
6340 (setq s0 (match-string 0 ts)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6341 s1 (match-string (if plain 1 2) ts)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6342 s2 (match-string (if plain 8 4) ts))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6343
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6344 ;; 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
6345 ;; 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
6346 ;; 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
6347 (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
6348 (string-match (concat (regexp-quote s0) " *") txt)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6349 (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
6350 (= (match-beginning 0) 0)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6351 t))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6352 (setq txt (replace-match "" nil nil txt))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6353 ;; Normalize the time(s) to 24 hour
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6354 (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
6355 (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
6356
68294
f915fc860323 (org-open-at-point): Fixed bug with matching a link.
Carsten Dominik <dominik@science.uva.nl>
parents: 68245
diff changeset
6357 (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
6358 (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
6359 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
6360 (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
6361 (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
6362
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6363 ;; Create the final string
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6364 (if noprefix
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6365 (setq rtn txt)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6366 ;; 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
6367 (setq time (cond (s2 (concat s1 "-" s2))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6368 (s1 (concat s1 "......"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6369 (t ""))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6370 extra (or extra "")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6371 category (if (symbolp category) (symbol-name category) category))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6372 ;; Evaluate the compiled format
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6373 (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
6374
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6375 ;; And finally add the text properties
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6376 (org-add-props rtn nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6377 'category (downcase category) 'tags tags
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6378 'prefix-length (- (length rtn) (length txt))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6379 'time-of-day time-of-day
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6380 'dotime dotime))))
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6381
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6382 (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
6383 (catch 'exit
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6384 (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
6385 ((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
6386 ((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
6387 ((member 'weekly (car org-agenda-time-grid)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6388 (t (throw 'exit list)))
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6389 (let* ((have (delq nil (mapcar
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6390 (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
6391 list)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6392 (string (nth 1 org-agenda-time-grid))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6393 (gridtimes (nth 2 org-agenda-time-grid))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6394 (req (car org-agenda-time-grid))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6395 (remove (member 'remove-match req))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6396 new time)
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6397 (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
6398 ;; don't show empty grid
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6399 (throw 'exit list))
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6400 (while (setq time (pop gridtimes))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6401 (unless (and remove (member time have))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6402 (setq time (int-to-string time))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6403 (push (org-format-agenda-item
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6404 nil string "" nil
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6405 (concat (substring time 0 -2) ":" (substring time -2)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6406 new)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6407 (put-text-property
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6408 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
6409 (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
6410 (append new list)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6411 (append list new)))))
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6412
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
6413 (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
6414 "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
6415 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
6416 `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
6417 (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
6418 (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
6419 (while (string-match "%\\(\\?\\)?\\([-+]?[0-9.]*\\)\\([ .;,:!?=|/<>]?\\)\\([cts]\\)"
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6420 s start)
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6421 (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
6422 '(("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
6423 ("T" . tag))))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6424 c (or (match-string 3 s) "")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6425 opt (match-beginning 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6426 start (1+ (match-beginning 0)))
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6427 (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
6428 (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
6429 (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
6430 (if opt
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6431 (setq varform
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6432 `(if (equal "" ,var)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6433 ""
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6434 (format ,f (if (equal "" ,var) "" (concat ,var ,c)))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6435 (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
6436 (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
6437 (push varform vars))
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
6438 (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
6439 (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
6440
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6441 (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
6442 "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
6443 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
6444 If not found, return nil.
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6445 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
6446 HH:MM."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6447 (save-match-data
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
6448 (when
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6449 (or
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6450 (string-match
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6451 "\\<\\([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
6452 (string-match
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6453 "\\<\\([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
6454 (let* ((t0 (+ (* 100
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6455 (+ (string-to-number (match-string 1 s))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6456 (if (and (match-beginning 4)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6457 (equal (downcase (match-string 4 s)) "pm"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6458 12 0)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6459 (if (match-beginning 3)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6460 (string-to-number (match-string 3 s))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6461 0)))
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
6462 (t1 (concat " "
68294
f915fc860323 (org-open-at-point): Fixed bug with matching a link.
Carsten Dominik <dominik@science.uva.nl>
parents: 68245
diff changeset
6463 (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
6464 (int-to-string t0))))
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6465 (if string (concat (substring t1 -4 -2) ":" (substring t1 -2)) t0)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6466
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6467 (defun org-finalize-agenda-entries (list)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6468 "Sort and concatenate the agenda items."
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
6469 (setq list (mapcar 'org-agenda-highlight-todo list))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6470 (mapconcat 'identity (sort list 'org-entries-lessp) "\n"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6471
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
6472 (defun org-agenda-highlight-todo (x)
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
6473 (let (re)
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
6474 (if (eq x 'line)
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
6475 (save-excursion
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
6476 (beginning-of-line 1)
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
6477 (setq re (get-text-property (point) 'org-not-done-regexp))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
6478 (goto-char (+ (point) (get-text-property (point) 'prefix-length)))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
6479 (and (looking-at (concat "[ \t]*" re))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
6480 (add-text-properties (match-beginning 0) (match-end 0)
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
6481 '(face org-todo))))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
6482 (setq re (get-text-property 0 'org-not-done-regexp x))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
6483 (and re (string-match re x)
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
6484 (add-text-properties (match-beginning 0) (match-end 0)
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
6485 '(face org-todo) x))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
6486 x)))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
6487
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6488 (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
6489 "Compare the priorities of string A and B."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6490 (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
6491 (pb (or (get-text-property 1 'priority b) 0)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6492 (cond ((> pa pb) +1)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6493 ((< pa pb) -1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6494 (t nil))))
58792
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 (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
6497 "Compare the string values of categories of strings A and B."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6498 (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
6499 (cb (or (get-text-property 1 'category b) "")))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6500 (cond ((string-lessp ca cb) -1)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6501 ((string-lessp cb ca) +1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6502 (t nil))))
58792
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 (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
6505 "Compare the time-of-day values of strings A and B."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6506 (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
6507 (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
6508 (tb (or (get-text-property 1 'time-of-day b) def)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6509 (cond ((< ta tb) -1)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6510 ((< tb ta) +1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6511 (t nil))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6512
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6513 (defun org-entries-lessp (a b)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6514 "Predicate for sorting agenda entries."
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
6515 ;; The following variables will be used when the form is evaluated.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6516 (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
6517 (time-down (if time-up (- time-up) nil))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6518 (priority-up (org-cmp-priority a b))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6519 (priority-down (if priority-up (- priority-up) nil))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6520 (category-up (org-cmp-category a b))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6521 (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
6522 (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
6523 (cdr (assoc
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6524 (eval (cons 'or org-agenda-sorting-strategy))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6525 '((-1 . t) (1 . nil) (nil . nil))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6526
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6527 (defun org-agenda-show-priority ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6528 "Show the priority of the current item.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6529 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
6530 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
6531 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6532 (let* ((pri (get-text-property (point-at-bol) 'priority)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6533 (message "Priority is %d" (if pri pri -1000))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6534
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
6535 (defun org-agenda-show-tags ()
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
6536 "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
6537 (interactive)
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
6538 (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
6539 (if tags
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
6540 (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
6541 (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
6542
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
6543 (defun org-agenda-goto (&optional highlight)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6544 "Go to the Org-mode file which contains the item at point."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6545 (interactive)
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
6546 (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
6547 (org-agenda-error)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6548 (buffer (marker-buffer marker))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6549 (pos (marker-position marker)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6550 (switch-to-buffer-other-window buffer)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6551 (widen)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6552 (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
6553 (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
6554 (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
6555 (save-excursion
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6556 (and (outline-next-heading)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6557 (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
6558 (and highlight (org-highlight (point-at-bol) (point-at-eol)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6559
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6560 (defun org-agenda-switch-to ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6561 "Go to the Org-mode file which contains the item at point."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6562 (interactive)
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
6563 (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
6564 (org-agenda-error)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6565 (buffer (marker-buffer marker))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6566 (pos (marker-position marker)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6567 (switch-to-buffer buffer)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6568 (delete-other-windows)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6569 (widen)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6570 (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
6571 (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
6572 (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
6573 (save-excursion
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6574 (and (outline-next-heading)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6575 (org-flag-heading nil)))))) ; show the next heading
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6576
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6577 (defun org-agenda-goto-mouse (ev)
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6578 "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
6579 (interactive "e")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6580 (mouse-set-point ev)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6581 (org-agenda-goto))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6582
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6583 (defun org-agenda-show ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6584 "Display the Org-mode file which contains the item at point."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6585 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6586 (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
6587 (org-agenda-goto t)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6588 (select-window win)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6589
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6590 (defun org-agenda-recenter (arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6591 "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
6592 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6593 (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
6594 (org-agenda-goto t)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6595 (recenter arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6596 (select-window win)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6597
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6598 (defun org-agenda-show-mouse (ev)
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6599 "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
6600 (interactive "e")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6601 (mouse-set-point ev)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6602 (org-agenda-show))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6603
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6604 (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
6605 "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
6606 (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
6607 (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
6608
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6609 (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
6610 (error "Command not allowed in this line"))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6611
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6612 (defvar org-last-heading-marker (make-marker)
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6613 "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
6614 by a remote command from the agenda.")
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6615
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
6616 (defun org-agenda-todo (&optional arg)
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6617 "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
6618 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
6619 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
6620 (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
6621 (org-agenda-check-no-diary)
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6622 (let* ((col (current-column))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6623 (marker (or (get-text-property (point) 'org-marker)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6624 (org-agenda-error)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6625 (buffer (marker-buffer marker))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6626 (pos (marker-position marker))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6627 (hdmarker (get-text-property (point) 'org-hd-marker))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6628 (buffer-read-only nil)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6629 newhead)
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
6630 (with-current-buffer buffer
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6631 (widen)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6632 (goto-char pos)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6633 (org-show-hidden-entry)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6634 (save-excursion
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6635 (and (outline-next-heading)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6636 (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
6637 (org-todo arg)
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
6638 (and (bolp) (forward-char 1))
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6639 (setq newhead (org-get-heading))
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6640 (save-excursion
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6641 (org-back-to-heading)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6642 (move-marker org-last-heading-marker (point))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6643 (beginning-of-line 1)
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6644 (save-excursion
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6645 (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
6646 (move-to-column col)))
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6647
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6648 (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
6649 "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
6650 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
6651 `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
6652 `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
6653 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
6654 the new TODO state."
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
6655 (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
6656 ; (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
6657 (save-excursion
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6658 (goto-char (point-max))
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6659 (beginning-of-line 1)
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6660 (while (not finish)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6661 (setq finish (bobp))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6662 (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
6663 (equal m hdmarker))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6664 (setq props (text-properties-at (point))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6665 dotime (get-text-property (point) 'dotime)
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
6666 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
6667 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
6668 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
6669 pl (get-text-property (point) 'prefix-length)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6670 undone-face (get-text-property (point) 'undone-face)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6671 done-face (get-text-property (point) 'done-face))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6672 (move-to-column pl)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6673 (if (looking-at ".*")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6674 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6675 (replace-match new t t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6676 (beginning-of-line 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6677 (add-text-properties (point-at-bol) (point-at-eol) props)
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
6678 (when fixface
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
6679 (add-text-properties
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
6680 (point-at-bol) (point-at-eol)
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
6681 (list 'face
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
6682 (if org-last-todo-state-is-todo
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
6683 undone-face done-face)))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
6684 (org-agenda-highlight-todo 'line))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6685 (beginning-of-line 1))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6686 (error "Line update did not work")))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6687 (beginning-of-line 0)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6688
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6689 (defun org-agenda-priority-up ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6690 "Increase the priority of line at point, also in Org-mode file."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6691 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6692 (org-agenda-priority 'up))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6693
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6694 (defun org-agenda-priority-down ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6695 "Decrease the priority of line at point, also in Org-mode file."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6696 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6697 (org-agenda-priority 'down))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6698
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6699 (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
6700 "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
6701 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
6702 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
6703 (interactive)
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6704 (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
6705 (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
6706 (org-agenda-error)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6707 (buffer (marker-buffer marker))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6708 (pos (marker-position marker))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6709 (hdmarker (get-text-property (point) 'org-hd-marker))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6710 (buffer-read-only nil)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6711 newhead)
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
6712 (with-current-buffer buffer
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6713 (widen)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6714 (goto-char pos)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6715 (org-show-hidden-entry)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6716 (save-excursion
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6717 (and (outline-next-heading)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6718 (org-flag-heading nil))) ; show the next heading
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6719 (funcall 'org-priority force-direction)
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6720 (end-of-line 1)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6721 (setq newhead (org-get-heading)))
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6722 (org-agenda-change-all-lines newhead hdmarker)
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6723 (beginning-of-line 1)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6724
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
6725 (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
6726 "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
6727 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
6728 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
6729 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
6730 (interactive)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
6731 (let (tags)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
6732 (save-excursion
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
6733 (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
6734 (save-match-data
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
6735 (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
6736 (condition-case nil
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
6737 (while t
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
6738 (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
6739 (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
6740 (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
6741 (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
6742 (error nil))))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
6743 (message "%s" tags)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
6744 tags))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
6745
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6746 (defun org-agenda-set-tags ()
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6747 "Set tags for the current headline."
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6748 (interactive)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6749 (org-agenda-check-no-diary)
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6750 (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
6751 (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
6752 (org-agenda-error)))
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6753 (buffer (marker-buffer hdmarker))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6754 (pos (marker-position hdmarker))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6755 (buffer-read-only nil)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6756 newhead)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6757 (with-current-buffer buffer
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6758 (widen)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6759 (goto-char pos)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6760 (org-show-hidden-entry)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6761 (save-excursion
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6762 (and (outline-next-heading)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6763 (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
6764 (call-interactively 'org-set-tags)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6765 (end-of-line 1)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6766 (setq newhead (org-get-heading)))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6767 (org-agenda-change-all-lines newhead hdmarker)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6768 (beginning-of-line 1)))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6769
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6770 (defun org-agenda-date-later (arg &optional what)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6771 "Change the date of this item to one day later."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6772 (interactive "p")
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6773 (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
6774 (org-agenda-check-no-diary)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6775 (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
6776 (org-agenda-error)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6777 (buffer (marker-buffer marker))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6778 (pos (marker-position marker)))
62076
4f2150e05f24 (org-get-entries-from-diary): Remove unused vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 61924
diff changeset
6779 (with-current-buffer buffer
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6780 (widen)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6781 (goto-char pos)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6782 (if (not (org-at-timestamp-p))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6783 (error "Cannot find time stamp"))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6784 (org-timestamp-change arg (or what 'day))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6785 (message "Time stamp changed to %s" org-last-changed-timestamp))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6786
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6787 (defun org-agenda-date-earlier (arg &optional what)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6788 "Change the date of this item to one day earlier."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6789 (interactive "p")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6790 (org-agenda-date-later (- arg) what))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6791
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6792 (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
6793 "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
6794 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
6795 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
6796 (interactive "P")
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6797 (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
6798 (org-agenda-check-no-diary)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6799 (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
6800 (org-agenda-error)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6801 (buffer (marker-buffer marker))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6802 (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
6803 (with-current-buffer buffer
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6804 (widen)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6805 (goto-char pos)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6806 (if (not (org-at-timestamp-p))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6807 (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
6808 (org-time-stamp arg)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6809 (message "Time stamp changed to %s" org-last-changed-timestamp))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6810
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6811 (defun org-get-heading ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6812 "Return the heading of the current entry, without the stars."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6813 (save-excursion
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6814 (and (memq (char-before) '(?\n ?\r)) (skip-chars-forward "^\n\r"))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6815 (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
6816 (looking-at "[\r\n]\\*+[ \t]+\\([^\r\n]*\\)"))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6817 (match-string 1)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6818 "")))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6819
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
6820 (defun org-agenda-diary-entry ()
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6821 "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
6822 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
6823 (interactive)
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6824 (org-agenda-check-type t 'agenda 'timeline)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6825 (require 'diary-lib)
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
6826 (let* ((char (progn
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6827 (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
6828 (read-char-exclusive)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6829 (cmd (cdr (assoc char
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6830 '((?d . insert-diary-entry)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6831 (?w . insert-weekly-diary-entry)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6832 (?m . insert-monthly-diary-entry)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6833 (?y . insert-yearly-diary-entry)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6834 (?a . insert-anniversary-diary-entry)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6835 (?b . insert-block-diary-entry)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6836 (?c . insert-cyclic-diary-entry)))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6837 (oldf (symbol-function 'calendar-cursor-to-date))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6838 (point (point))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6839 (mark (or (mark t) (point))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6840 (unless cmd
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6841 (error "No command associated with <%c>" char))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6842 (unless (and (get-text-property point 'day)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6843 (or (not (equal ?b char))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6844 (get-text-property mark 'day)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6845 (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
6846 ;; We implement this by hacking the `calendar-cursor-to-date' function
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6847 ;; and the `calendar-mark-ring' variable. Saves a lot of code.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6848 (let ((calendar-mark-ring
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6849 (list (calendar-gregorian-from-absolute
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6850 (or (get-text-property mark 'day)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6851 (get-text-property point 'day))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6852 (unwind-protect
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6853 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6854 (fset 'calendar-cursor-to-date
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6855 (lambda (&optional error)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6856 (calendar-gregorian-from-absolute
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6857 (get-text-property point 'day))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6858 (call-interactively cmd))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6859 (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
6860
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6861
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6862 (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
6863 "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
6864 the cursor position."
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6865 (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
6866 (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
6867 (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
6868 (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
6869 (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
6870 (point (point))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6871 (date (calendar-gregorian-from-absolute
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6872 (get-text-property point 'day)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6873 (displayed-day (extract-calendar-day date))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6874 (displayed-month (extract-calendar-month date))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6875 (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
6876 (unwind-protect
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6877 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6878 (fset 'calendar-cursor-to-date
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6879 (lambda (&optional error)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6880 (calendar-gregorian-from-absolute
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6881 (get-text-property point 'day))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6882 (call-interactively cmd))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6883 (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
6884
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6885 (defun org-agenda-phases-of-moon ()
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6886 "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
6887 (interactive)
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6888 (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
6889
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6890 (defun org-agenda-holidays ()
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6891 "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
6892 (interactive)
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6893 (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
6894
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6895 (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
6896 "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
6897 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
6898 `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
6899 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
6900 (interactive "P")
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6901 (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
6902 (calendar-latitude (if arg nil calendar-latitude))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6903 (calendar-location-name
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6904 (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
6905 (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
6906
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6907 (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
6908 "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
6909 (interactive)
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6910 (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
6911 (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
6912 (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
6913 (date (calendar-gregorian-from-absolute day))
a9a692f50d60 (org-read-date, org-goto-calendar)
Carsten Dominik <dominik@science.uva.nl>
parents: 66409
diff changeset
6914 (calendar-move-hook nil)
70585
af0fd91baddc (org-read-date, org-goto-calendar, org-agenda-goto-calendar): Bind
Carsten Dominik <dominik@science.uva.nl>
parents: 70162
diff changeset
6915 (view-calendar-holidays-initially nil)
66689
a9a692f50d60 (org-read-date, org-goto-calendar)
Carsten Dominik <dominik@science.uva.nl>
parents: 66409
diff changeset
6916 (view-diary-entries-initially nil))
a9a692f50d60 (org-read-date, org-goto-calendar)
Carsten Dominik <dominik@science.uva.nl>
parents: 66409
diff changeset
6917 (calendar)
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6918 (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
6919
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6920 (defun org-calendar-goto-agenda ()
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6921 "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
6922 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
6923 (interactive)
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6924 (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
6925 (calendar-cursor-to-date))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6926 nil t))
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6927
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6928 (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
6929 (interactive)
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6930 (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
6931 (let ((day (get-text-property (point) 'day))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6932 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
6933 (unless day
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6934 (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
6935 (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
6936 (setq s (concat
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6937 "Gregorian: " (calendar-date-string date) "\n"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6938 "ISO: " (calendar-iso-date-string date) "\n"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6939 "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
6940 "Julian: " (calendar-julian-date-string date) "\n"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6941 "Astron. JD: " (calendar-astro-date-string date)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6942 " (Julian date number at noon UTC)\n"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6943 "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
6944 "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
6945 "French: " (calendar-french-date-string date) "\n"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6946 "Mayan: " (calendar-mayan-date-string date) "\n"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6947 "Coptic: " (calendar-coptic-date-string date) "\n"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6948 "Ethiopic: " (calendar-ethiopic-date-string date) "\n"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6949 "Persian: " (calendar-persian-date-string date) "\n"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6950 "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
6951 (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
6952 (princ s))
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6953 (if (fboundp 'fit-window-to-buffer)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6954 (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
6955
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6956 ;;; Tags
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6957
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6958 (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
6959 "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
6960 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
6961 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
6962 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
6963 are included in the output."
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6964 (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
6965 (mapconcat 'regexp-quote
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6966 (nreverse (cdr (reverse org-todo-keywords)))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6967 "\\|")
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
6968 "\\>\\)\\)? *\\(.*?\\)\\(:[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
6969 (props (list 'face nil
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6970 'done-face 'org-done
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6971 'undone-face nil
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6972 'mouse-face 'highlight
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6973 'keymap org-agenda-keymap
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6974 'help-echo
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6975 (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
6976 (abbreviate-file-name buffer-file-name))))
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6977 lspos
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6978 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
6979 todo marker)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6980
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6981 (save-excursion
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6982 (goto-char (point-min))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6983 (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
6984 (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
6985 (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
6986 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
6987 (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
6988 (setq level (funcall outline-level)
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6989 category (org-get-category))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6990 (setq i llast llast level)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6991 ;; 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
6992 (while (>= i level)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6993 (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
6994 (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
6995 (setq i (1- i)))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6996 ;; add the nex tags
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6997 (when tags
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6998 (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
6999 tags-alist
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7000 (cons (cons level tags) tags-alist)))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7001 ;; compile tags for current headline
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7002 (setq tags-list
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7003 (if org-use-tag-inheritance
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7004 (apply 'append (mapcar 'cdr tags-alist))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7005 tags))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7006 (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
7007 (eval matcher))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7008 ;; list this headline
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7009 (if (eq action 'sparse-tree)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7010 (progn
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7011 (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
7012 (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
7013 ""
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7014 (concat
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7015 (if org-tags-match-list-sublevels
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7016 (make-string (1- level) ?.) "")
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7017 (org-get-heading))
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
7018 category tags-list))
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
7019 (goto-char lspos)
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7020 (setq marker (org-agenda-new-marker))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7021 (org-add-props txt props
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7022 '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
7023 (push txt rtn))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7024 ;; 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
7025 (point)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
7026 (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
7027 (nreverse rtn)))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7028
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7029 (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
7030 "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
7031 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
7032 \"+WORK+URGENT-WITHBOSS\"."
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7033 (interactive "P")
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7034 (let ((org-show-following-heading nil)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7035 (org-show-hierarchy-above nil))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7036 (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
7037
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7038 (defun org-make-tags-matcher (match)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7039 "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
7040 (unless match
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
7041 ;; 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
7042 (setq org-last-tags-completion-table
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7043 (or (org-get-buffer-tags)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7044 org-last-tags-completion-table))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7045 (setq match (completing-read
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7046 "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
7047 'org-tags-history)))
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
7048 ;; 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
7049 (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
7050 (setq orterms (org-split-string match "|"))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
7051 (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
7052 (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
7053 (setq minus (and (match-end 1)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
7054 (equal (match-string 1 term) "-"))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
7055 tag (match-string 2 term)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
7056 term (substring term (match-end 0))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
7057 mm (list 'member (downcase tag) 'tags-list)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
7058 mm (if minus (list 'not mm) mm))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
7059 (push mm matcher))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
7060 (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
7061 orlist)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
7062 (setq matcher nil))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
7063 (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
7064 ;; 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
7065 (cons match0 matcher)))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
7066
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7067 ;;;###autoload
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7068 (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
7069 "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
7070 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
7071 (interactive "P")
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7072 (org-agenda-maybe-reset-markers 'force)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7073 (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
7074 (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
7075 (org-tags-match-list-sublevels
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
7076 (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
7077 (win (selected-window))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7078 (completion-ignore-case t)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7079 rtn rtnall files file pos matcher
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7080 buffer)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7081 (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
7082 match (car matcher) matcher (cdr matcher))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7083 (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
7084 (progn
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7085 (delete-other-windows)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7086 (switch-to-buffer-other-window
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7087 (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
7088 (setq buffer-read-only nil)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7089 (erase-buffer)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7090 (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
7091 (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
7092 (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
7093 (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
7094 (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
7095 (setq files (org-agenda-files)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7096 rtnall nil)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7097 (while (setq file (pop files))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7098 (catch 'nextfile
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7099 (org-check-agenda-file file)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7100 (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
7101 (org-get-agenda-file-buffer file)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7102 (error "No such file %s" file)))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7103 (if (not buffer)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7104 ;; 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
7105 (setq rtn (list
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7106 (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
7107 rtnall (append rtnall rtn))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7108 (with-current-buffer buffer
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7109 (unless (eq major-mode 'org-mode)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7110 (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
7111 (save-excursion
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7112 (save-restriction
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7113 (if org-respect-restriction
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7114 (if (org-region-active-p)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7115 ;; Respect a region to restrict search
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7116 (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
7117 ;; 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
7118 ;; get rid of any restriction
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7119 (widen))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7120 (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
7121 (setq rtnall (append rtnall rtn))))))))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7122 (insert "Headlines with TAGS match: ")
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7123 (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
7124 (list 'face 'org-level-3))
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7125 (setq pos (point))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7126 (insert match "\n")
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7127 (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
7128 (setq pos (point))
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
7129 (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
7130 (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
7131 (when rtnall
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7132 (insert (mapconcat 'identity rtnall "\n")))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7133 (goto-char (point-min))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7134 (setq buffer-read-only t)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7135 (org-fit-agenda-window)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7136 (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
7137
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7138 (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
7139 (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
7140 "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
7141 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
7142 (interactive)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7143 (let* (;(inherit (org-get-inherited-tags))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7144 (re (concat "^" outline-regexp))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7145 (col (current-column))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7146 (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
7147 tags hd empty invis)
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7148 (if arg
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7149 (save-excursion
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7150 (goto-char (point-min))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7151 (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
7152 (org-set-tags nil t))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7153 (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
7154 (if just-align
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7155 (setq tags current)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7156 (setq org-last-tags-completion-table
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
7157 (or (org-get-buffer-tags)
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7158 org-last-tags-completion-table))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7159 (setq tags
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7160 (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
7161 (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
7162 nil nil current 'org-tags-history)))
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
7163 (while (string-match "[-+&]+" tags)
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
7164 (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
7165 ;; 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
7166 (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
7167 (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
7168 (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
7169 (if (equal current "")
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
7170 (progn
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
7171 (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
7172 (or empty (insert-before-markers " ")))
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
7173 (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
7174 (setq invis (org-invisible-p))
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
7175 (looking-at (concat "\\(.*\\)\\(" (regexp-quote current) "\\)[ \t]*"))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
7176 (setq hd (match-string 1))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
7177 (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
7178 (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
7179 (unless (equal tags "")
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
7180 (move-to-column (max (current-column)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
7181 (if (> org-tags-column 0)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
7182 org-tags-column
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
7183 (- (- org-tags-column) (length tags))))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
7184 t)
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7185 (insert-before-markers tags)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7186 (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
7187 (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
7188 (move-to-column col))))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7189
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7190 (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
7191 (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
7192 (if (string-match "^\\(.*[-+:&|]\\)\\([^-+:&|]*\\)$" string)
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7193 (setq s1 (match-string 1 string)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7194 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
7195 (setq s1 "" s2 string))
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7196 (cond
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7197 ((eq flag nil)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7198 ;; try completion
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7199 (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
7200 (if (stringp rtn)
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7201 (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
7202 (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
7203 (assoc rtn ctable))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7204 ":" "")))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7205 )
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7206 ((eq flag t)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7207 ;; all-completions
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7208 (all-completions s2 ctable)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7209 )
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7210 ((eq flag 'lambda)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7211 ;; exact match?
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7212 (assoc s2 ctable)))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7213 ))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7214
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7215 (defun org-get-tags ()
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7216 "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
7217 (unless (org-on-heading-p)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7218 (error "Not on a heading"))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7219 (save-excursion
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7220 (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
7221 (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
7222 (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
7223 "")))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7224
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7225 (defun org-get-buffer-tags ()
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7226 "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
7227 (let (tags)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7228 (save-excursion
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7229 (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
7230 (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
7231 (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
7232 (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
7233 (mapcar 'list tags)))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7234
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7235 ;;; Link Stuff
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7236
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7237 (defun org-find-file-at-mouse (ev)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7238 "Open file link or URL at mouse."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7239 (interactive "e")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7240 (mouse-set-point ev)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7241 (org-open-at-point 'in-emacs))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7242
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7243 (defun org-open-at-mouse (ev)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7244 "Open file link or URL at mouse."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7245 (interactive "e")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7246 (mouse-set-point ev)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7247 (org-open-at-point))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7248
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7249 (defun org-open-at-point (&optional in-emacs)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7250 "Open link at or after point.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7251 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
7252 the end of the current subtree.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7253 Normally, files will be opened by an appropriate application. If the
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7254 optional argument IN-EMACS is non-nil, Emacs will visit the file."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7255 (interactive "P")
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7256 (org-remove-occur-highlights nil nil t)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7257 (if (org-at-timestamp-p)
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7258 (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
7259 (substring (match-string 1) 0 10)))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7260 1)
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7261 (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
7262 (catch 'match
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7263 (save-excursion
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7264 (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
7265 (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
7266 (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
7267 (<= (match-beginning 0) pos)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7268 (>= (match-end 0) pos))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7269 (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
7270 (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
7271 (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
7272 (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
7273 (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
7274 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
7275 (setq type "thisfile"
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7276 path link))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7277 (throw 'match t)))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7278
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7279 (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
7280 (setq type "thisfile"
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7281 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
7282 (1+ (point)) (point))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7283 path (buffer-substring
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7284 (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
7285 (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
7286 (throw 'match t))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7287
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7288 (save-excursion
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7289 (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
7290 (if (equal (char-before) ?<) (backward-char 1))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7291 (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
7292 (looking-at org-plain-link-re)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7293 (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
7294 (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
7295 (<= (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
7296 (>= (match-end 0) pos)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7297 (setq type (match-string 1)
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7298 path (match-string 2))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7299 (throw 'match t)))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7300 (save-excursion
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7301 (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
7302 (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
7303 (setq type "tags"
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7304 path (match-string 1))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7305 (while (string-match ":" path)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7306 (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
7307 (throw 'match t)))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7308 (save-excursion
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7309 (skip-chars-backward "a-zA-Z_")
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7310 (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
7311 (looking-at org-camel-regexp))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7312 (setq type "camel" path (match-string 0))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7313 (if (equal (char-before) ?*)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7314 (setq path (concat "*" path))))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7315 (throw 'match t)))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7316 (unless path
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7317 (error "No link found"))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7318 ;; Remove any trailing spaces in path
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7319 (if (string-match " +\\'" path)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7320 (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
7321
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7322 (cond
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
7323
69620
fd0fd3b4eeb9 (org-open-at-point): Fixed bug in wiki-style bracket links.
Carsten Dominik <dominik@science.uva.nl>
parents: 69534
diff changeset
7324 ((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
7325 (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
7326
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7327 ((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
7328 (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
7329 ((or (string= type "camel")
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7330 (string= type "thisfile"))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7331 (org-mark-ring-push)
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7332 (org-link-search
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7333 path
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7334 (cond ((equal in-emacs '(4)) 'occur)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7335 ((equal in-emacs '(16)) 'org-occur)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7336 (t nil))))
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
7337
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7338 ((string= type "file")
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7339 (if (string-match "::?\\([0-9]+\\)\\'" path) ;; second : optional
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7340 (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
7341 path (substring path 0 (match-beginning 0)))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7342 (if (string-match "::\\(.+\\)\\'" path)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7343 (setq search (match-string 1 path)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7344 path (substring path 0 (match-beginning 0)))))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7345 (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
7346
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7347 ((string= type "news")
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7348 (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
7349
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7350 ((string= type "bbdb")
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7351 (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
7352
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7353 ((string= type "gnus")
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7354 (let (group article)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7355 (if (not (string-match "\\`\\([^#]+\\)\\(#\\(.*\\)\\)?" path))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7356 (error "Error in Gnus link"))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7357 (setq group (match-string 1 path)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7358 article (match-string 3 path))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7359 (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
7360
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7361 ((string= type "vm")
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7362 (let (folder article)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7363 (if (not (string-match "\\`\\([^#]+\\)\\(#\\(.*\\)\\)?" path))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7364 (error "Error in VM link"))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7365 (setq folder (match-string 1 path)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7366 article (match-string 3 path))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7367 ;; 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
7368 (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
7369
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7370 ((string= type "wl")
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7371 (let (folder article)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7372 (if (not (string-match "\\`\\([^#]+\\)\\(#\\(.*\\)\\)?" path))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7373 (error "Error in Wanderlust link"))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7374 (setq folder (match-string 1 path)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7375 article (match-string 3 path))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7376 (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
7377
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7378 ((string= type "mhe")
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7379 (let (folder article)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7380 (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
7381 (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
7382 (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
7383 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
7384 (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
7385
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7386 ((string= type "rmail")
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7387 (let (folder article)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7388 (if (not (string-match "\\`\\([^#]+\\)\\(#\\(.*\\)\\)?" path))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7389 (error "Error in RMAIL link"))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7390 (setq folder (match-string 1 path)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7391 article (match-string 3 path))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7392 (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
7393
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7394 ((string= type "shell")
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7395 (let ((cmd path))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7396 (while (string-match "@{" cmd)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7397 (setq cmd (replace-match "<" t t cmd)))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7398 (while (string-match "@}" cmd)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7399 (setq cmd (replace-match ">" t t cmd)))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7400 (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
7401 (funcall org-confirm-shell-links
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7402 (format "Execute \"%s\" in shell? "
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7403 (org-add-props cmd nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7404 'face 'org-warning))))
70064
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
7405 (progn
70161
b9e09a4a2168 (org-mode-map): Catch conflict with old allout.el.
Carsten Dominik <dominik@science.uva.nl>
parents: 70136
diff changeset
7406 (message "Executing %s" cmd)
b9e09a4a2168 (org-mode-map): Catch conflict with old allout.el.
Carsten Dominik <dominik@science.uva.nl>
parents: 70136
diff changeset
7407 (shell-command cmd))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7408 (error "Abort"))))
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
7409
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7410 (t
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7411 (browse-url-at-point))))))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7412
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7413 (defun org-link-search (s &optional type)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7414 "Search for a link search option.
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7415 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
7416 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
7417 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
7418 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
7419 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
7420 in all files."
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7421 (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
7422 (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
7423 (pos (point))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7424 (pre "") (post "")
69454
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
7425 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
7426 (cond ((save-excursion
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7427 (goto-char (point-min))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7428 (and
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7429 (re-search-forward
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7430 (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
7431 (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
7432 ;; 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
7433 (goto-char pos))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7434 ((string-match "^/\\(.*\\)/$" s)
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7435 ;; A regular expression
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7436 (cond
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7437 ((eq major-mode 'org-mode)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7438 (org-occur (match-string 1 s)))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7439 ;;((eq major-mode 'dired-mode)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7440 ;; (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
7441 (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
7442 ((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
7443 t)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7444 ;; 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
7445 (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
7446 ;; 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
7447 (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
7448 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
7449 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
7450 (remove-text-properties
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7451 0 (length s)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7452 '(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
7453 ;; 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
7454 (setq words
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7455 (if camel
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7456 (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
7457 (org-split-string s "[ \n\r\t]+"))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7458 re0 (concat "<<" (regexp-quote s0) ">>")
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7459 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
7460 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
7461 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
7462 re1 (concat pre re2 post)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7463 re3 (concat pre re4 post)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7464 re5 (concat pre ".*" re4)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7465 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
7466 re2a (concat pre re2a)
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7467 re4 (concat pre re4)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7468 reall (concat "\\(" re0 "\\)\\|\\(" re1 "\\)\\|\\(" re2
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7469 "\\)\\|\\(" re3 "\\)\\|\\(" re4 "\\)\\|\\("
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7470 re5 "\\)"
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7471 ))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7472 (cond
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7473 ((eq type 'org-occur) (org-occur reall))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7474 ((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
7475 (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
7476 (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
7477 (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
7478 (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
7479 (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
7480 (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
7481 (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
7482 (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
7483 )
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7484 (goto-char (match-beginning 0))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7485 (goto-char pos)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7486 (error "No match")))))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7487 (t
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7488 ;; Normal string-search
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7489 (goto-char (point-min))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7490 (if (search-forward s nil t)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7491 (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
7492 (error "No match"))))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7493 (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
7494
69454
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
7495 (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
7496 "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
7497 (catch 'exit
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
7498 (let ((pos (point)) p1)
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
7499 (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
7500 (setq p1 (point))
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
7501 (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
7502 (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
7503 (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
7504 (<= (match-beginning 0) p1)
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
7505 (>= (match-end 0) p1))))
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
7506 (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
7507 (throw 'exit (point)))
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
7508 (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
7509
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7510 (defun org-do-occur (regexp &optional cleanup)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7511 "Call the Emacs command `occur'.
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7512 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
7513 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
7514 to read."
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7515 (occur regexp)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7516 (when cleanup
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7517 (let ((cwin (selected-window)) win beg end)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7518 (when (setq win (get-buffer-window "*Occur*"))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7519 (select-window win))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7520 (goto-char (point-min))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7521 (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
7522 (setq beg (match-end 0))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7523 (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
7524 (setq end (1- (match-beginning 0)))))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7525 (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
7526 (goto-char (point-min))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7527 (select-window cwin))))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7528
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7529 (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
7530 "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
7531 (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
7532 "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
7533 ;; 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
7534 (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
7535 (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
7536 (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
7537 (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
7538 org-mark-ring)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7539
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7540 (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
7541 "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
7542 (interactive)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7543 (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
7544 (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
7545 (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
7546 (or pos (point))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7547 (or buffer (current-buffer)))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7548 (message
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7549 (substitute-command-keys
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7550 "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
7551
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7552 (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
7553 "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
7554 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
7555 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
7556 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
7557 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
7558 onto the ring."
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7559 (interactive "p")
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7560 (let (p m)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7561 (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
7562 (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
7563 (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
7564 (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
7565 (setq m (car p))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7566 (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
7567 (goto-char m)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7568 (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
7569
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7570 (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
7571 "Split \"CamelCaseWords\" to (\"Camel\" \"Case\" \"Words\")."
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7572 (let ((case-fold-search nil)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7573 words)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7574 (while (string-match "[a-z][A-Z]" s)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7575 (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
7576 (setq s (substring s (1+ (match-beginning 0)))))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7577 (nreverse (cons s words))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7578
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7579 (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
7580 (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
7581 (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
7582 s)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7583 (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
7584 (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
7585 (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
7586 s)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7587
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7588 (defun org-follow-bbdb-link (name)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7589 "Follow a BBDB link to NAME."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7590 (require 'bbdb)
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7591 (let ((inhibit-redisplay t)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7592 (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
7593 (catch 'exit
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
7594 ;; 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
7595 (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
7596 (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
7597 ;; 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
7598 (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
7599 (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
7600 ;; 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
7601 (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
7602 (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
7603 ;; 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
7604 (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
7605 (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
7606 ;; 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
7607 (bbdb name nil)
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
7608 (when (= 0 (buffer-size (get-buffer "*BBDB*")))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7609 (delete-window (get-buffer-window "*BBDB*"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7610 (error "No matching BBDB record")))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7611
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7612 (defun org-follow-gnus-link (&optional group article)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7613 "Follow a Gnus link to GROUP and ARTICLE."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7614 (require 'gnus)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7615 (funcall (cdr (assq 'gnus org-link-frame-setup)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7616 (if group (gnus-fetch-group group))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7617 (if article
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7618 (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
7619 (if (fboundp 'gnus-summary-insert-cached-articles)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7620 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7621 (gnus-summary-insert-cached-articles)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7622 (gnus-summary-goto-article article nil 'force))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7623 (message "Message could not be found.")))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7624
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7625 (defun org-follow-vm-link (&optional folder article readonly)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7626 "Follow a VM link to FOLDER and ARTICLE."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7627 (require 'vm)
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7628 (setq article (org-add-angle-brackets article))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7629 (if (string-match "^//\\([a-zA-Z]+@\\)?\\([^:]+\\):\\(.*\\)" folder)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7630 ;; ange-ftp or efs or tramp access
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7631 (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
7632 (host (match-string 2 folder))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7633 (file (match-string 3 folder)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7634 (cond
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7635 ((featurep 'tramp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7636 ;; use tramp to access the file
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7637 (if (featurep 'xemacs)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7638 (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
7639 (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
7640 (t
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7641 ;; use ange-ftp or efs
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7642 (require (if (featurep 'xemacs) 'efs 'ange-ftp))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7643 (setq folder (format "/%s@%s:%s" user host file))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7644 (when folder
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7645 (funcall (cdr (assq 'vm org-link-frame-setup)) folder readonly)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7646 (sit-for 0.1)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7647 (when article
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7648 (vm-select-folder-buffer)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7649 (widen)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7650 (let ((case-fold-search t))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7651 (goto-char (point-min))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7652 (if (not (re-search-forward
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7653 (concat "^" "message-id: *" (regexp-quote article))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7654 (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
7655 (vm-isearch-update)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7656 (vm-isearch-narrow)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7657 (vm-beginning-of-message)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7658 (vm-summarize)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7659
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7660 (defun org-follow-wl-link (folder article)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7661 "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
7662 (setq article (org-add-angle-brackets article))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7663 (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
7664 (if article (wl-summary-jump-to-msg-by-message-id article ">"))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7665 (wl-summary-redisplay))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7666
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7667 (defun org-follow-rmail-link (folder article)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7668 "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
7669 (setq article (org-add-angle-brackets article))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7670 (let (message-number)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7671 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7672 (save-window-excursion
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7673 (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
7674 (setq message-number
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7675 (save-restriction
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7676 (widen)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7677 (goto-char (point-max))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7678 (if (re-search-backward
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7679 (concat "^Message-ID:\\s-+" (regexp-quote
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7680 (or article "")))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7681 nil t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7682 (rmail-what-message))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7683 (if message-number
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7684 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7685 (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
7686 (rmail-show-message message-number)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7687 message-number)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7688 (error "Message not found"))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7689
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7690 ;; 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
7691 (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
7692 "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
7693 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
7694 (save-excursion
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7695 (let* ((folder
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7696 (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
7697 mh-current-folder
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7698 ;; 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
7699 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
7700 (end-index
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7701 (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
7702 (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
7703 )
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7704 ;; 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
7705 ;; 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
7706 (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
7707 (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
7708 (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
7709 (save-window-excursion
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7710 (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
7711 (progn
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7712 (pop-to-buffer folder)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7713 (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
7714 )
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7715 ))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7716 (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
7717 )
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7718 folder
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7719 )
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7720 )))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7721
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7722 (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
7723 "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
7724 (save-excursion
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7725 (mh-index-previous-folder)
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
7726 (re-search-forward "^\\(+.*\\)$" nil t)
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
7727 (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
7728
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7729 (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
7730 "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
7731 use sequences."
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7732 (save-excursion
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7733 (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
7734 mh-current-folder
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7735 ;; 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
7736 mh-show-folder-buffer)))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7737
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7738 (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
7739 "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
7740 use sequences."
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7741 (save-excursion
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7742 (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
7743 (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
7744 ;; 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
7745 (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
7746
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7747 (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
7748 "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
7749 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
7750 idea..."
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7751 (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
7752 (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
7753 (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
7754 (header-field))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7755 (with-current-buffer buffer
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7756 (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
7757 (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
7758 (mh-header-display)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7759 (mh-show-header-display))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7760 (set-buffer buffer)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7761 (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
7762 (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
7763 (mh-show)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7764 (mh-show-show))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7765 header-field)))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7766
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7767 (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
7768 "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
7769 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
7770 `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
7771 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
7772 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
7773 folders."
69116
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
7774 (require 'mh-e)
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
7775 (require 'mh-search)
69454
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
7776 (require 'mh-utils)
69116
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
7777 (mh-find-path)
69454
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
7778 (if (not article)
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
7779 (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
7780 (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
7781 (mh-search-choose)
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
7782 (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
7783 (progn
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
7784 (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
7785 (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
7786 (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
7787 (kill-this-buffer)
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
7788 (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
7789 (mh-search "+" article))
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
7790 (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
7791 (mh-show-msg 1)
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
7792 (kill-this-buffer)
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
7793 (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
7794
70010
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
7795 (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
7796 "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
7797 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
7798 for this link."
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
7799 (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
7800 (save-excursion
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
7801 (goto-char (point-min))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
7802 (let ((re (concat "\\([^[]\\)<\\("
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
7803 "\\(" (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
7804 "\\):"
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
7805 "[^" org-non-link-chars "]+\\)>"))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
7806 l1 l2 (cnt 0))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
7807 (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
7808 (setq cnt (1+ cnt)
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
7809 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
7810 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
7811 (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
7812 (if (equal l1 l2)
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
7813 (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
7814 (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
7815 (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
7816
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7817 (defun org-open-file (path &optional in-emacs line search)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7818 "Open the file at PATH.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7819 First, this expands any special file name abbreviations. Then the
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7820 configuration variable `org-file-apps' is checked if it contains an
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7821 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
7822 If no application is found, Emacs simply visits the file.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7823 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
7824 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
7825 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
7826 opened in Emacs.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7827 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
7828 (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
7829 (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
7830 buffer-file-name
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7831 (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
7832 (dirp (file-directory-p file))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7833 (dfile (downcase file))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7834 (old-buffer (current-buffer))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7835 (old-pos (point))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7836 (old-mode major-mode)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7837 ext cmd apps)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7838 (if (and (not (file-exists-p file))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7839 (not org-open-non-existing-files))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7840 (error "No such file: %s" file))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7841 (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
7842 (setq ext (match-string 1 dfile))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7843 (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
7844 (setq ext (match-string 1 dfile))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7845 (setq apps (append org-file-apps (org-default-apps)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7846 (if in-emacs
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7847 (setq cmd 'emacs)
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7848 (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
7849 (cdr (assoc ext apps))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7850 (cdr (assoc t apps)))))
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
7851 (when (eq cmd 'mailcap)
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
7852 (require 'mailcap)
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
7853 (mailcap-parse-mailcaps)
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
7854 (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
7855 (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
7856 (if (stringp command)
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
7857 (setq cmd command)
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
7858 (setq cmd 'emacs))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7859 (cond
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7860 ((and (stringp cmd) (not (string-match "^\\s-*$" cmd)))
70161
b9e09a4a2168 (org-mode-map): Catch conflict with old allout.el.
Carsten Dominik <dominik@science.uva.nl>
parents: 70136
diff changeset
7861 ;; Normalize use of quote, this can vary.
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
7862 (if (string-match "['\"]%s['\"]" cmd)
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
7863 (setq cmd (replace-match "'%s'" t t cmd)))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
7864 (setq cmd (format cmd file))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7865 (save-window-excursion
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
7866 (shell-command (concat cmd " &"))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7867 ((or (stringp cmd)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7868 (eq cmd 'emacs))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7869 (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
7870 (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
7871 (if line (goto-line line)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7872 (if search (org-link-search search))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7873 ((consp cmd)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7874 (eval cmd))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7875 (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
7876 (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
7877 (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
7878 (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
7879 (org-mark-ring-push old-pos old-buffer))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7880
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7881 (defun org-default-apps ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7882 "Return the default applications for this operating system."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7883 (cond
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7884 ((eq system-type 'darwin)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7885 org-file-apps-defaults-macosx)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7886 ((eq system-type 'windows-nt)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7887 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
7888 (t org-file-apps-defaults-gnu)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7889
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7890 (defun org-expand-file-name (path)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7891 "Replace special path abbreviations and expand the file name."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7892 (expand-file-name path))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7893
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7894
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7895 (defvar org-insert-link-history nil
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7896 "Minibuffer history for links inserted with `org-insert-link'.")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7897
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7898 (defvar org-stored-links nil
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7899 "Contains the links stored with `org-store-link'.")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7900
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7901 ;;;###autoload
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7902 (defun org-store-link (arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7903 "\\<org-mode-map>Store an org-link to the current location.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7904 This link can later be inserted into an org-buffer with
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7905 \\[org-insert-link].
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7906 For some link types, a prefix arg is interpreted:
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7907 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
7908 For file links, arg negates `org-context-in-file-links'."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7909 (interactive "P")
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7910 (let (link cpltxt desc txt (pos (point)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7911 (cond
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7912
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7913 ((eq major-mode 'bbdb-mode)
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
7914 (setq cpltxt (concat
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7915 "bbdb:"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7916 (or (bbdb-record-name (bbdb-current-record))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7917 (bbdb-record-company (bbdb-current-record))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7918 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
7919
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7920 ((eq major-mode 'calendar-mode)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7921 (let ((cd (calendar-cursor-to-date)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7922 (setq link
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7923 (format-time-string
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7924 (car org-time-stamp-formats)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7925 (apply 'encode-time
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7926 (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
7927 nil nil nil))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7928
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7929 ((or (eq major-mode 'vm-summary-mode)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7930 (eq major-mode 'vm-presentation-mode))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7931 (and (eq major-mode 'vm-presentation-mode) (vm-summarize))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7932 (vm-follow-summary-cursor)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7933 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7934 (vm-select-folder-buffer)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7935 (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
7936 (folder buffer-file-name)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7937 (subject (vm-su-subject message))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7938 (author (vm-su-full-name message))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7939 (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
7940 (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
7941 (setq folder (abbreviate-file-name folder))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7942 (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
7943 folder)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7944 (setq folder (replace-match "" t t folder)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7945 (setq cpltxt (concat author " on: " subject))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7946 (setq link (org-make-link "vm:" folder "#" message-id)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7947
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7948 ((eq major-mode 'wl-summary-mode)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7949 (let* ((msgnum (wl-summary-message-number))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7950 (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
7951 msgnum 'message-id))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7952 (wl-message-entity (elmo-msgdb-overview-get-entity
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7953 msgnum (wl-summary-buffer-msgdb)))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7954 (author (wl-summary-line-from)) ; FIXME: correct?
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7955 (subject "???")) ; FIXME:
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7956 (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
7957 (setq cpltxt (concat author " on: " subject))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7958 (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
7959 "#" message-id))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7960
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7961 ((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
7962 (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
7963 (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
7964 (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
7965 (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
7966 (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
7967 (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
7968 (org-remove-angle-brackets
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7969 (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
7970
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7971 ((eq major-mode 'rmail-mode)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7972 (save-excursion
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7973 (save-restriction
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7974 (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
7975 (let ((folder buffer-file-name)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7976 (message-id (mail-fetch-field "message-id"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7977 (author (mail-fetch-field "from"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7978 (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
7979 (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
7980 (setq cpltxt (concat author " on: " subject))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7981 (setq link (org-make-link "rmail:" folder "#" message-id))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7982
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7983 ((eq major-mode 'gnus-group-mode)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7984 (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
7985 (gnus-group-group-name)) ; version
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7986 ((fboundp 'gnus-group-name)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7987 (gnus-group-name))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7988 (t "???"))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7989 (setq cpltxt (concat
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7990 (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
7991 "http://groups.google.com/groups?group="
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7992 "gnus:")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7993 group)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7994 link (org-make-link cpltxt))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7995
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
7996 ((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
7997 (and (eq major-mode 'gnus-article-mode) (gnus-article-show-summary))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7998 (gnus-summary-beginning-of-article)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7999 (let* ((group (car gnus-article-current))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8000 (article (cdr gnus-article-current))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8001 (header (gnus-summary-article-header article))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8002 (author (mail-header-from header))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8003 (message-id (mail-header-id header))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8004 (date (mail-header-date header))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8005 (subject (gnus-summary-subject-string)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8006 (setq cpltxt (concat author " on: " subject))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8007 (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
8008 (setq link
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8009 (concat
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8010 cpltxt "\n "
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8011 (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
8012 (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
8013 (setq link (org-make-link "gnus:" group
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8014 "#" (number-to-string article))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8015
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8016 ((eq major-mode 'w3-mode)
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
8017 (setq cpltxt (url-view-url t)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8018 link (org-make-link cpltxt)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8019 ((eq major-mode 'w3m-mode)
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
8020 (setq cpltxt w3m-current-url
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8021 link (org-make-link cpltxt)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8022
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
8023 ((eq major-mode 'org-mode)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
8024 ;; Just link to current headline
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
8025 (setq cpltxt (concat "file:"
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
8026 (abbreviate-file-name buffer-file-name)))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
8027 ;; Add a context search string
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
8028 (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
8029 ;; Check if we are on a target
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
8030 (if (save-excursion
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
8031 (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
8032 (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
8033 (looking-at "<<\\(.*?\\)>>")
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
8034 (<= (match-beginning 0) pos)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
8035 (>= (match-end 0) pos)))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
8036 (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
8037 (setq txt (cond
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
8038 ((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
8039 ((org-region-active-p)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
8040 (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
8041 (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
8042 (setq cpltxt
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
8043 (concat cpltxt "::"
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
8044 (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
8045 (org-make-org-heading-camel txt)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8046 (org-make-org-heading-search-string txt)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8047 desc "NONE")))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
8048 (if (string-match "::\\'" cpltxt)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
8049 (setq cpltxt (substring cpltxt 0 -2)))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
8050 (setq link (org-make-link cpltxt)))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
8051
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
8052 (buffer-file-name
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8053 ;; Just link to this file here.
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
8054 (setq cpltxt (concat "file:"
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
8055 (abbreviate-file-name buffer-file-name)))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
8056 ;; Add a context string
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
8057 (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
8058 (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
8059 (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
8060 (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
8061 (setq cpltxt
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
8062 (concat cpltxt "::"
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
8063 (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
8064 (org-make-org-heading-camel txt)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8065 (org-make-org-heading-search-string txt)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8066 desc "NONE"))
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
8067 (setq link (org-make-link cpltxt)))
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
8068
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8069 ((interactive-p)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8070 (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
8071
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8072 (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
8073
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8074 (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
8075 (setq link (or link cpltxt)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8076 desc (or desc cpltxt))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8077 (if (equal desc "NONE") (setq desc nil))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8078
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8079 (if (and (interactive-p) link)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8080 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8081 (setq org-stored-links
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8082 (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
8083 (message "Stored: %s" (or cpltxt link)))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8084 (org-make-link-string link desc))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8085
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
8086 (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
8087 "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
8088 (interactive)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
8089 (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
8090 (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
8091 ;; 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
8092 (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
8093 (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
8094 (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
8095 (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
8096 (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
8097 (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
8098 org-comment-string "\\)") s)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
8099 (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
8100 (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
8101 (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
8102 (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
8103 (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
8104 (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
8105 (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
8106
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
8107 (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
8108 "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
8109 (interactive)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
8110 (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
8111 (unless (and string (not heading))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
8112 ;; 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
8113 (if (string-match org-todo-regexp s)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
8114 (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
8115 (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
8116 (setq s (replace-match "" t t s)))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
8117 (setq s (org-trim s))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
8118 (if (string-match (concat "^\\(" org-quote-string "\\|"
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
8119 org-comment-string "\\)") s)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
8120 (setq s (replace-match "" t t s)))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
8121 (while (string-match org-ts-regexp s)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
8122 (setq s (replace-match "" t t s))))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
8123 (while (string-match "[^a-zA-Z_ \t]+" s)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
8124 (setq s (replace-match " " t t s)))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
8125 (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
8126 (mapconcat 'capitalize (org-split-string s "[ \t]+") "")))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
8127
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
8128 (defun org-make-link (&rest strings)
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
8129 "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
8130 (format org-link-format (apply 'concat strings)))
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
8131
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8132 (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
8133 "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
8134 (if (eq org-link-style 'plain)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8135 (if (equal description link)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8136 link
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8137 (concat description "\n" link))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8138 (when (stringp description)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8139 ;; 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
8140 (while (string-match "\\[\\|\\]" description)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8141 (setq description (replace-match "" t t description))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8142 (when (equal (org-link-escape link) description)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8143 ;; No description needed, it is identical
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8144 (setq description nil))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8145 (when (and (not description)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8146 (not (equal link (org-link-escape link))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8147 (setq description link))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8148 (concat "[[" (org-link-escape link) "]"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8149 (if description (concat "[" description "]") "")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8150 "]")))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8151
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8152 (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
8153 "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
8154
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8155 (defun org-link-escape (text)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8156 "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
8157 (when text
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8158 (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
8159 org-link-escape-chars "\\|")))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8160 (while (string-match re text)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8161 (setq text
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8162 (replace-match
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8163 (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
8164 t t text)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8165 text)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8166
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8167 (defun org-link-unescape (text)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8168 "Reverse the action of `org-link-escape'."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8169 (when text
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8170 (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
8171 org-link-escape-chars "\\|")))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8172 (while (string-match re text)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8173 (setq text
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8174 (replace-match
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8175 (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
8176 t t text)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8177 text)))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
8178
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8179 (defun org-xor (a b)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8180 "Exclusive or."
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
8181 (if a (not b) b))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8182
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8183 (defun org-get-header (header)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8184 "Find a header field in the current buffer."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8185 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8186 (goto-char (point-min))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8187 (let ((case-fold-search t) s)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8188 (cond
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8189 ((eq header 'from)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8190 (if (re-search-forward "^From:\\s-+\\(.*\\)" nil t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8191 (setq s (match-string 1)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8192 (while (string-match "\"" s)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8193 (setq s (replace-match "" t t s)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8194 (if (string-match "[<(].*" s)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8195 (setq s (replace-match "" t t s))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8196 ((eq header 'message-id)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8197 (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
8198 (setq s (match-string 1))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8199 ((eq header 'subject)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8200 (if (re-search-forward "^subject:\\s-+\\(.*\\)" nil t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8201 (setq s (match-string 1)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8202 (if (string-match "\\`[ \t\]+" s) (setq s (replace-match "" t t s)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8203 (if (string-match "[ \t\]+\\'" s) (setq s (replace-match "" t t s)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8204 s)))
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
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8207 (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
8208 "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
8209 (while (string-match "<" s)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8210 (setq s (replace-match "%3C" t t s)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8211 (while (string-match ">" s)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8212 (setq s (replace-match "%3E" t t s)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8213 (while (string-match "@" s)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8214 (setq s (replace-match "%40" t t s)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8215 s)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8216
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8217 (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
8218 "Insert a link. At the prompt, enter the link.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8219
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8220 Completion can be used to select a link previously stored with
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8221 `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
8222 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
8223 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
8224 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
8225
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8226 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
8227 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
8228
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8229 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
8230 and description parts.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8231
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
8232 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
8233 selected using completion. The path to the file will be relative to
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8234 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
8235 subdirectory. Otherwise, the link will be the absolute path as
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8236 completed in the minibuffer (i.e. normally ~/path/to/file).
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8237
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
8238 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
8239 is in the current directory or below."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8240 (interactive "P")
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8241 (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
8242 (cond
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8243 ((save-excursion
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8244 (skip-chars-forward "^]\n\r")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8245 (and (re-search-backward "\\[\\[" nil t)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8246 (looking-at org-bracket-link-regexp)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8247 (<= (match-beginning 0) pos)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8248 (>= (match-end 0) pos)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8249 ;; 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
8250 (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
8251 (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
8252 (setq link (read-string "Link: "
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8253 (org-link-unescape
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8254 (org-match-string-no-properties 1)))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8255 (complete-file
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8256 ;; Completing read for file names.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8257 (setq file (read-file-name "File: "))
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
8258 (let ((pwd (file-name-as-directory (expand-file-name ".")))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
8259 (pwd1 (file-name-as-directory (abbreviate-file-name
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
8260 (expand-file-name ".")))))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8261 (cond
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8262 ((equal complete-file '(16))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8263 (setq link (org-make-link
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8264 "file:"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8265 (abbreviate-file-name (expand-file-name file)))))
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
8266 ((string-match (concat "^" (regexp-quote pwd1) "\\(.+\\)") file)
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
8267 (setq link (org-make-link "file:" (match-string 1 file))))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8268 ((string-match (concat "^" (regexp-quote pwd) "\\(.+\\)")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8269 (expand-file-name file))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8270 (setq link (org-make-link
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8271 "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
8272 (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
8273 (t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8274 ;; Read link, with completion for stored links.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8275 (setq link (org-completing-read
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8276 "Link: " org-stored-links nil nil nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8277 org-insert-link-history
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8278 (or (car (car org-stored-links)))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8279 (setq entry (assoc link org-stored-links))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8280 (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
8281 (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
8282 org-stored-links)))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8283 (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
8284 desc (or desc (nth 2 entry)))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8285
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8286 (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
8287 ;; 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
8288 (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
8289
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8290 ;; 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
8291 (when (string-match "\\<file:\\(.+?\\)::\\([^>]+\\)" link)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8292 (let* ((path (match-string 1 link))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8293 (case-fold-search nil)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8294 (search (match-string 2 link)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8295 (when (save-match-data
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8296 (equal (file-truename buffer-file-name)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8297 (file-truename path)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8298 ;; 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
8299 (setq link search))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8300 (setq desc (read-string "Description: " desc))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8301 (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
8302 (if remove (apply 'delete-region remove))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8303 (insert (org-make-link-string link desc))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8304
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8305 (defun org-completing-read (&rest args)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8306 (let ((minibuffer-local-completion-map
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8307 (copy-keymap minibuffer-local-completion-map)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8308 (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
8309 (apply 'completing-read args)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8310
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8311 ;;; Hooks for remember.el
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8312
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8313 (defvar org-finish-function nil)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8314
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8315 ;;;###autoload
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8316 (defun org-remember-annotation ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8317 "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
8318 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
8319 remember.el, then the annotations should include a link compatible with the
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8320 conventions in Org-mode. This function returns such a link."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8321 (org-store-link nil))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8322
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8323 (defconst org-remember-help
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8324 "Select a destination location for the note.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8325 UP/DOWN=headline TAB=cycle visibility [Q]uit RET/<left>/<right>=Store
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8326 RET at beg-of-buf -> Append to file as level 2 headline
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8327 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
8328 <left>/<right> -> before/after current headline, same headings level")
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8329
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8330 ;;;###autoload
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8331 (defun org-remember-apply-template ()
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8332 "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
8333 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
8334 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
8335 (when org-remember-templates
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8336 (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
8337 (cdar org-remember-templates)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8338 (message "Select template: %s"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8339 (mapconcat
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8340 (lambda (x) (char-to-string (car x)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8341 org-remember-templates " "))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8342 (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
8343 (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
8344 (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
8345 (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
8346 (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
8347 (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
8348 (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
8349 (v-a annotation) ; defined in `remember-mode'
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8350 (v-i initial) ; defined in `remember-mode'
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8351 (v-n user-full-name)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8352 )
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8353 (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
8354 (insert tpl) (goto-char (point-min))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8355 (while (re-search-forward "%\\([tTuTai]\\)" nil t)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8356 (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
8357 (save-match-data
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8358 (let* ((lead (buffer-substring
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8359 (point-at-bol) (match-beginning 0))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8360 (setq v-i (mapconcat 'identity
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8361 (org-split-string initial "\n")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8362 (concat "\n" lead))))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8363 (replace-match
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8364 (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
8365 t t))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8366 (let ((org-startup-folded nil)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8367 (org-startup-with-deadline-check nil))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8368 (org-mode))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8369 (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
8370 (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
8371 (goto-char (point-min))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8372 (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
8373 (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
8374
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8375 ;;;###autoload
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8376 (defun org-remember-handler ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8377 "Store stuff from remember.el into an org file.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8378 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
8379 of `org-default-notes-file' is used.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8380 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
8381 file the text at a specific location.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8382 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
8383 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
8384 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
8385
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8386 Key Cursor position Note gets inserted
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8387 -----------------------------------------------------------------------------
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8388 RET buffer-start as level 2 heading at end of file
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8389 RET on headline as sublevel of the heading at cursor
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8390 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
8391 Or use prefix arg to specify level manually.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8392 <left> on headline as same level, before current heading
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8393 <right> on headline as same level, after current heading
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 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
8396 the default file. This way your current train of thought is not
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8397 interrupted, in accordance with the principles of remember.el. But with
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8398 little extra effort, you can push it directly to the correct location.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8399
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8400 Before being stored away, the function ensures that the text has a
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8401 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
8402 is constructed from the current date and some additional data.
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 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
8405 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
8406 \(i.e. after the stars).
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8407
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
8408 See also the variable `org-reverse-note-order'."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8409 (catch 'quit
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8410 (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
8411 (fastp current-prefix-arg)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8412 (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
8413 (visiting (find-buffer-visiting file))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8414 (org-startup-with-deadline-check nil)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8415 (org-startup-folded nil)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8416 (org-startup-align-all-tables nil)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8417 spos level indent reversed)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8418 ;; 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
8419 ;; into an org tree.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8420 (let* ((lines (split-string txt "\n"))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8421 first)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8422 ;; remove empty lines at the beginning
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8423 (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
8424 (setq lines (cdr lines)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8425 (setq first (car lines) lines (cdr lines))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8426 (if (string-match "^\\*+" first)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8427 ;; Is already a headline
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8428 (setq indent nil)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8429 ;; 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
8430 (setq lines (cons first lines)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8431 first (concat "* " (current-time-string)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8432 " (" (remember-buffer-desc) ")")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8433 indent " "))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8434 (if (and org-adapt-indentation indent)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8435 (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
8436 (setq txt (concat first "\n"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8437 (mapconcat 'identity lines "\n"))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8438 ;; Find the file
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8439 (if (not visiting)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8440 (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
8441 (with-current-buffer (get-file-buffer file)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8442 (setq reversed (org-notes-order-reversed-p))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8443 (save-excursion
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8444 (save-restriction
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8445 (widen)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8446 ;; Ask the User for a location
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8447 (setq spos (if fastp 1 (org-get-location
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8448 (current-buffer)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8449 org-remember-help)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8450 (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
8451 ; not handle this note
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8452 (goto-char spos)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8453 (cond ((bobp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8454 ;; 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
8455 (save-restriction
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8456 (widen)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8457 (goto-char (if reversed (point-min) (point-max)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8458 (if (not (bolp)) (newline))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8459 (org-paste-subtree 2 txt)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8460 ((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
8461 ;; 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
8462 (org-back-to-heading)
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
8463 (setq level (funcall outline-level))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8464 (if reversed
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8465 (outline-end-of-heading)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8466 (outline-end-of-subtree))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8467 (if (not (bolp)) (newline))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8468 (beginning-of-line 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8469 (org-paste-subtree (1+ level) txt))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8470 (t
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8471 ;; 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
8472 ;; org-paste-subtree or from prefix arg
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8473 (org-paste-subtree current-prefix-arg txt)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8474 (when remember-save-after-remembering
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8475 (save-buffer)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8476 (if (not visiting) (kill-buffer (current-buffer)))))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8477 t) ;; return t to indicate that we took care of this note.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8478
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8479 (defun org-get-org-file ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8480 "Read a filename, with default directory `org-directory'."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8481 (let ((default (or org-default-notes-file remember-data-file)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8482 (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
8483 (file-name-as-directory org-directory)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8484 default)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8485
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8486 (defun org-notes-order-reversed-p ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8487 "Check if the current file should receive notes in reversed order."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8488 (cond
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8489 ((not org-reverse-note-order) nil)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8490 ((eq t org-reverse-note-order) t)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8491 ((not (listp org-reverse-note-order)) nil)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8492 (t (catch 'exit
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8493 (let ((all org-reverse-note-order)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8494 entry)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8495 (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
8496 (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
8497 (throw 'exit (cdr entry))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8498 nil)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8499
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8500 ;;; Tables
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8501
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8502 ;; Watch out: Here we are talking about two different kind of tables.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8503 ;; 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
8504 ;; Sometimes, we talk about tables created and edited with the table.el
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8505 ;; Emacs package. We call the former org-type tables, and the latter
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8506 ;; table.el-type tables.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8507
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8508
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8509 (defun org-before-change-function (beg end)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8510 "Every change indicates that a table might need an update."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8511 (setq org-table-may-need-update t))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8512
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8513 (defconst org-table-line-regexp "^[ \t]*|"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8514 "Detects an org-type table line.")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8515 (defconst org-table-dataline-regexp "^[ \t]*|[^-]"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8516 "Detects an org-type table line.")
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
8517 (defconst org-table-auto-recalculate-regexp "^[ \t]*| *# *\\(|\\|$\\)"
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
8518 "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
8519 (defconst org-table-recalculate-regexp "^[ \t]*| *[#*] *\\(|\\|$\\)"
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
8520 "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
8521 (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
8522 "Detects a table line marked for automatic recalculation.")
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8523 (defconst org-table-hline-regexp "^[ \t]*|-"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8524 "Detects an org-type table hline.")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8525 (defconst org-table1-hline-regexp "^[ \t]*\\+-[-+]"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8526 "Detects a table-type table hline.")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8527 (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
8528 "Detects an org-type or table-type table.")
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8529 (defconst org-table-border-regexp "^[ \t]*[^| \t]"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8530 "Searching from within a table (any type) this finds the first line
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8531 outside the table.")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8532 (defconst org-table-any-border-regexp "^[ \t]*[^|+ \t]"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8533 "Searching from within a table (any type) this finds the first line
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8534 outside the table.")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8535
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8536 (defun org-table-create-with-table.el ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8537 "Use the table.el package to insert a new table.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8538 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
8539 and table.el tables."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8540 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8541 (require 'table)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8542 (cond
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8543 ((org-at-table.el-p)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8544 (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
8545 (org-table-convert)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8546 ((org-at-table-p)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8547 (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
8548 (org-table-convert)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8549 (t (call-interactively 'table-insert))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8550
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8551 (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
8552 "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
8553 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
8554 region, create an empty table."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8555 (interactive "P")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8556 (if (org-region-active-p)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8557 (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
8558 (org-table-create arg)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8559
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8560 (defun org-table-create (&optional size)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8561 "Query for a size and insert a table skeleton.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8562 SIZE is a string Columns x Rows like for example \"3x2\"."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8563 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8564 (unless size
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8565 (setq size (read-string
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8566 (concat "Table size Columns x Rows [e.g. "
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8567 org-table-default-size "]: ")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8568 "" nil org-table-default-size)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8569
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8570 (let* ((pos (point))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8571 (indent (make-string (current-column) ?\ ))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8572 (split (org-split-string size " *x *"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8573 (rows (string-to-number (nth 1 split)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8574 (columns (string-to-number (car split)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8575 (line (concat (apply 'concat indent "|" (make-list columns " |"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8576 "\n")))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8577 (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
8578 (point-at-bol) (point)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8579 (beginning-of-line 1)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8580 (newline))
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
8581 ;; (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
8582 (dotimes (i rows) (insert line))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8583 (goto-char pos)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8584 (if (> rows 1)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8585 ;; Insert a hline after the first row.
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8586 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8587 (end-of-line 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8588 (insert "\n|-")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8589 (goto-char pos)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8590 (org-table-align)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8591
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8592 (defun org-table-convert-region (beg0 end0 &optional nspace)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8593 "Convert region to a table.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8594 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
8595 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
8596 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
8597 separate columns (default: just one space)."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8598 (interactive "rP")
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8599 (let* ((beg (min beg0 end0))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8600 (end (max beg0 end0))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8601 (tabsep t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8602 re)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8603 (goto-char beg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8604 (beginning-of-line 1)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8605 (setq beg (move-marker (make-marker) (point)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8606 (goto-char end)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8607 (if (bolp) (backward-char 1) (end-of-line 1))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8608 (setq end (move-marker (make-marker) (point)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8609 ;; Lets see if this is tab-separated material. If every nonempty line
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8610 ;; contains a tab, we will assume that it is tab-separated material
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8611 (if nspace
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8612 (setq tabsep nil)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8613 (goto-char beg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8614 (and (re-search-forward "^[^\n\t]+$" end t) (setq tabsep nil)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8615 (if nspace (setq tabsep nil))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8616 (if tabsep
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8617 (setq re "^\\|\t")
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8618 (setq re (format "^ *\\| *\t *\\| \\{%d,\\}"
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8619 (max 1 (prefix-numeric-value nspace)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8620 (goto-char beg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8621 (while (re-search-forward re end t)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8622 (replace-match "|" t t))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8623 (goto-char beg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8624 (insert " ")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8625 (org-table-align)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8626
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8627 (defun org-table-import (file arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8628 "Import FILE as a table.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8629 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
8630 spreadsheet and database applications. If no tabs (at least one per line)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8631 are found, lines will be split on whitespace into fields."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8632 (interactive "f\nP")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8633 (or (bolp) (newline))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8634 (let ((beg (point))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8635 (pm (point-max)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8636 (insert-file-contents file)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8637 (org-table-convert-region beg (+ (point) (- (point-max) pm)) arg)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8638
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8639 (defun org-table-export ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8640 "Export table as a tab-separated file.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8641 Such a file can be imported into a spreadsheet program like Excel."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8642 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8643 (let* ((beg (org-table-begin))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8644 (end (org-table-end))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8645 (table (buffer-substring beg end))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8646 (file (read-file-name "Export table to: "))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8647 buf)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8648 (unless (or (not (file-exists-p file))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8649 (y-or-n-p (format "Overwrite file %s? " file)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8650 (error "Abort"))
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
8651 (with-current-buffer (find-file-noselect file)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8652 (setq buf (current-buffer))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8653 (erase-buffer)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8654 (fundamental-mode)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8655 (insert table)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8656 (goto-char (point-min))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8657 (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
8658 (replace-match "" t t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8659 (end-of-line 1))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8660 (goto-char (point-min))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8661 (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
8662 (replace-match "" t t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8663 (goto-char (min (1+ (point)) (point-max))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8664 (goto-char (point-min))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8665 (while (re-search-forward "^-[-+]*$" nil t)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8666 (replace-match "")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8667 (if (looking-at "\n")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8668 (delete-char 1)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8669 (goto-char (point-min))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8670 (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
8671 (replace-match "\t" t t))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8672 (save-buffer))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8673 (kill-buffer buf)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8674
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
8675 (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
8676 "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
8677 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
8678 (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
8679 "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
8680 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
8681 (defvar org-table-last-alignment nil
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
8682 "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
8683 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
8684 (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
8685 "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
8686 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
8687
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
8688 (defvar org-last-recalc-line nil)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8689 (defconst org-narrow-column-arrow "=>"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8690 "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
8691
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
8692 (defun org-table-align ()
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8693 "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
8694 (interactive)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8695 (let* (
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8696 ;; Limits of table
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8697 (beg (org-table-begin))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8698 (end (org-table-end))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8699 ;; Current cursor position
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8700 (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
8701 (colpos (org-table-current-column))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8702 (winstart (window-start))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8703 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
8704 column
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8705 (indent "") cnt frac
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8706 rfmt hfmt
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8707 (spaces '(1 . 1))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8708 (sp1 (car spaces))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8709 (sp2 (cdr spaces))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8710 (rfmt1 (concat
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8711 (make-string sp2 ?\ ) "%%%s%ds" (make-string sp1 ?\ ) "|"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8712 (hfmt1 (concat
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8713 (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
8714 emptystrings xx links narrow fmax fmin f1 len c e)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8715 (untabify beg end)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8716 (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
8717 ;; Check if we have links
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8718 (goto-char beg)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8719 (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
8720 ;; 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
8721 (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
8722 ;; Check if we are narrowing any columns
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8723 (goto-char beg)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8724 (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
8725 (re-search-forward "<[0-9]+>" end t)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8726 ;; Get the rows
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8727 (setq lines (org-split-string
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8728 (buffer-substring beg end) "\n"))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8729 ;; Store the indentation of the first line
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8730 (if (string-match "^ *" (car lines))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8731 (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
8732 ;; 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
8733 ;; 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
8734 (setq lines (mapcar (lambda (l)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8735 (if (string-match "^ *|-" l)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8736 nil
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8737 (if (string-match "[ \t]+$" l)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8738 (substring l 0 (match-beginning 0))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8739 l)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8740 lines))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8741 ;; Get the data fields by splitting the lines.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8742 (setq fields (mapcar
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8743 (lambda (l)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8744 (org-split-string l " *| *"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8745 (delq nil (copy-sequence lines))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8746 ;; How many fields in the longest line?
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8747 (condition-case nil
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8748 (setq maxfields (apply 'max (mapcar 'length fields)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8749 (error
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8750 (kill-region beg end)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8751 (org-table-create org-table-default-size)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8752 (error "Empty table - created default table")))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8753 ;; A list of empty string to fill any short rows on output
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8754 (setq emptystrings (make-list maxfields ""))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8755 ;; Check for special formatting.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8756 (setq i -1)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8757 (while (< (setq i (1+ i)) maxfields) ;; Loop over all columns
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8758 (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
8759 ;; 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
8760 (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
8761 (setq c column fmax nil)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8762 (while c
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8763 (setq e (pop c))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8764 (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
8765 (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
8766 ;; 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
8767 (when fmax
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8768 (loop for xx in column do
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8769 (when (and (stringp xx)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8770 (> (org-string-width xx) fmax))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8771 (org-add-props xx nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8772 'help-echo
70064
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
8773 (concat "Clipped table field, use C-c ` to edit. Full value is:\n" (org-no-properties (copy-sequence xx))))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8774 (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
8775 (unless (> f1 1)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8776 (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
8777 (match-string 0 xx)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8778 (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
8779 (add-text-properties (- f1 2) f1
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8780 (list 'display org-narrow-column-arrow)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8781 xx)))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8782 ;; Get the maximum width for each column
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8783 (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
8784 ;; 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
8785 (setq cnt 0 frac 0.0)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8786 (loop for x in column do
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8787 (if (equal x "")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8788 nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8789 (setq frac ( / (+ (* frac cnt)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8790 (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
8791 (setq cnt (1+ cnt))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8792 (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
8793 (setq lengths (nreverse lengths) typenums (nreverse typenums))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8794
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8795 ;; 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
8796 (setq org-table-last-alignment typenums
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8797 org-table-last-column-widths lengths)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8798
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8799 ;; 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
8800 ;; 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
8801 (when links
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8802 (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
8803 (setq len (nth i lengths))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8804 (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
8805 (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
8806 (if (and (stringp (car c))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8807 (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
8808 (< (org-string-width (car c)) len))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8809 (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
8810
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8811 ;; Compute the formats needed for output of the table
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8812 (setq rfmt (concat indent "|") hfmt (concat indent "|"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8813 (while (setq l (pop lengths))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8814 (setq ty (if (pop typenums) "" "-")) ; number types flushright
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8815 (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
8816 hfmt (concat hfmt (format hfmt1 (make-string l ?-)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8817 (setq rfmt (concat rfmt "\n")
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8818 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
8819
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
8820 (setq new (mapconcat
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8821 (lambda (l)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8822 (if l (apply 'format rfmt
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8823 (append (pop fields) emptystrings))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8824 hfmt))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8825 lines ""))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8826 ;; Replace the old one
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8827 (delete-region beg end)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8828 (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
8829 (move-marker org-table-aligned-begin-marker (point))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8830 (insert new)
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
8831 (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
8832 (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
8833 (goto-char org-table-aligned-begin-marker)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8834 (while (org-hide-wide-columns org-table-aligned-end-marker)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8835 ;; Try to move to the old location (approximately)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8836 (goto-line linepos)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8837 (set-window-start (selected-window) winstart 'noforce)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8838 (org-table-goto-column colpos)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8839 (setq org-table-may-need-update nil)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8840 ))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8841
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8842 (defun org-string-width (s)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8843 "Compute width of string, ignoring invisible characters.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8844 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
8845 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
8846 upon the next fontification round."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8847 (let (b)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8848 (when (or (eq t buffer-invisibility-spec)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8849 (assq 'org-link buffer-invisibility-spec))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8850 (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
8851 'invisible 'org-link s))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8852 (setq s (concat (substring s 0 b)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8853 (substring s (or (next-single-property-change
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8854 b 'invisible s) (length s)))))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8855 (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
8856 (setq s (concat (substring s 0 b)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8857 (substring s (or (next-single-property-change
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8858 b 'org-cwidth s) (length s))))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8859 (string-width s)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8860
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8861 (defun org-table-begin (&optional table-type)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8862 "Find the beginning of the table and return its position.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8863 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
8864 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8865 (if (not (re-search-backward
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8866 (if table-type org-table-any-border-regexp
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8867 org-table-border-regexp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8868 nil t))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8869 (error "Can't find beginning of table")
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8870 (goto-char (match-beginning 0))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8871 (beginning-of-line 2)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8872 (point))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8873
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8874 (defun org-table-end (&optional table-type)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8875 "Find the end of the table and return its position.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8876 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
8877 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8878 (if (not (re-search-forward
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8879 (if table-type org-table-any-border-regexp
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8880 org-table-border-regexp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8881 nil t))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8882 (goto-char (point-max))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8883 (goto-char (match-beginning 0)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8884 (point-marker)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8885
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8886 (defun org-table-justify-field-maybe (&optional new)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8887 "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
8888 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
8889 (cond
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8890 ((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
8891 ((org-at-table-hline-p))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8892 ((and (not new)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8893 (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
8894 (current-buffer)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8895 (< (point) org-table-aligned-begin-marker)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8896 (>= (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
8897 ;; 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
8898 (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
8899 (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
8900 (let* ((pos (point)) s
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8901 (col (org-table-current-column))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8902 (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
8903 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
8904 (when (> col 0)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8905 (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
8906 (if (looking-at " *\\([^|\n]*?\\) *\\(|\\|$\\)")
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 s (match-string 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8909 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
8910 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
8911 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
8912 (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
8913 l (if e "|" (setq org-table-may-need-update t) ""))
70161
b9e09a4a2168 (org-mode-map): Catch conflict with old allout.el.
Carsten Dominik <dominik@science.uva.nl>
parents: 70136
diff changeset
8914 n (format f s))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8915 (if new
70161
b9e09a4a2168 (org-mode-map): Catch conflict with old allout.el.
Carsten Dominik <dominik@science.uva.nl>
parents: 70136
diff changeset
8916 (if (<= (length new) l) ;; FIXME: length -> str-width?
b9e09a4a2168 (org-mode-map): Catch conflict with old allout.el.
Carsten Dominik <dominik@science.uva.nl>
parents: 70136
diff changeset
8917 (setq n (format f new t t)) ;; FIXME: t t?
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8918 (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
8919 (or (equal n o)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8920 (let (org-table-may-need-update)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8921 (replace-match n))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8922 (setq org-table-may-need-update t))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8923 (goto-char pos))))))
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
8924
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
8925 (defun org-table-next-field ()
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
8926 "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
8927 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
8928 (interactive)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
8929 (org-table-maybe-eval-formula)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
8930 (org-table-maybe-recalculate-line)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8931 (if (and org-table-automatic-realign
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8932 org-table-may-need-update)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8933 (org-table-align))
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
8934 (let ((end (org-table-end)))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
8935 (if (org-at-table-hline-p)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
8936 (end-of-line 1))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
8937 (condition-case nil
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
8938 (progn
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
8939 (re-search-forward "|" end)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
8940 (if (looking-at "[ \t]*$")
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
8941 (re-search-forward "|" end))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
8942 (if (and (looking-at "-")
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
8943 org-table-tab-jumps-over-hlines
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
8944 (re-search-forward "^[ \t]*|\\([^-]\\)" end t))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
8945 (goto-char (match-beginning 1)))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
8946 (if (looking-at "-")
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
8947 (progn
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
8948 (beginning-of-line 0)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
8949 (org-table-insert-row 'below))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
8950 (if (looking-at " ") (forward-char 1))))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
8951 (error
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
8952 (org-table-insert-row 'below)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8953
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
8954 (defun org-table-previous-field ()
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8955 "Go to the previous field in the table.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8956 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
8957 (interactive)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
8958 (org-table-justify-field-maybe)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
8959 (org-table-maybe-recalculate-line)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8960 (if (and org-table-automatic-realign
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8961 org-table-may-need-update)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8962 (org-table-align))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8963 (if (org-at-table-hline-p)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8964 (end-of-line 1))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8965 (re-search-backward "|" (org-table-begin))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8966 (re-search-backward "|" (org-table-begin))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8967 (while (looking-at "|\\(-\\|[ \t]*$\\)")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8968 (re-search-backward "|" (org-table-begin)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8969 (if (looking-at "| ?")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8970 (goto-char (match-end 0))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8971
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
8972 (defun org-table-next-row ()
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8973 "Go to the next row (same column) in the current table.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8974 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
8975 (interactive)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
8976 (org-table-maybe-eval-formula)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
8977 (org-table-maybe-recalculate-line)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8978 (if (or (looking-at "[ \t]*$")
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8979 (save-excursion (skip-chars-backward " \t") (bolp)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8980 (newline)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8981 (if (and org-table-automatic-realign
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8982 org-table-may-need-update)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8983 (org-table-align))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8984 (let ((col (org-table-current-column)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8985 (beginning-of-line 2)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8986 (if (or (not (org-at-table-p))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8987 (org-at-table-hline-p))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8988 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8989 (beginning-of-line 0)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8990 (org-table-insert-row 'below)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8991 (org-table-goto-column col)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8992 (skip-chars-backward "^|\n\r")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8993 (if (looking-at " ") (forward-char 1)))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8994
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
8995 (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
8996 "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
8997 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
8998 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
8999 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
9000 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
9001 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
9002 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
9003 integer, it will be incremented while copying."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9004 (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
9005 (let* ((colpos (org-table-current-column))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9006 (field (org-table-get-field))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9007 (non-empty (string-match "[^ \t]" field))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9008 (beg (org-table-begin))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9009 txt)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9010 (org-table-check-inside-data-field)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9011 (if non-empty
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9012 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9013 (setq txt (org-trim field))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9014 (org-table-next-row)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9015 (org-table-blank-field))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9016 (save-excursion
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9017 (setq txt
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9018 (catch 'exit
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9019 (while (progn (beginning-of-line 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9020 (re-search-backward org-table-dataline-regexp
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9021 beg t))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9022 (org-table-goto-column colpos t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9023 (if (and (looking-at
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9024 "|[ \t]*\\([^| \t][^|]*?\\)[ \t]*|")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9025 (= (setq n (1- n)) 0))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9026 (throw 'exit (match-string 1))))))))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9027 (if txt
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9028 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9029 (if (and org-table-copy-increment
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9030 (string-match "^[0-9]+$" txt))
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
9031 (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
9032 (insert txt)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9033 (org-table-maybe-recalculate-line)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9034 (org-table-align))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9035 (error "No non-empty field found"))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9036
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9037 (defun org-table-check-inside-data-field ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9038 "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
9039 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
9040 This actually throws an error, so it aborts the current command."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9041 (if (or (not (org-at-table-p))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9042 (= (org-table-current-column) 0)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9043 (org-at-table-hline-p)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9044 (looking-at "[ \t]*$"))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9045 (error "Not in table data field")))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9046
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
9047 (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
9048 "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
9049
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9050 (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
9051 "Blank the current table field or active region."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9052 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9053 (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
9054 (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
9055 (let (org-table-clip)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9056 (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
9057 (skip-chars-backward "^|")
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
9058 (backward-char 1)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9059 (if (looking-at "|[^|\n]+")
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9060 (let* ((pos (match-beginning 0))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9061 (match (match-string 0))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9062 (len (org-string-width match)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9063 (replace-match (concat "|" (make-string (1- len) ?\ )))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9064 (goto-char (+ 2 pos))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9065 (substring match 1)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9066
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9067 (defun org-table-get-field (&optional n replace)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9068 "Return the value of the field in column N of current row.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9069 N defaults to current field.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9070 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
9071 is always the old value."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9072 (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
9073 (skip-chars-backward "^|\n")
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9074 (backward-char 1)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9075 (if (looking-at "|[^|\r\n]*")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9076 (let* ((pos (match-beginning 0))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9077 (val (buffer-substring (1+ pos) (match-end 0))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9078 (if replace
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9079 (replace-match (concat "|" replace)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9080 (goto-char (min (point-at-eol) (+ 2 pos)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9081 val)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9082 (forward-char 1) ""))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9083
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9084 (defun org-table-current-column ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9085 "Find out which column we are in.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9086 When called interactively, column is also displayed in echo area."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9087 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9088 (if (interactive-p) (org-table-check-inside-data-field))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9089 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9090 (let ((cnt 0) (pos (point)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9091 (beginning-of-line 1)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9092 (while (search-forward "|" pos t)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9093 (setq cnt (1+ cnt)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9094 (if (interactive-p) (message "This is table column %d" cnt))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9095 cnt)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9096
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9097 (defun org-table-goto-column (n &optional on-delim force)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9098 "Move the cursor to the Nth column in the current table line.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9099 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
9100 of the field.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9101 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
9102 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
9103 (interactive "p")
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9104 (let ((pos (point-at-eol)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9105 (beginning-of-line 1)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9106 (when (> n 0)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9107 (while (and (> (setq n (1- n)) -1)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9108 (or (search-forward "|" pos t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9109 (and force
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9110 (progn (end-of-line 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9111 (skip-chars-backward "^|")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9112 (insert " | "))))))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9113 ; (backward-char 2) t)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9114 (when (and force (not (looking-at ".*|")))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9115 (save-excursion (end-of-line 1) (insert " | ")))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9116 (if on-delim
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9117 (backward-char 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9118 (if (looking-at " ") (forward-char 1))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9119
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9120 (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
9121 "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
9122 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
9123 (if org-enable-table-editor
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9124 (save-excursion
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9125 (beginning-of-line 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9126 (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
9127 org-table-line-regexp)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9128 nil))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9129
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9130 (defun org-at-table.el-p ()
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9131 "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
9132 (and (org-at-table-p 'any)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9133 (save-excursion
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9134 (goto-char (org-table-begin 'any))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9135 (looking-at org-table1-hline-regexp))))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9136
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9137 (defun org-table-recognize-table.el ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9138 "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
9139 (if org-table-tab-recognizes-table.el
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9140 (if (org-at-table.el-p)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9141 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9142 (beginning-of-line 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9143 (if (looking-at org-table-dataline-regexp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9144 nil
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9145 (if (looking-at org-table1-hline-regexp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9146 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9147 (beginning-of-line 2)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9148 (if (looking-at org-table-any-border-regexp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9149 (beginning-of-line -1)))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9150 (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
9151 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9152 (require 'table)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9153 (if (table--at-cell-p (point))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9154 t
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9155 (message "recognizing table.el table...")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9156 (table-recognize-table)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9157 (message "recognizing table.el table...done")))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9158 (error "This should not happen..."))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9159 t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9160 nil)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9161 nil))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9162
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9163 (defun org-at-table-hline-p ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9164 "Return t if the cursor is inside a hline in a table."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9165 (if org-enable-table-editor
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9166 (save-excursion
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9167 (beginning-of-line 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9168 (looking-at org-table-hline-regexp))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9169 nil))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9170
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
9171 (defun org-table-insert-column ()
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9172 "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
9173 (interactive)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9174 (if (not (org-at-table-p))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9175 (error "Not at a table"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9176 (org-table-find-dataline)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9177 (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
9178 (beg (org-table-begin))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9179 (end (org-table-end))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9180 ;; Current cursor position
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9181 (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
9182 (colpos col))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9183 (goto-char beg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9184 (while (< (point) end)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9185 (if (org-at-table-hline-p)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9186 nil
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9187 (org-table-goto-column col t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9188 (insert "| "))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9189 (beginning-of-line 2))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9190 (move-marker end nil)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9191 (goto-line linepos)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9192 (org-table-goto-column colpos)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9193 (org-table-align)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9194 (org-table-modify-formulas 'insert col)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9195
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9196 (defun org-table-find-dataline ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9197 "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
9198 (if (and (org-at-table-p)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9199 (not (org-at-table-hline-p)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9200 t
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9201 (let ((col (current-column))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9202 (end (org-table-end)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9203 (move-to-column col)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9204 (while (and (< (point) end)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9205 (or (not (= (current-column) col))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9206 (org-at-table-hline-p)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9207 (beginning-of-line 2)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9208 (move-to-column col))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9209 (if (and (org-at-table-p)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9210 (not (org-at-table-hline-p)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9211 t
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9212 (error
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9213 "Please position cursor in a data line for column operations")))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9214
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
9215 (defun org-table-delete-column ()
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
9216 "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
9217 (interactive)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9218 (if (not (org-at-table-p))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9219 (error "Not at a table"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9220 (org-table-find-dataline)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9221 (org-table-check-inside-data-field)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9222 (let* ((col (org-table-current-column))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9223 (beg (org-table-begin))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9224 (end (org-table-end))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9225 ;; Current cursor position
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9226 (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
9227 (colpos col))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9228 (goto-char beg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9229 (while (< (point) end)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9230 (if (org-at-table-hline-p)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9231 nil
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9232 (org-table-goto-column col t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9233 (and (looking-at "|[^|\n]+|")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9234 (replace-match "|")))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9235 (beginning-of-line 2))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9236 (move-marker end nil)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9237 (goto-line linepos)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9238 (org-table-goto-column colpos)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9239 (org-table-align)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9240 (org-table-modify-formulas 'remove col)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9241
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
9242 (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
9243 "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
9244 (interactive)
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
9245 (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
9246 (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
9247 "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
9248 (interactive)
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
9249 (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
9250
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9251 (defun org-table-move-column (&optional left)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9252 "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
9253 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9254 (if (not (org-at-table-p))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9255 (error "Not at a table"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9256 (org-table-find-dataline)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9257 (org-table-check-inside-data-field)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9258 (let* ((col (org-table-current-column))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9259 (col1 (if left (1- col) col))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9260 (beg (org-table-begin))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9261 (end (org-table-end))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9262 ;; Current cursor position
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9263 (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
9264 (colpos (if left (1- col) (1+ col))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9265 (if (and left (= col 1))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9266 (error "Cannot move column further left"))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9267 (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
9268 (error "Cannot move column further right"))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9269 (goto-char beg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9270 (while (< (point) end)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9271 (if (org-at-table-hline-p)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9272 nil
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9273 (org-table-goto-column col1 t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9274 (and (looking-at "|\\([^|\n]+\\)|\\([^|\n]+\\)|")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9275 (replace-match "|\\2|\\1|")))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9276 (beginning-of-line 2))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9277 (move-marker end nil)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9278 (goto-line linepos)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9279 (org-table-goto-column colpos)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9280 (org-table-align)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9281 (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
9282
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
9283 (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
9284 "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
9285 (interactive)
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
9286 (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
9287 (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
9288 "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
9289 (interactive)
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
9290 (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
9291
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9292 (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
9293 "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
9294 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9295 (let ((col (current-column))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9296 (pos (point))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9297 (tonew (if up 0 2))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9298 txt)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9299 (beginning-of-line tonew)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9300 (if (not (org-at-table-p))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9301 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9302 (goto-char pos)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9303 (error "Cannot move row further")))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9304 (goto-char pos)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9305 (beginning-of-line 1)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9306 (setq pos (point))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9307 (setq txt (buffer-substring (point) (1+ (point-at-eol))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9308 (delete-region (point) (1+ (point-at-eol)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9309 (beginning-of-line tonew)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9310 (insert txt)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9311 (beginning-of-line 0)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9312 (move-to-column col)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9313
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9314 (defun org-table-insert-row (&optional arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9315 "Insert a new row above the current line into the table.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9316 With prefix ARG, insert below the current line."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9317 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9318 (if (not (org-at-table-p))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9319 (error "Not at a table"))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9320 (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
9321 (new (org-table-clean-line line)))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9322 ;; Fix the first field if necessary
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9323 (if (string-match "^[ \t]*| *[#$] *|" line)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9324 (setq new (replace-match (match-string 0 line) t t new)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9325 (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
9326 (let (org-table-may-need-update) (insert-before-markers new "\n"))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9327 (beginning-of-line 0)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9328 (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
9329 (and org-table-may-need-update (org-table-align))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9330
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9331 (defun org-table-insert-hline (&optional arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9332 "Insert a horizontal-line below the current line into the table.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9333 With prefix ARG, insert above the current line."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9334 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9335 (if (not (org-at-table-p))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9336 (error "Not at a table"))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9337 (let ((line (org-table-clean-line
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9338 (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
9339 (col (current-column)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9340 (while (string-match "|\\( +\\)|" line)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9341 (setq line (replace-match
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9342 (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
9343 ?-) "|") t t line)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9344 (and (string-match "\\+" line) (setq line (replace-match "|" t t line)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9345 (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
9346 (insert line "\n")
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
9347 (beginning-of-line (if arg 1 -1))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9348 (move-to-column col)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9349
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9350 (defun org-table-clean-line (s)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9351 "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
9352 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
9353 (if (string-match "^[ \t]*|-" s)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9354 ;; 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
9355 (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
9356 (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
9357 (setq s (replace-match
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9358 (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
9359 ?\ ) "|")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9360 t t s)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9361 s))
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
9362
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
9363 (defun org-table-kill-row ()
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9364 "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
9365 (interactive)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9366 (if (not (org-at-table-p))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9367 (error "Not at a table"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9368 (let ((col (current-column)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9369 (kill-region (point-at-bol) (min (1+ (point-at-eol)) (point-max)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9370 (if (not (org-at-table-p)) (beginning-of-line 0))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9371 (move-to-column col)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9372
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9373 (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
9374 "Sort table lines in region.
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9375 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
9376 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
9377 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
9378 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
9379 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
9380 \(n for numerical, a for alphanumeric)."
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9381 (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
9382 (setq numericp (string-match "[nN]" numericp))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9383 (org-table-align) ;; Just to be safe
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9384 (let* (bcol ecol cmp column lns)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9385 (goto-char beg)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9386 (org-table-check-inside-data-field)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9387 (setq column (org-table-current-column)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9388 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
9389 (goto-char end)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9390 (org-table-check-inside-data-field)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9391 (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
9392 (untabify beg end)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9393 (goto-char beg)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9394 (org-table-goto-column column)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9395 (skip-chars-backward "^|")
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9396 (setq bcol (current-column))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9397 (org-table-goto-column (1+ column))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9398 (skip-chars-backward "^|")
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9399 (setq ecol (1- (current-column)))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9400 (setq cmp (if numericp
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9401 (lambda (a b) (< (car a) (car b)))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9402 (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
9403 (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
9404 (split-string (buffer-substring beg end) "\n")))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9405 (if numericp
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9406 (setq lns (mapcar (lambda(x)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9407 (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
9408 lns)))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9409 (delete-region beg end)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9410 (move-marker beg nil)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9411 (move-marker end nil)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9412 (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
9413 (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
9414 (length lns)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9415 (if numericp "numerically" "alphabetically") column)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9416
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9417 (defun org-table-cut-region (beg end)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9418 "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
9419 (interactive "r")
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9420 (org-table-copy-region beg end 'cut))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9421
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9422 (defun org-table-copy-region (beg end &optional cut)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9423 "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
9424 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
9425 with `org-table-paste-rectangle'."
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9426 (interactive "rP")
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9427 (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
9428 region cols
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9429 (rpl (if cut " " nil)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9430 (goto-char beg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9431 (org-table-check-inside-data-field)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9432 (setq l01 (count-lines (point-min) (point))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9433 c01 (org-table-current-column))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9434 (goto-char end)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9435 (org-table-check-inside-data-field)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9436 (setq l02 (count-lines (point-min) (point))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9437 c02 (org-table-current-column))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9438 (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
9439 c1 (min c01 c02) c2 (max c01 c02))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9440 (catch 'exit
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9441 (while t
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9442 (catch 'nextline
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9443 (if (> l1 l2) (throw 'exit t))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9444 (goto-line l1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9445 (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
9446 (setq cols nil ic1 c1 ic2 c2)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9447 (while (< ic1 (1+ ic2))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9448 (push (org-table-get-field ic1 rpl) cols)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9449 (setq ic1 (1+ ic1)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9450 (push (nreverse cols) region)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9451 (setq l1 (1+ l1)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9452 (setq org-table-clip (nreverse region))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9453 (if cut (org-table-align))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9454 org-table-clip))
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
9455
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
9456 (defun org-table-paste-rectangle ()
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
9457 "Paste a rectangular region into a table.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9458 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
9459 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
9460 the table is enlarged as needed. The process ignores horizontal separator
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9461 lines."
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
9462 (interactive)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9463 (unless (and org-table-clip (listp org-table-clip))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9464 (error "First cut/copy a region to paste!"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9465 (org-table-check-inside-data-field)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9466 (let* ((clip org-table-clip)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9467 (line (count-lines (point-min) (point)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9468 (col (org-table-current-column))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9469 (org-enable-table-editor t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9470 (org-table-automatic-realign nil)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9471 c cols field)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9472 (while (setq cols (pop clip))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9473 (while (org-at-table-hline-p) (beginning-of-line 2))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9474 (if (not (org-at-table-p))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9475 (progn (end-of-line 0) (org-table-next-field)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9476 (setq c col)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9477 (while (setq field (pop cols))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9478 (org-table-goto-column c nil 'force)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9479 (org-table-get-field nil field)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9480 (setq c (1+ c)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9481 (beginning-of-line 2))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9482 (goto-line line)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9483 (org-table-goto-column col)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9484 (org-table-align)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9485
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9486 (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
9487 "Convert from `org-mode' table to table.el and back.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9488 Obviously, this only works within limits. When an Org-mode table is
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9489 converted to table.el, all horizontal separator lines get lost, because
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9490 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
9491 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
9492 do row or column spanning. Multiline cells will become multiple cells.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9493 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
9494 blindly applies a recipe that works for simple tables."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9495 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9496 (require 'table)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9497 (if (org-at-table.el-p)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9498 ;; convert to Org-mode table
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9499 (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
9500 (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
9501 (table-unrecognize-region beg end)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9502 (goto-char beg)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9503 (while (re-search-forward "^\\([ \t]*\\)\\+-.*\n" end t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9504 (replace-match ""))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9505 (goto-char beg))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9506 (if (org-at-table-p)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9507 ;; convert to table.el table
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9508 (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
9509 (end (move-marker (make-marker) (org-table-end))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9510 ;; first, get rid of all horizontal lines
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9511 (goto-char beg)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9512 (while (re-search-forward "^\\([ \t]*\\)|-.*\n" end t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9513 (replace-match ""))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9514 ;; insert a hline before first
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9515 (goto-char beg)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9516 (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
9517 (beginning-of-line -1)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9518 ;; 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
9519 (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
9520 (org-table-insert-hline))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9521 (goto-char beg)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9522 (setq end (move-marker end (org-table-end)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9523 ;; replace "+" at beginning and ending of hlines
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9524 (while (re-search-forward "^\\([ \t]*\\)|-" end t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9525 (replace-match "\\1+-"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9526 (goto-char beg)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9527 (while (re-search-forward "-|[ \t]*$" end t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9528 (replace-match "-+"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9529 (goto-char beg)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9530
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9531 (defun org-table-wrap-region (arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9532 "Wrap several fields in a column like a paragraph.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9533 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
9534 lines, in order to keep the table compact.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9535
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9536 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
9537 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
9538 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
9539 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
9540 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
9541 lines, the remaining lines remain empty. A negative prefix argument reduces
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9542 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
9543 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
9544 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
9545 the table first.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9546
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9547 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
9548 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
9549 line down.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9550
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9551 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
9552 blank, and the content is appended to the field above."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9553 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9554 (org-table-check-inside-data-field)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9555 (if (org-region-active-p)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9556 ;; There is a region: fill as a paragraph
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9557 (let ((beg (region-beginning))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9558 nlines)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9559 (org-table-cut-region (region-beginning) (region-end))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9560 (if (> (length (car org-table-clip)) 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9561 (error "Region must be limited to single column"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9562 (setq nlines (if arg
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9563 (if (< arg 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9564 (+ (length org-table-clip) arg)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9565 arg)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9566 (length org-table-clip)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9567 (setq org-table-clip
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9568 (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
9569 nil nlines)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9570 (goto-char beg)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9571 (org-table-paste-rectangle))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9572 ;; No region, split the current field at point
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9573 (if arg
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9574 ;; combine with field above
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9575 (let ((s (org-table-blank-field))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9576 (col (org-table-current-column)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9577 (beginning-of-line 0)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9578 (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
9579 (org-table-goto-column col)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9580 (skip-chars-forward "^|")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9581 (skip-chars-backward " ")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9582 (insert " " (org-trim s))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9583 (org-table-align))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9584 ;; split field
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9585 (when (looking-at "\\([^|]+\\)+|")
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9586 (let ((s (match-string 1)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9587 (replace-match " |")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9588 (goto-char (match-beginning 0))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9589 (org-table-next-row)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9590 (insert (org-trim s) " ")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9591 (org-table-align))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9592
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9593 (defvar org-field-marker nil)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9594
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9595 (defun org-table-edit-field (arg)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9596 "Edit table field in a different window.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9597 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
9598 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
9599 it can be edited in place."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9600 (interactive "P")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9601 (if arg
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9602 (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
9603 (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
9604 (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
9605 display t intangible t))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9606 (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
9607 (font-lock-fontify-block)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9608 (let ((pos (move-marker (make-marker) (point)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9609 (field (org-table-get-field))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9610 (cw (current-window-configuration))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9611 p)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9612 (switch-to-buffer-other-window "*Org tmp*")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9613 (erase-buffer)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9614 (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
9615 (org-mode)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9616 (goto-char (setq p (point-max)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9617 (insert (org-trim field))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9618 (remove-text-properties p (point-max)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9619 '(invisible t org-cwidth t display t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9620 intangible t))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9621 (goto-char p)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9622 (set (make-local-variable 'org-finish-function)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9623 'org-table-finish-edit-field)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9624 (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
9625 (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
9626 (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
9627
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9628 (defun org-table-finish-edit-field ()
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9629 "Finish editing a table data field.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9630 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
9631 the table and kill the editing buffer."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9632 (let ((pos org-field-marker)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9633 (cw org-window-configuration)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9634 (cb (current-buffer))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9635 text)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9636 (goto-char (point-min))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9637 (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
9638 (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
9639 (replace-match " "))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9640 (setq text (org-trim (buffer-string)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9641 (set-window-configuration cw)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9642 (kill-buffer cb)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9643 (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
9644 (goto-char pos)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9645 (move-marker pos nil)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9646 (org-table-check-inside-data-field)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9647 (org-table-get-field nil text)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9648 (org-table-align)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9649 (message "New field value inserted")))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9650
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9651 (defun org-trim (s)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9652 "Remove whitespace at beginning and end of string."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9653 (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
9654 (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
9655 s)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9656
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9657 (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
9658 "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
9659 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
9660 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
9661 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
9662 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
9663 many lines, whatever width that takes.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9664 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
9665 (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
9666 (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
9667 w ll)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9668 (cond (width
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9669 (org-do-wrap words (max maxword width)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9670 (lines
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9671 (setq w maxword)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9672 (setq ll (org-do-wrap words maxword))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9673 (if (<= (length ll) lines)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9674 ll
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9675 (setq ll words)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9676 (while (> (length ll) lines)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9677 (setq w (1+ w))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9678 (setq ll (org-do-wrap words w)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9679 ll))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9680 (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
9681
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9682
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9683 (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
9684 "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
9685 (let (lines line)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9686 (while words
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9687 (setq line (pop words))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9688 (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
9689 (setq line (concat line " " (pop words))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9690 (setq lines (push line lines)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9691 (nreverse lines)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9692
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9693 (defun org-split-string (string &optional separators)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9694 "Splits STRING into substrings at SEPARATORS.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9695 No empty strings are returned if there are matches at the beginning
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9696 and end of string."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9697 (let ((rexp (or separators "[ \f\t\n\r\v]+"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9698 (start 0)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9699 notfirst
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9700 (list nil))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9701 (while (and (string-match rexp string
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9702 (if (and notfirst
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9703 (= start (match-beginning 0))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9704 (< start (length string)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9705 (1+ start) start))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9706 (< (match-beginning 0) (length string)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9707 (setq notfirst t)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9708 (or (eq (match-beginning 0) 0)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9709 (and (eq (match-beginning 0) (match-end 0))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9710 (eq (match-beginning 0) start))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9711 (setq list
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9712 (cons (substring string start (match-beginning 0))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9713 list)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9714 (setq start (match-end 0)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9715 (or (eq start (length string))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9716 (setq list
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9717 (cons (substring string start)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9718 list)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9719 (nreverse list)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9720
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9721 (defun org-table-map-tables (function)
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
9722 "Apply FUNCTION to the start of all tables in the buffer."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9723 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9724 (save-restriction
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9725 (widen)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9726 (goto-char (point-min))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9727 (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
9728 (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
9729 (beginning-of-line 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9730 (if (looking-at org-table-line-regexp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9731 (save-excursion (funcall function)))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9732 (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
9733 (message "Mapping tables: done"))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9734
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9735 (defun org-table-sum (&optional beg end nlast)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9736 "Sum numbers in region of current table column.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9737 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
9738 as kill to be inserted with \\[yank].
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9739
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9740 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
9741 numbers in that rectangle will be summed. If there is no active
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9742 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
9743 column.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9744
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
9745 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
9746 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
9747 numbers are added as such.
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9748
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9749 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
9750 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9751 (save-excursion
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9752 (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
9753 (cond
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9754 ((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
9755 ((org-region-active-p)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9756 (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
9757 (t
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9758 (setq col (org-table-current-column))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9759 (goto-char (org-table-begin))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9760 (unless (re-search-forward "^[ \t]*|[^-]" nil t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9761 (error "No table data"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9762 (org-table-goto-column col)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9763 ;not needed? (skip-chars-backward "^|")
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9764 (setq beg (point))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9765 (goto-char (org-table-end))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9766 (unless (re-search-backward "^[ \t]*|[^-]" nil t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9767 (error "No table data"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9768 (org-table-goto-column col)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9769 ;not needed? (skip-chars-forward "^|")
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9770 (setq end (point))))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9771 (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
9772 (items1 (cond ((not nlast) items)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9773 ((>= nlast (length items)) items)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9774 (t (setq items (reverse items))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9775 (setcdr (nthcdr (1- nlast) items) nil)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9776 (nreverse items))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9777 (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
9778 items1)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9779 (res (apply '+ numbers))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9780 (sres (if (= timecnt 0)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9781 (format "%g" res)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9782 (setq diff (* 3600 res)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9783 h (floor (/ diff 3600)) diff (mod diff 3600)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9784 m (floor (/ diff 60)) diff (mod diff 60)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9785 s diff)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9786 (format "%d:%02d:%02d" h m s))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9787 (kill-new sres)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9788 (if (interactive-p)
65705
7d20cbe1d616 (org-table-sum): Fix format string.
Juanma Barranquero <lekktu@gmail.com>
parents: 65654
diff changeset
9789 (message "%s"
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
9790 (substitute-command-keys
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
9791 (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
9792 (length numbers) sres))))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9793 sres))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9794
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9795 (defun org-table-get-number-for-summing (s)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9796 (let (n)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9797 (if (string-match "^ *|? *" s)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9798 (setq s (replace-match "" nil nil s)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9799 (if (string-match " *|? *$" s)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9800 (setq s (replace-match "" nil nil s)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9801 (setq n (string-to-number s))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9802 (cond
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9803 ((and (string-match "0" s)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9804 (string-match "\\`[-+ \t0.edED]+\\'" s)) 0)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9805 ((string-match "\\`[ \t]+\\'" s) nil)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9806 ((string-match "\\`\\([0-9]+\\):\\([0-9]+\\)\\(:\\([0-9]+\\)\\)?\\'" s)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9807 (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
9808 (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
9809 (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
9810 (if (boundp 'timecnt) (setq timecnt (1+ timecnt)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9811 (* 1.0 (+ h (/ m 60.0) (/ s 3600.0)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9812 ((equal n 0) nil)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9813 (t n))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9814
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9815 (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
9816 "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
9817 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
9818 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
9819 (save-excursion
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9820 (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
9821 (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
9822 (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
9823 (cond
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9824 ((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
9825 (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
9826 (if (match-beginning 3)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9827 (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
9828 (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
9829 (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
9830 (setq nn n)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9831 (while (and (> nn 0)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9832 (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
9833 (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
9834 (setq nn (1- nn)))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9835 (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
9836 (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
9837 (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
9838 (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
9839 (setq beg (point)))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9840 (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
9841 (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
9842 (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
9843 (setq end (point)))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9844 (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
9845 (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
9846 (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
9847 l ",") "]"))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9848 ((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
9849 (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
9850 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
9851 (beginning-of-line 1)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9852 (save-excursion
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9853 (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
9854 (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
9855 (setq beg (point))))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9856 (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
9857 (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
9858 (setq end (point)))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9859 (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
9860 (concat "[" (mapconcat
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9861 (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
9862 (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
9863 l ",") "]"))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9864 ((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
9865 (beginning-of-line 1)
65264
a95981ee377b (calc-embedded-close-formula, calc-embedded-open-formula,
Juanma Barranquero <lekktu@gmail.com>
parents: 65243
diff changeset
9866 (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
9867 (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
9868 (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
9869 (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
9870
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9871 (defvar org-table-formula-history nil)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9872
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9873 (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
9874 "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
9875 (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
9876 "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
9877 (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
9878 "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
9879 (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
9880 "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
9881
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9882 (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
9883 "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
9884 (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
9885 (org-table-current-column))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9886 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
9887 (scol (if named
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9888 (if name name
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9889 (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
9890 (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
9891 (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
9892 (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
9893 (error "Abort")))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9894 (org-table-may-need-update nil)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9895 (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
9896 (stored (cdr (assoc scol stored-list)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9897 (eq (cond
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
9898 ((and stored equation (string-match "^ *=? *$" equation))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9899 stored)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9900 ((stringp equation)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9901 equation)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9902 (t (read-string
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9903 (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
9904 (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
9905 ;stored
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9906 ))))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9907 mustsave)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9908 (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
9909 ;; remove formula
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9910 (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
9911 (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
9912 (error "Formula removed"))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9913 (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
9914 (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
9915 (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
9916 ;; 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
9917 (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
9918 mustsave t))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9919 (if stored
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9920 (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
9921 (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
9922 (if (or mustsave (not (equal stored eq)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9923 (org-table-store-formulas stored-list))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9924 eq))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9925
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9926 (defun org-table-store-formulas (alist)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9927 "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
9928 (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
9929 (save-excursion
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9930 (goto-char (org-table-end))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9931 (if (looking-at "\\([ \t]*\n\\)*#\\+TBLFM:.*\n?")
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9932 (delete-region (point) (match-end 0)))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9933 (insert "#+TBLFM: "
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9934 (mapconcat (lambda (x)
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9935 (concat "$" (car x) "=" (cdr x)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9936 alist "::")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9937 "\n")))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9938
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9939 (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
9940 "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
9941 (interactive)
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9942 (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
9943 (save-excursion
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9944 (goto-char (org-table-end))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9945 (when (looking-at "\\([ \t]*\n\\)*#\\+TBLFM: *\\(.*\\)")
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9946 (setq strings (org-split-string (match-string 2) " *:: *"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9947 (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
9948 (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
9949 (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
9950 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
9951 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
9952 (if (member scol seen)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9953 (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
9954 (push scol seen))))))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9955 (nreverse eq-alist)))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9956
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9957 (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
9958 "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
9959 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
9960 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
9961 (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
9962 (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
9963 (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
9964 "|")))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9965 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
9966 (cond
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9967 ((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
9968 ((eq action 'remove)
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9969 (setq col (car columns)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9970 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
9971 (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
9972 (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
9973 (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
9974 (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
9975 (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
9976 (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
9977 (int-to-string (1- i))))))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9978 ((eq action 'insert)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9979 (setq col (car columns))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9980 (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
9981 (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
9982 (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
9983 (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
9984 (int-to-string (1+ i))))))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9985 ((eq action 'swap)
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9986 (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
9987 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
9988 ;; 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
9989 (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
9990 (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
9991 (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
9992 (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
9993 (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
9994 (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
9995 (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
9996 (if list (org-table-store-formulas list))))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9997
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9998 (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
9999 (let (elt re s)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10000 (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
10001 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
10002 re (concat (regexp-quote s1) "\\>"))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10003 (while (setq elt (pop list))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10004 (setq s (cdr elt))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10005 (while (string-match re s)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10006 (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
10007 (setcdr elt s))))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10008
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10009 (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
10010 "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
10011 (save-excursion
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10012 (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
10013 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
10014 (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
10015 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
10016 org-table-named-field-locations nil)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10017 (goto-char beg)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10018 (when (re-search-forward "^[ \t]*| *! *\\(|.*\\)" end t)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10019 (setq names (org-split-string (match-string 1) " *| *")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10020 cnt 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10021 (while (setq name (pop names))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10022 (setq cnt (1+ cnt))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10023 (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
10024 (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
10025 (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
10026 (setq org-table-column-name-regexp
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10027 (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
10028 (goto-char beg)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10029 (while (re-search-forward "^[ \t]*| *\\$ *\\(|.*\\)" end t)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10030 (setq fields (org-split-string (match-string 1) " *| *"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10031 (while (setq field (pop fields))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10032 (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
10033 (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
10034 org-table-local-parameters))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10035 (goto-char beg)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10036 (while (re-search-forward "^[ \t]*| *\\([_^]\\) *\\(|.*\\)" end t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10037 (setq c (match-string 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10038 fields (org-split-string (match-string 2) " *| *"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10039 (save-excursion
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10040 (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
10041 (setq line (org-current-line) col 1)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10042 (and (looking-at "^[ \t]*|[^|]*\\(|.*\\)")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10043 (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
10044 (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
10045 (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
10046 (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
10047 (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
10048 (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
10049 (push (list field line col) org-table-named-field-locations)))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10050
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10051 (defun org-this-word ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10052 ;; Get the current word
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10053 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10054 (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
10055 (end (progn (skip-chars-forward "^ \t\n") (point))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10056 (buffer-substring-no-properties beg end))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10057
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10058 (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
10059 "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
10060 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
10061 ;; 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
10062 ;; 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
10063 (when org-table-formula-evaluate-inline
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10064 (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
10065 named eq)
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
10066 (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
10067 (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
10068 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
10069 (if (fboundp 'calc-eval)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10070 (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
10071
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10072 (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
10073 "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
10074 Will be filled automatically during use.")
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10075
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10076 (defvar org-recalc-marks
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10077 '((" " . "Unmarked: no special line, no automatic recalculation")
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10078 ("#" . "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
10079 ("*" . "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
10080 ("!" . "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
10081 ("$" . "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
10082 ("_" . "Names for values in row below this one.")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10083 ("^" . "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
10084
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10085 (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
10086 "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
10087 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
10088 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
10089 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
10090 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
10091 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
10092 of the new mark."
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10093 (interactive)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10094 (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
10095 (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
10096 (beg (org-table-begin))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10097 (end (org-table-end))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10098 (l (org-current-line))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10099 (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
10100 (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
10101 (have-col
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10102 (save-excursion
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10103 (goto-char beg)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10104 (not (re-search-forward "^[ \t]*|[^-|][^|]*[^#!$*_^| \t][^|]*|" end t))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10105 (col (org-table-current-column))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10106 (forcenew (car (assoc newchar org-recalc-marks)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10107 epos new)
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10108 (when l1
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10109 (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
10110 (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
10111 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
10112 (if (and newchar (not forcenew))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10113 (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
10114 newchar))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10115 (if l1 (goto-line l1))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10116 (save-excursion
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10117 (beginning-of-line 1)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10118 (unless (looking-at org-table-dataline-regexp)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10119 (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
10120 (unless have-col
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10121 (org-table-goto-column 1)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10122 (org-table-insert-column)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10123 (org-table-goto-column (1+ col)))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10124 (setq epos (point-at-eol))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10125 (save-excursion
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10126 (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
10127 (org-table-get-field
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10128 1 (if (looking-at "^[ \t]*| *\\([#!$*^_ ]\\) *|")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10129 (concat " "
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10130 (setq new (or forcenew
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10131 (cadr (member (match-string 1) marks))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10132 " ")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10133 " # ")))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10134 (if (and l1 l2)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10135 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10136 (goto-line l1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10137 (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
10138 (and (looking-at org-table-dataline-regexp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10139 (org-table-get-field 1 (concat " " new " "))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10140 (goto-line l1)))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10141 (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
10142 (goto-line l)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10143 (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
10144
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10145 (defun org-table-maybe-recalculate-line ()
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10146 "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
10147 (interactive)
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10148 (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
10149 (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
10150 (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
10151 (save-excursion (beginning-of-line 1)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10152 (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
10153 (fboundp 'calc-eval)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10154 (org-table-recalculate) t))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10155
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10156 (defvar org-table-formula-debug nil
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10157 "Non-nil means, debug table formulas.
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10158 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
10159
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10160 (defvar modes)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10161 (defsubst org-set-calc-mode (var &optional value)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10162 (if (stringp var)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10163 (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
10164 ("R" calc-angle-mode rad)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10165 ("F" calc-prefer-frac t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10166 ("S" calc-symbolic-mode t)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10167 value (nth 2 var) var (nth 1 var)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10168 (if (memq var modes)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10169 (setcar (cdr (memq var modes)) value)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10170 (cons var (cons value modes)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10171 modes)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10172
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10173 (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
10174 suppress-align suppress-const
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10175 suppress-store)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10176 "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
10177
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
10178 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
10179 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
10180 installed in order to use this function.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10181
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10182 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
10183 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
10184 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
10185 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
10186 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
10187
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10188 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
10189 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
10190 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
10191 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
10192 deleting columns with the corresponding commands.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10193
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
10194 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
10195 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
10196
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10197 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
10198 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
10199 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
10200 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
10201 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
10202 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
10203 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
10204 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
10205 not overwrite the stored one."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10206 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10207 (require 'calc)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10208 (org-table-check-inside-data-field)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10209 (org-table-get-specials)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10210 (let* (fields
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10211 (ndown (if (integerp arg) arg 1))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10212 (org-table-automatic-realign nil)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10213 (case-fold-search nil)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10214 (down (> ndown 1))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10215 (formula (if (and equation suppress-store)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10216 equation
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10217 (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
10218 (n0 (org-table-current-column))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10219 (modes (copy-sequence org-calc-default-modes))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10220 n form fmt x ev orig c)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10221 ;; 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
10222 ;; 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
10223 (if (string-match ";" formula)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10224 (let ((tmp (org-split-string formula ";")))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10225 (setq formula (car tmp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10226 fmt (concat (cdr (assoc "%" org-table-local-parameters))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10227 (nth 1 tmp)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10228 (while (string-match "[pnfse]\\(-?[0-9]+\\)" fmt)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10229 (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
10230 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
10231 (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
10232 (setq modes (org-set-calc-mode
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10233 '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
10234 (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
10235 (?s . sci) (?e . eng))))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10236 n))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10237 (setq fmt (replace-match "" t t fmt)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10238 (while (string-match "[DRFS]" fmt)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10239 (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
10240 (setq fmt (replace-match "" t t fmt)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10241 (unless (string-match "\\S-" fmt)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10242 (setq fmt nil))))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10243 (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
10244 (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
10245 (setq orig (or (get-text-property 1 :orig-formula formula) "?"))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10246 (while (> ndown 0)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10247 (setq fields (org-split-string
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10248 (buffer-substring
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10249 (point-at-bol) (point-at-eol)) " *| *"))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10250 (if org-table-formula-numbers-only
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10251 (setq fields (mapcar
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10252 (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
10253 fields)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10254 (setq ndown (1- ndown))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10255 (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
10256 ;; Insert the references to fields in same row
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10257 (while (string-match "\\$\\([0-9]+\\)?" form)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10258 (setq n (if (match-beginning 1)
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
10259 (string-to-number (match-string 1 form))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10260 n0)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10261 x (nth (1- n) fields))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10262 (unless x (error "Invalid field specifier \"%s\""
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10263 (match-string 0 form)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10264 (if (equal x "") (setq x "0"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10265 (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
10266 ;; 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
10267 (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
10268 (setq form (replace-match
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10269 (save-match-data
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10270 (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
10271 nil n0))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10272 t t form)))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10273 (setq ev (calc-eval (cons form modes)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10274 (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
10275
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10276 (when org-table-formula-debug
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10277 (with-output-to-temp-buffer "*Help*"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10278 (princ (format "Substitution history of formula
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10279 Orig: %s
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10280 $xyz-> %s
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10281 $1-> %s\n" orig formula form))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10282 (if (listp ev)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10283 (princ (format " %s^\nError: %s"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10284 (make-string (car ev) ?\-) (nth 1 ev)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10285 (princ (format "Result: %s\nFormat: %s\nFinal: %s"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10286 ev (or fmt "NONE")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10287 (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
10288 (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
10289 (unless (and (interactive-p) (not ndown))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10290 (unless (let (inhibit-redisplay)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10291 (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
10292 (org-table-align)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10293 (error "Abort"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10294 (delete-window (get-buffer-window "*Help*"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10295 (message "")))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10296 (if (listp ev) (setq fmt nil ev "#ERROR"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10297 (org-table-justify-field-maybe
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10298 (if fmt (format fmt (string-to-number ev)) ev))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10299 (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
10300 (call-interactively 'org-return)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10301 (setq ndown 0)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10302 (and down (org-table-maybe-recalculate-line))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10303 (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
10304 (org-table-align)))))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10305
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10306 (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
10307 "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
10308 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
10309 (interactive "P")
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10310 (or (memq this-command org-recalc-commands)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10311 (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
10312 (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
10313 (org-table-get-specials)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10314 (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
10315 (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
10316 (inhibit-redisplay t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10317 (line-re org-table-dataline-regexp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10318 (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
10319 (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
10320 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
10321 ;; Insert constants in all formulas
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10322 (setq eqlist
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10323 (mapcar (lambda (x)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10324 (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
10325 x)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10326 eqlist))
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10327 ;; Split the equation list
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10328 (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
10329 (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
10330 (push eq eqlnum)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10331 (push eq eqlname)))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10332 (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
10333 (if all
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10334 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10335 (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
10336 (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
10337 (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
10338 ;; 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
10339 (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
10340 ;; 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
10341 (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
10342 (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
10343 (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
10344 (setq beg (match-beginning 0))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10345 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
10346 (setq beg (point-at-bol)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10347 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
10348 (goto-char beg)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10349 (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
10350 (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
10351 (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
10352 ;; Unprotected line, recalculate
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10353 (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
10354 (setq cnt (1+ cnt))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10355 (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
10356 (setq eql eqlnum)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10357 (while (setq entry (pop eql))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10358 (goto-line org-last-recalc-line)
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
10359 (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
10360 (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
10361 (goto-line thisline)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10362 (org-table-goto-column thiscol)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10363 (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
10364 (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
10365 ;; 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
10366 (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
10367 (setq name (car eq)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10368 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
10369 (when a
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10370 (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
10371 (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
10372 (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
10373 (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
10374 ;; back to initial position
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10375 (goto-line thisline)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10376 (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
10377 (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
10378 (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
10379
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10380 (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
10381 "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
10382 (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
10383 ;; First, check for column names
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10384 (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
10385 (setq start (1+ start))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10386 (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
10387 (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
10388 ;; Expand ranges to vectors
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10389 (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
10390 (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
10391 n2 (string-to-number (match-string 2 f))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10392 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
10393 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
10394 (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
10395 (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
10396 (setq s (concat s "]"))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10397 (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
10398 (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
10399 ;; Parameters and constants
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10400 (setq start 0)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10401 (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
10402 (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
10403 (if (setq a (save-match-data
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10404 (org-table-get-constant (match-string 1 f))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10405 (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
10406 (if org-table-formula-debug
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10407 (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
10408 f))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10409
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10410 (defun org-table-get-constant (const)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10411 "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
10412 Parameters get priority."
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10413 (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
10414 (cdr (assoc const org-table-formula-constants))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10415 (and (fboundp 'constants-get) (constants-get const))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10416 "#UNDEFINED_NAME"))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10417
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10418 (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
10419 (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
10420 (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
10421 (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
10422
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10423 (defvar org-pos)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10424
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10425 (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
10426 "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
10427 (interactive)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10428 (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
10429 (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
10430 (org-table-get-specials)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10431 (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
10432 (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
10433 (wc (current-window-configuration))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10434 entry loc s)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10435 (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
10436 (erase-buffer)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10437 (fundamental-mode)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10438 (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
10439 (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
10440 (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
10441 (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
10442 # 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
10443 # 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
10444 # 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
10445 (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
10446 (insert s)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10447 (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
10448 (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
10449 (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
10450 (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
10451 (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
10452 (insert s))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10453 (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
10454 (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
10455 (insert s))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10456 (goto-char (point-min))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10457 (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
10458
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10459 (defun org-show-variable ()
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10460 "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
10461 (interactive)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10462 (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
10463 (save-excursion
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10464 (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
10465 (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
10466 (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
10467 (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
10468 (cond
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10469 ((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
10470 (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
10471 (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
10472 (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
10473 (select-window win)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10474 (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
10475 ((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
10476 (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
10477 (goto-char pos)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10478 (goto-char (org-table-begin))
65264
a95981ee377b (calc-embedded-close-formula, calc-embedded-open-formula,
Juanma Barranquero <lekktu@gmail.com>
parents: 65243
diff changeset
10479 (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
10480 (org-table-end) t)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10481 (progn
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10482 (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
10483 (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
10484 (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
10485 (select-window win))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10486 ((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
10487 ;; column number
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10488 (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
10489 (goto-char pos)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10490 (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
10491 (recenter 1)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10492 (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
10493 (org-table-end) t)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10494 (progn
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10495 (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
10496 (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
10497 (message "Column %s" var))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10498 (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
10499 (select-window win))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10500 ((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
10501 (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
10502 (goto-char pos)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10503 (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
10504 (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
10505 (progn
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10506 (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
10507 (message "Local parameter."))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10508 (error "Parameter not found"))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10509 (select-window win))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10510 (t
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10511 (cond
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10512 ((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
10513 (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
10514 ((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
10515 (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
10516 (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
10517
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10518 (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
10519 "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
10520 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
10521 (interactive "P")
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10522 (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
10523 (goto-char (point-min))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10524 (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
10525 (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
10526 (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
10527 (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
10528 (goto-char pos)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10529 (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
10530 (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
10531 (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
10532 (move-marker pos nil)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10533 (kill-buffer "*Edit Formulas*")
65264
a95981ee377b (calc-embedded-close-formula, calc-embedded-open-formula,
Juanma Barranquero <lekktu@gmail.com>
parents: 65243
diff changeset
10534 (if arg
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10535 (org-table-recalculate 'all)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10536 (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
10537
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10538 (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
10539 "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
10540 (interactive)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10541 (let ((pos org-pos))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10542 (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
10543 (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
10544 (goto-char pos)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10545 (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
10546
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10547 ;;; The orgtbl minor mode
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10548
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10549 ;; 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
10550 ;; 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
10551
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10552 ;; 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
10553 ;; 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
10554 ;; 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
10555 ;; 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
10556 ;; 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
10557 ;; 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
10558 ;; 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
10559 ;; 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
10560 ;; 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
10561 ;; 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
10562 ;; 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
10563
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10564 ;; 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
10565 ;; 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
10566 ;; 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
10567
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10568 ;; 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
10569 ;; 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
10570 ;; 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
10571 ;; 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
10572 ;; 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
10573 ;; modified self-insert.
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10574
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10575 (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
10576 "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
10577 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
10578 (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
10579
65964
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
10580 (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
10581 "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
10582
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10583 ;;;###autoload
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10584 (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
10585 "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
10586 (orgtbl-mode 1))
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10587
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10588 ;;;###autoload
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10589 (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
10590 "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
10591 (interactive)
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
10592 (if (eq major-mode 'org-mode)
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
10593 ;; 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
10594 ;; by accident in org-mode.
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
10595 (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
10596 (setq orgtbl-mode
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10597 (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
10598 (if orgtbl-mode
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10599 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10600 (and (orgtbl-setup) (defun orgtbl-setup () nil))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10601 ;; 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
10602 (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
10603 (and c (setq minor-mode-map-alist
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10604 (cons c (delq c minor-mode-map-alist)))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10605 (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
10606 (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
10607 nil 'local)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10608 (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
10609 auto-fill-inhibit-regexp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10610 (set (make-local-variable 'auto-fill-inhibit-regexp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10611 (if auto-fill-inhibit-regexp
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10612 (concat "\\([ \t]*|\\|" auto-fill-inhibit-regexp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10613 "[ \t]*|"))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10614 (org-add-to-invisibility-spec '(org-cwidth))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10615 (easy-menu-add orgtbl-mode-menu)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10616 (run-hooks 'orgtbl-mode-hook))
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
10617 (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
10618 (org-cleanup-narrow-column-properties)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10619 (org-remove-from-invisibility-spec '(org-cwidth))
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
10620 (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
10621 (easy-menu-remove orgtbl-mode-menu)
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
10622 (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
10623
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10624 (defun org-cleanup-narrow-column-properties ()
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10625 "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
10626 (let ((s 1))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10627 (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
10628 'display org-narrow-column-arrow))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10629 (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
10630 (setq s 1)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10631 (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
10632 (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
10633 (setq s 1)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10634 (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
10635 (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
10636
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10637 ;; 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
10638 (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
10639 (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
10640 (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
10641
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10642 (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
10643 "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
10644 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
10645 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
10646 to execute outside of tables."
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10647 (eval
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
10648 (list 'defun
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10649 (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
10650 '(arg)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10651 (concat "In tables, run `" (symbol-name fun) "'.\n"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10652 "Outside of tables, run the binding of `"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10653 (mapconcat (lambda (x) (format "%s" x)) keys "' or `")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10654 "'.")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10655 '(interactive "p")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10656 (list 'if
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10657 '(org-at-table-p)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10658 (list 'call-interactively (list 'quote fun))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10659 (list 'let '(orgtbl-mode)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10660 (list 'call-interactively
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10661 (append '(or)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10662 (mapcar (lambda (k)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10663 (list 'key-binding k))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10664 keys)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10665 '('orgtbl-error))))))))
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10666
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10667 (defun orgtbl-error ()
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10668 "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
10669 (interactive)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10670 (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
10671
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10672 (defun orgtbl-setup ()
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10673 "Setup orgtbl keymaps."
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10674 (let ((nfunc 0)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10675 (bindings
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10676 (list
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10677 '([(meta shift left)] org-table-delete-column)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10678 '([(meta left)] org-table-move-column-left)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10679 '([(meta right)] org-table-move-column-right)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10680 '([(meta shift right)] org-table-insert-column)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10681 '([(meta shift up)] org-table-kill-row)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10682 '([(meta shift down)] org-table-insert-row)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10683 '([(meta up)] org-table-move-row-up)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10684 '([(meta down)] org-table-move-row-down)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10685 '("\C-c\C-w" org-table-cut-region)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10686 '("\C-c\M-w" org-table-copy-region)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10687 '("\C-c\C-y" org-table-paste-rectangle)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10688 '("\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
10689 ; '([(shift tab)] org-table-previous-field)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10690 '("\C-m" org-table-next-row)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10691 (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
10692 '([(meta return)] org-table-wrap-region)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10693 '("\C-c\C-q" org-table-wrap-region)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10694 '("\C-c?" org-table-current-column)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10695 '("\C-c " org-table-blank-field)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10696 '("\C-c+" org-table-sum)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10697 '("\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
10698 '("\C-c'" org-table-edit-formulas)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10699 '("\C-c`" org-table-edit-field)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10700 '("\C-c*" org-table-recalculate)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10701 '("\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
10702 '("\C-c^" org-table-sort-lines)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10703 '([(control ?#)] org-table-rotate-recalc-marks)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10704 elt key fun cmd)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10705 (while (setq elt (pop bindings))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10706 (setq nfunc (1+ nfunc))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10707 (setq key (car elt)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10708 fun (nth 1 elt)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10709 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
10710 (define-key orgtbl-mode-map key cmd))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10711 ;; 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
10712 (define-key orgtbl-mode-map [(return)]
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10713 (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
10714 (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
10715 (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
10716 (define-key orgtbl-mode-map [(tab)]
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10717 (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
10718 (define-key orgtbl-mode-map "\C-i"
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10719 (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
10720 (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
10721 (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
10722 (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
10723 (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
10724 (when orgtbl-optimized
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10725 ;; 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
10726 ;; 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
10727 (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
10728 '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
10729 'delete-char 'org-delete-char
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10730 '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
10731 (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
10732 (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
10733 '("OrgTbl"
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10734 ["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
10735 ["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
10736 ["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
10737 ["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
10738 "--"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10739 ["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
10740 ["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
10741 ["Copy Field from Above"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10742 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
10743 "--"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10744 ("Column"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10745 ["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
10746 ["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
10747 ["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
10748 ["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
10749 "--"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10750 ["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
10751 ("Row"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10752 ["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
10753 ["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
10754 ["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
10755 ["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
10756 ["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
10757 "--"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10758 ["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
10759 ("Rectangle"
66262
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
10760 ["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
10761 ["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
10762 ["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
10763 ["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
10764 "--"
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10765 ["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
10766 ["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
10767 ["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
10768 ["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
10769 ["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
10770 ["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
10771 ["Sum Column/Rectangle" org-table-sum
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10772 :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
10773 ["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
10774 ["Debug Formulas"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10775 (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
10776 :style toggle :selected org-table-formula-debug]
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10777 ))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10778 t)
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10779
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10780 (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
10781 "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
10782 (interactive "P")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10783 (if arg (org-table-edit-field t)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10784 (org-table-justify-field-maybe)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10785 (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
10786
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10787 (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
10788 "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
10789 (interactive)
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10790 (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
10791 (org-table-next-row))
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10792
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10793 (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
10794 "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
10795 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
10796 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
10797 (interactive "p")
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10798 (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
10799 (or
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
10800 (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
10801 (member last-command
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
10802 '(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
10803 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
10804 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
10805 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
10806 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
10807 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
10808 (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
10809 t)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10810 (eq N 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10811 (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
10812 (let (org-table-may-need-update)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10813 (goto-char (1- (match-end 0)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10814 (delete-backward-char 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10815 (goto-char (match-beginning 0))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10816 (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
10817 (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
10818 (let (orgtbl-mode)
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10819 (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
10820
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
10821 (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
10822 "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
10823 (interactive "p")
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
10824 (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
10825
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10826 ;;; Exporting
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10827
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10828 (defconst org-level-max 20)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10829
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10830 (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
10831 "Remove all lines from LIST which are before the first headline."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10832 (let ((orig-list list)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10833 (re (concat "^" outline-regexp)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10834 (while (and list
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10835 (not (string-match re (car list))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10836 (pop list))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10837 (or list orig-list)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10838
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10839 (defun org-skip-comments (lines)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10840 "Skip lines starting with \"#\" and subtrees starting with COMMENT."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10841 (let ((re1 (concat "^\\(\\*+\\)[ \t]+" org-comment-string))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10842 (re2 "^\\(\\*+\\)[ \t\n\r]")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10843 rtn line level)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10844 (while (setq line (pop lines))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10845 (cond
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10846 ((and (string-match re1 line)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10847 (setq level (- (match-end 1) (match-beginning 1))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10848 ;; Beginning of a COMMENT subtree. Skip it.
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10849 (while (and (setq line (pop lines))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10850 (or (not (string-match re2 line))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10851 (> (- (match-end 1) (match-beginning 1)) level))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10852 (setq lines (cons line lines)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10853 ((string-match "^#" line)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10854 ;; an ordinary comment line
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10855 )
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
10856 ((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
10857 (string-match "^[ \t]*| *[!_^] *|" line))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
10858 ;; 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
10859 )
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10860 (t (setq rtn (cons line rtn)))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10861 (nreverse rtn)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10862
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10863 ;; ASCII
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10864
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10865 (defconst org-ascii-underline '(?\$ ?\# ?^ ?\~ ?\= ?\-)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10866 "Characters for underlining headings in ASCII export.")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10867
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10868 (defconst org-html-entities
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10869 '(("nbsp")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10870 ("iexcl")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10871 ("cent")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10872 ("pound")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10873 ("curren")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10874 ("yen")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10875 ("brvbar")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10876 ("sect")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10877 ("uml")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10878 ("copy")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10879 ("ordf")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10880 ("laquo")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10881 ("not")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10882 ("shy")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10883 ("reg")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10884 ("macr")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10885 ("deg")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10886 ("plusmn")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10887 ("sup2")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10888 ("sup3")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10889 ("acute")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10890 ("micro")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10891 ("para")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10892 ("middot")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10893 ("odot"."o")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10894 ("star"."*")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10895 ("cedil")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10896 ("sup1")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10897 ("ordm")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10898 ("raquo")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10899 ("frac14")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10900 ("frac12")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10901 ("frac34")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10902 ("iquest")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10903 ("Agrave")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10904 ("Aacute")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10905 ("Acirc")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10906 ("Atilde")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10907 ("Auml")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10908 ("Aring") ("AA"."&Aring;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10909 ("AElig")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10910 ("Ccedil")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10911 ("Egrave")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10912 ("Eacute")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10913 ("Ecirc")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10914 ("Euml")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10915 ("Igrave")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10916 ("Iacute")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10917 ("Icirc")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10918 ("Iuml")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10919 ("ETH")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10920 ("Ntilde")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10921 ("Ograve")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10922 ("Oacute")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10923 ("Ocirc")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10924 ("Otilde")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10925 ("Ouml")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10926 ("times")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10927 ("Oslash")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10928 ("Ugrave")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10929 ("Uacute")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10930 ("Ucirc")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10931 ("Uuml")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10932 ("Yacute")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10933 ("THORN")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10934 ("szlig")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10935 ("agrave")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10936 ("aacute")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10937 ("acirc")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10938 ("atilde")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10939 ("auml")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10940 ("aring")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10941 ("aelig")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10942 ("ccedil")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10943 ("egrave")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10944 ("eacute")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10945 ("ecirc")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10946 ("euml")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10947 ("igrave")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10948 ("iacute")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10949 ("icirc")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10950 ("iuml")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10951 ("eth")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10952 ("ntilde")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10953 ("ograve")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10954 ("oacute")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10955 ("ocirc")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10956 ("otilde")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10957 ("ouml")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10958 ("divide")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10959 ("oslash")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10960 ("ugrave")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10961 ("uacute")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10962 ("ucirc")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10963 ("uuml")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10964 ("yacute")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10965 ("thorn")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10966 ("yuml")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10967 ("fnof")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10968 ("Alpha")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10969 ("Beta")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10970 ("Gamma")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10971 ("Delta")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10972 ("Epsilon")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10973 ("Zeta")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10974 ("Eta")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10975 ("Theta")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10976 ("Iota")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10977 ("Kappa")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10978 ("Lambda")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10979 ("Mu")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10980 ("Nu")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10981 ("Xi")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10982 ("Omicron")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10983 ("Pi")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10984 ("Rho")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10985 ("Sigma")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10986 ("Tau")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10987 ("Upsilon")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10988 ("Phi")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10989 ("Chi")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10990 ("Psi")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10991 ("Omega")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10992 ("alpha")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10993 ("beta")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10994 ("gamma")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10995 ("delta")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10996 ("epsilon")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10997 ("varepsilon"."&epsilon;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10998 ("zeta")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10999 ("eta")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11000 ("theta")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11001 ("iota")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11002 ("kappa")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11003 ("lambda")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11004 ("mu")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11005 ("nu")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11006 ("xi")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11007 ("omicron")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11008 ("pi")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11009 ("rho")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11010 ("sigmaf") ("varsigma"."&sigmaf;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11011 ("sigma")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11012 ("tau")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11013 ("upsilon")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11014 ("phi")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11015 ("chi")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11016 ("psi")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11017 ("omega")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11018 ("thetasym") ("vartheta"."&thetasym;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11019 ("upsih")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11020 ("piv")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11021 ("bull") ("bullet"."&bull;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11022 ("hellip") ("dots"."&hellip;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11023 ("prime")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11024 ("Prime")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11025 ("oline")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11026 ("frasl")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11027 ("weierp")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11028 ("image")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11029 ("real")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11030 ("trade")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11031 ("alefsym")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11032 ("larr") ("leftarrow"."&larr;") ("gets"."&larr;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11033 ("uarr") ("uparrow"."&uarr;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11034 ("rarr") ("to"."&rarr;") ("rightarrow"."&rarr;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11035 ("darr")("downarrow"."&darr;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11036 ("harr") ("leftrightarrow"."&harr;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11037 ("crarr") ("hookleftarrow"."&crarr;") ; has round hook, not quite CR
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11038 ("lArr") ("Leftarrow"."&lArr;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11039 ("uArr") ("Uparrow"."&uArr;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11040 ("rArr") ("Rightarrow"."&rArr;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11041 ("dArr") ("Downarrow"."&dArr;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11042 ("hArr") ("Leftrightarrow"."&hArr;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11043 ("forall")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11044 ("part") ("partial"."&part;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11045 ("exist") ("exists"."&exist;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11046 ("empty") ("emptyset"."&empty;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11047 ("nabla")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11048 ("isin") ("in"."&isin;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11049 ("notin")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11050 ("ni")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11051 ("prod")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11052 ("sum")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11053 ("minus")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11054 ("lowast") ("ast"."&lowast;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11055 ("radic")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11056 ("prop") ("proptp"."&prop;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11057 ("infin") ("infty"."&infin;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11058 ("ang") ("angle"."&ang;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11059 ("and") ("vee"."&and;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11060 ("or") ("wedge"."&or;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11061 ("cap")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11062 ("cup")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11063 ("int")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11064 ("there4")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11065 ("sim")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11066 ("cong") ("simeq"."&cong;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11067 ("asymp")("approx"."&asymp;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11068 ("ne") ("neq"."&ne;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11069 ("equiv")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11070 ("le")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11071 ("ge")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11072 ("sub") ("subset"."&sub;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11073 ("sup") ("supset"."&sup;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11074 ("nsub")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11075 ("sube")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11076 ("supe")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11077 ("oplus")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11078 ("otimes")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11079 ("perp")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11080 ("sdot") ("cdot"."&sdot;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11081 ("lceil")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11082 ("rceil")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11083 ("lfloor")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11084 ("rfloor")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11085 ("lang")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11086 ("rang")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11087 ("loz") ("Diamond"."&loz;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11088 ("spades") ("spadesuit"."&spades;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11089 ("clubs") ("clubsuit"."&clubs;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11090 ("hearts") ("diamondsuit"."&hearts;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11091 ("diams") ("diamondsuit"."&diams;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11092 ("quot")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11093 ("amp")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11094 ("lt")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11095 ("gt")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11096 ("OElig")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11097 ("oelig")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11098 ("Scaron")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11099 ("scaron")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11100 ("Yuml")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11101 ("circ")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11102 ("tilde")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11103 ("ensp")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11104 ("emsp")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11105 ("thinsp")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11106 ("zwnj")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11107 ("zwj")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11108 ("lrm")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11109 ("rlm")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11110 ("ndash")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11111 ("mdash")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11112 ("lsquo")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11113 ("rsquo")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11114 ("sbquo")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11115 ("ldquo")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11116 ("rdquo")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11117 ("bdquo")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11118 ("dagger")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11119 ("Dagger")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11120 ("permil")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11121 ("lsaquo")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11122 ("rsaquo")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11123 ("euro")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11124
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11125 ("arccos"."arccos")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11126 ("arcsin"."arcsin")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11127 ("arctan"."arctan")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11128 ("arg"."arg")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11129 ("cos"."cos")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11130 ("cosh"."cosh")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11131 ("cot"."cot")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11132 ("coth"."coth")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11133 ("csc"."csc")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11134 ("deg"."deg")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11135 ("det"."det")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11136 ("dim"."dim")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11137 ("exp"."exp")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11138 ("gcd"."gcd")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11139 ("hom"."hom")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11140 ("inf"."inf")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11141 ("ker"."ker")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11142 ("lg"."lg")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11143 ("lim"."lim")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11144 ("liminf"."liminf")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11145 ("limsup"."limsup")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11146 ("ln"."ln")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11147 ("log"."log")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11148 ("max"."max")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11149 ("min"."min")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11150 ("Pr"."Pr")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11151 ("sec"."sec")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11152 ("sin"."sin")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11153 ("sinh"."sinh")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11154 ("sup"."sup")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11155 ("tan"."tan")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11156 ("tanh"."tanh")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11157 )
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11158 "Entities for TeX->HTML translation.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11159 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
11160 \"&ent;\". An entry can also be a dotted pair like (\"ent\".\"&other;\").
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11161 In that case, \"\\ent\" will be translated to \"&other;\".
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11162 The list contains HTML entities for Latin-1, Greek and other symbols.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11163 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
11164 translations. There is currently no way for users to extend this.")
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11165
69116
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
11166 (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
11167 "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
11168 (interactive)
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
11169 (let* ((cb (current-buffer))
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
11170 (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
11171 (concat "\\([^<]\\)\\(" org-target-link-regexp "\\)")))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11172 (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
11173 (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
11174 rtn)
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
11175 (save-excursion
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
11176 (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
11177 (erase-buffer)
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
11178 (insert string)
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
11179 (org-mode)
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11180 ;; 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
11181 ;; 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
11182 (goto-char (point-min))
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
11183 (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
11184 (replace-match "\\1(INVISIBLE)"))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11185 ;; 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
11186 (goto-char (point-min))
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
11187 (when re-radio
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
11188 (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
11189 (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
11190 ;; 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
11191 (goto-char (point-min))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11192 (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
11193 (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
11194 (goto-char (match-beginning 0)))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11195 ;; 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
11196 (goto-char (point-min))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11197 (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
11198 (replace-match
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11199 (concat
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11200 (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
11201 t t))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11202 (goto-char (point-min))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11203 (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
11204 (replace-match
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11205 (concat
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11206 (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
11207 t t))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11208
69116
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
11209 ;; Remove comments
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
11210 (goto-char (point-min))
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
11211 (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
11212 (replace-match ""))
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
11213 (setq rtn (buffer-string)))
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
11214 (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
11215 rtn))
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
11216
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11217 (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
11218 "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
11219 (save-match-data
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11220 (let* ((rtn
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11221 (mapconcat
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11222 'identity
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11223 (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
11224 (a (assoc rtn alist)))
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11225 (or (cdr a) rtn))))
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11226
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11227 (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
11228 "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
11229 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
11230 level 5 etc."
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11231 (interactive)
69454
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
11232 (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
11233 (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
11234 (save-excursion
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11235 (goto-char (point-min))
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11236 (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
11237 (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
11238 (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
11239 (org-demote))
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11240 (end-of-line 1))))))
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11241
69454
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
11242
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
11243 (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
11244 "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
11245 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
11246 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
11247 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
11248 (interactive)
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
11249 (goto-char (point-min))
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
11250 ;; 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
11251 (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
11252 (org-show-hierarchy-above)
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
11253 (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
11254 (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
11255 (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
11256 (save-excursion
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
11257 (goto-char (point-min))
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
11258 (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
11259 (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
11260 (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
11261 (org-promote))
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
11262 (end-of-line 1))))))
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
11263
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11264 (defun org-tr-level (n)
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11265 "Make N odd if required."
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11266 (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
11267
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
11268 (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
11269
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11270 (defun org-export-as-ascii (arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11271 "Export the outline as a pretty ASCII file.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11272 If there is an active region, export only the region.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11273 The prefix ARG specifies how many levels of the outline should become
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11274 underlined headlines. The default is 3."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11275 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11276 (setq-default org-todo-line-regexp org-todo-line-regexp)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11277 (let* ((region
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11278 (buffer-substring
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11279 (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
11280 (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
11281 (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
11282 (org-skip-comments
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
11283 (org-split-string
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
11284 (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
11285 "[\r\n]"))))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11286 (org-startup-with-deadline-check nil)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11287 (level 0) line txt
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11288 (umax nil)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11289 (case-fold-search nil)
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
11290 (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
11291 ".txt"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11292 (buffer (find-file-noselect filename))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11293 (levels-open (make-vector org-level-max nil))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11294 (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
11295 (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
11296 (author user-full-name)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11297 (title (buffer-name))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11298 (options nil)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11299 (email user-mail-address)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11300 (language org-export-default-language)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11301 (text nil)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11302 (todo nil)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11303 (lang-words nil))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11304
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
11305 (setq org-last-level 1)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11306 (org-init-section-numbers)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11307
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11308 (find-file-noselect filename)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11309
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11310 ;; Search for the export key lines
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11311 (org-parse-key-lines)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11312
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11313 (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
11314 (assoc "en" org-export-language-setup)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11315 (if org-export-ascii-show-new-buffer
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11316 (switch-to-buffer-other-window buffer)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11317 (set-buffer buffer))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11318 (erase-buffer)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11319 (fundamental-mode)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11320 (if options (org-parse-export-options options))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11321 (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
11322 org-export-headline-levels))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11323
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11324 ;; File header
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11325 (if title (org-insert-centered title ?=))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11326 (insert "\n")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11327 (if (or author email)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11328 (insert (concat (nth 1 lang-words) ": " (or author "")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11329 (if email (concat " <" email ">") "")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11330 "\n")))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11331 (if (and date time)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11332 (insert (concat (nth 2 lang-words) ": " date " " time "\n")))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11333 (if text (insert (concat (org-html-expand-for-ascii text) "\n\n")))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11334
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11335 (insert "\n\n")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11336
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11337 (if org-export-with-toc
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11338 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11339 (insert (nth 3 lang-words) "\n"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11340 (make-string (length (nth 3 lang-words)) ?=) "\n")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11341 (mapcar '(lambda (line)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11342 (if (string-match org-todo-line-regexp
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11343 line)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11344 ;; This is a headline
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11345 (progn
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11346 (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
11347 level (org-tr-level level)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11348 txt (match-string 3 line)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11349 todo
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11350 (or (and (match-beginning 2)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11351 (not (equal (match-string 2 line)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11352 org-done-string)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11353 ; TODO, not DONE
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11354 (and org-export-mark-todo-in-toc
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11355 (= level umax)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11356 (org-search-todo-below
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11357 line lines level))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11358 (setq txt (org-html-expand-for-ascii txt))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11359
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11360 (if org-export-with-section-numbers
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11361 (setq txt (concat (org-section-number level)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11362 " " txt)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11363 (if (<= level umax)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11364 (progn
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11365 (insert
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11366 (make-string (* (1- level) 4) ?\ )
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11367 (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
11368 (setq org-last-level level))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11369 ))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11370 lines)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11371
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11372 (org-init-section-numbers)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11373 (while (setq line (pop lines))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11374 ;; Remove the quoted HTML tags.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11375 (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
11376 ;; Remove targets
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
11377 (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
11378 (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
11379 ;; Replace internal links
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
11380 (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
11381 (setq line (replace-match
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
11382 (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
11383 t nil line)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11384 (cond
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11385 ((string-match "^\\(\\*+\\)[ \t]*\\(.*\\)" line)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11386 ;; a Headline
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11387 (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
11388 txt (match-string 2 line))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11389 (org-ascii-level-start level txt umax))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11390 (t (insert line "\n"))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11391 (normal-mode)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11392 (save-buffer)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11393 (goto-char (point-min))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11394
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11395 (defun org-search-todo-below (line lines level)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11396 "Search the subtree below LINE for any TODO entries."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11397 (let ((rest (cdr (memq line lines)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11398 (re org-todo-line-regexp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11399 line lv todo)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11400 (catch 'exit
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11401 (while (setq line (pop rest))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11402 (if (string-match re line)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11403 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11404 (setq lv (- (match-end 1) (match-beginning 1))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11405 todo (and (match-beginning 2)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11406 (not (equal (match-string 2 line)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11407 org-done-string))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11408 ; TODO, not DONE
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11409 (if (<= lv level) (throw 'exit nil))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11410 (if todo (throw 'exit t))))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11411
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11412 ;; 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
11413 ;; We could also implement *bold*,/italic/ and _underline_ for ASCII export
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11414 (defun org-html-expand-for-ascii (line)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11415 "Handle quoted HTML for ASCII export."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11416 (if org-export-html-expand
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11417 (while (string-match "@<[^<>\n]*>" line)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11418 ;; We just remove the tags for now.
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11419 (setq line (replace-match "" nil nil line))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11420 line)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11421
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11422 (defun org-insert-centered (s &optional underline)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11423 "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
11424 (let ((ind (max (/ (- 80 (string-width s)) 2) 0)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11425 (insert (make-string ind ?\ ) s "\n")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11426 (if underline
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11427 (insert (make-string ind ?\ )
69482
a305f07816a9 (org-insert-centered): Use `string-width' to make
Carsten Dominik <dominik@science.uva.nl>
parents: 69454
diff changeset
11428 (make-string (string-width s) underline)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11429 "\n"))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11430
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11431 (defun org-ascii-level-start (level title umax)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11432 "Insert a new level in ASCII export."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11433 (let (char)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11434 (if (> level umax)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11435 (insert (make-string (* 2 (- level umax 1)) ?\ ) "* " title "\n")
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11436 (if (or (not (equal (char-before) ?\n))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11437 (not (equal (char-before (1- (point))) ?\n)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11438 (insert "\n"))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11439 (setq char (nth (- umax level) (reverse org-ascii-underline)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11440 (if org-export-with-section-numbers
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11441 (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
11442 (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
11443
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
11444 (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
11445 "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
11446 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
11447 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
11448 (interactive)
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
11449 (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
11450 ".txt"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11451 (buffer (find-file-noselect filename))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11452 (ore (concat
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11453 (org-make-options-regexp
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11454 '("CATEGORY" "SEQ_TODO" "PRI_TODO" "TYP_TODO"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11455 "STARTUP" "ARCHIVE"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11456 "TITLE" "AUTHOR" "EMAIL" "TEXT" "OPTIONS" "LANGUAGE"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11457 (if org-noutline-p "\\(\n\\|$\\)" "")))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11458 s e)
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
11459 (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
11460 (erase-buffer)
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
11461 (text-mode))
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
11462 (save-excursion
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
11463 (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
11464 (while (not (= (point) (point-max)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11465 (goto-char (org-find-invisible))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11466 (append-to-buffer buffer s (point))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11467 (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
11468 (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
11469 (newline)
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
11470 (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
11471 (if (looking-at ".*-\\*- mode:.*\n")
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11472 (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
11473 (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
11474 (replace-match ""))
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
11475 (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
11476
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
11477 (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
11478 (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
11479 (let ((s (point)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11480 (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
11481 (get-char-property s 'invisible)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11482 s)
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
11483 (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
11484 (point)))
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
11485 (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
11486 (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
11487 (let ((s (point)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11488 (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
11489 (not (get-char-property s 'invisible))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11490 s)
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
11491 (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
11492 (point)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11493
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11494 ;; HTML
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-get-current-options ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11497 "Return a string with current options as keyword options.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11498 Does include HTML export options as well as TODO and CATEGORY stuff."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11499 (format
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11500 "#+TITLE: %s
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11501 #+AUTHOR: %s
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11502 #+EMAIL: %s
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11503 #+LANGUAGE: %s
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11504 #+TEXT: Some descriptive text to be emitted. Several lines OK.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11505 #+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
11506 #+CATEGORY: %s
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11507 #+SEQ_TODO: %s
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11508 #+TYP_TODO: %s
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11509 #+STARTUP: %s %s %s %s %s
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
11510 #+ARCHIVE: %s
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11511 "
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11512 (buffer-name) (user-full-name) user-mail-address org-export-default-language
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11513 org-export-headline-levels
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11514 org-export-with-section-numbers
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11515 org-export-with-toc
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11516 org-export-preserve-breaks
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11517 org-export-html-expand
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11518 org-export-with-fixed-width
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11519 org-export-with-tables
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11520 org-export-with-sub-superscripts
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11521 org-export-with-emphasize
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11522 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
11523 (file-name-nondirectory buffer-file-name)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11524 (if (equal org-todo-interpretation 'sequence)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11525 (mapconcat 'identity org-todo-keywords " ")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11526 "TODO FEEDBACK VERIFY DONE")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11527 (if (equal org-todo-interpretation 'type)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11528 (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
11529 "Me Jason Marie DONE")
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
11530 (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
11531 '((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
11532 (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
11533 (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
11534 (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
11535 (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
11536 org-archive-location
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
11537 ))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11538
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11539 (defun org-insert-export-options-template ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11540 "Insert into the buffer a template with information for exporting."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11541 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11542 (if (not (bolp)) (newline))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11543 (let ((s (org-get-current-options)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11544 (and (string-match "#\\+CATEGORY" s)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11545 (setq s (substring s 0 (match-beginning 0))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11546 (insert s)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11547
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11548 (defun org-toggle-fixed-width-section (arg)
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11549 "Toggle the fixed-width export.
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11550 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
11551 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
11552 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
11553 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
11554 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
11555 this line is also exported in fixed-width font."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11556 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11557 (let* ((cc 0)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11558 (regionp (org-region-active-p))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11559 (beg (if regionp (region-beginning) (point)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11560 (end (if regionp (region-end)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11561 (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
11562 (re "[ \t]*\\(:\\)")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11563 off)
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11564 (if regionp
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11565 (save-excursion
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11566 (goto-char beg)
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11567 (setq cc (current-column))
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11568 (beginning-of-line 1)
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11569 (setq off (looking-at re))
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11570 (while (> nlines 0)
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11571 (setq nlines (1- nlines))
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11572 (beginning-of-line 1)
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11573 (cond
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11574 (arg
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11575 (move-to-column cc t)
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11576 (insert ":\n")
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11577 (forward-line -1))
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11578 ((and off (looking-at re))
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11579 (replace-match "" t t nil 1))
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11580 ((not off) (move-to-column cc t) (insert ":")))
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11581 (forward-line 1)))
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11582 (save-excursion
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11583 (org-back-to-heading)
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11584 (if (looking-at (concat outline-regexp
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11585 "\\( +\\<" org-quote-string "\\>\\)"))
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11586 (replace-match "" t t nil 1)
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11587 (if (looking-at outline-regexp)
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11588 (progn
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11589 (goto-char (match-end 0))
65264
a95981ee377b (calc-embedded-close-formula, calc-embedded-open-formula,
Juanma Barranquero <lekktu@gmail.com>
parents: 65243
diff changeset
11590 (insert " " org-quote-string))))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11591
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11592 (defun org-export-as-html-and-open (arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11593 "Export the outline as HTML and immediately open it with a browser.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11594 If there is an active region, export only the region.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11595 The prefix ARG specifies how many levels of the outline should become
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11596 headlines. The default is 3. Lower levels will become bulleted lists."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11597 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11598 (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
11599 (org-open-file buffer-file-name))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11600
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11601 (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
11602 "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
11603 emacs --batch
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11604 --load=$HOME/lib/emacs/org.el
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11605 --eval \"(setq org-export-headline-levels 2)\"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11606 --visit=MyFile --funcall org-export-as-html-batch"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11607 (org-export-as-html org-export-headline-levels 'hidden))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11608
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11609 (defun org-export-as-html (arg &optional hidden)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11610 "Export the outline as a pretty HTML file.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11611 If there is an active region, export only the region.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11612 The prefix ARG specifies how many levels of the outline should become
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11613 headlines. The default is 3. Lower levels will become bulleted lists."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11614 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11615 (setq-default org-todo-line-regexp org-todo-line-regexp)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11616 (setq-default org-deadline-line-regexp org-deadline-line-regexp)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11617 (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
11618 (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
11619 (odd org-odd-levels-only)
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11620 (region-p (org-region-active-p))
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11621 (region
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11622 (buffer-substring
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11623 (if region-p (region-beginning) (point-min))
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11624 (if region-p (region-end) (point-max))))
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11625 (all_lines
69116
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
11626 (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
11627 (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
11628 "[\r\n]")))
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11629 (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
11630 (level 0) (line "") (origline "") txt todo
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11631 (umax nil)
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
11632 (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
11633 ".html"))
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11634 (buffer (find-file-noselect filename))
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11635 (levels-open (make-vector org-level-max nil))
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11636 (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
11637 (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
11638 (author user-full-name)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11639 (title (buffer-name))
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11640 (options nil)
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11641 (quote-re (concat "^\\*+[ \t]*" org-quote-string "\\>"))
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11642 (inquote nil)
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11643 (infixed nil)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11644 (in-local-list nil)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11645 (local-list-num nil)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11646 (local-list-indent nil)
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
11647 (llt org-plain-list-ordered-item-terminator)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11648 (email user-mail-address)
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11649 (language org-export-default-language)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11650 (text nil)
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11651 (lang-words nil)
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11652 (target-alist nil) tg
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11653 (head-count 0) cnt
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11654 (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
11655 ;; 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
11656 (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
11657 (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
11658 buffer-file-coding-system))
66262
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
11659 (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
11660 (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
11661 (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
11662 (coding-system-get coding-system 'mime-charset)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11663 table-open type
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11664 table-buffer table-orig-buffer
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11665 ind start-is-num starter
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11666 rpl path desc desc1 desc2 link
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11667 )
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11668 (message "Exporting...")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11669
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
11670 (setq org-last-level 1)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11671 (org-init-section-numbers)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11672
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11673 ;; Search for the export key lines
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11674 (org-parse-key-lines)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11675 (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
11676 (assoc "en" org-export-language-setup)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11677
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11678 ;; Switch to the output buffer
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11679 (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
11680 (set-buffer buffer)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11681 (switch-to-buffer-other-window buffer))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11682 (erase-buffer)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11683 (fundamental-mode)
69454
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
11684 (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
11685 (org-odd-levels-only odd))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11686 (if options (org-parse-export-options options))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11687 (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
11688 org-export-headline-levels))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11689
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11690 ;; File header
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11691 (insert (format
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11692 "<!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
11693 \"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
11694 <html lang=\"%s\"><head>
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11695 <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
11696 <meta http-equiv=\"Content-Type\" content=\"text/html;charset=%s\">
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11697 <meta name=generator content=\"Org-mode\">
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11698 <meta name=generated content=\"%s %s\">
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11699 <meta name=author content=\"%s\">
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11700 %s
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11701 </head><body>
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11702 "
65964
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
11703 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
11704 date time author style))
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
11705 (if title (insert (concat "<H1 class=\"title\">"
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11706 (org-html-expand title) "</H1>\n")))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11707 (if author (insert (concat (nth 1 lang-words) ": " author "\n")))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11708 (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
11709 email "&gt;</a>\n")))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11710 (if (or author email) (insert "<br>\n"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11711 (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
11712 date " " time "<br>\n")))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11713 (if text (insert (concat "<p>\n" (org-html-expand text))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11714 (if org-export-with-toc
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11715 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11716 (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
11717 (insert "<ul>\n")
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11718 (setq lines
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11719 (mapcar '(lambda (line)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11720 (if (string-match org-todo-line-regexp line)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11721 ;; This is a headline
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11722 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11723 (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
11724 level (org-tr-level level)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11725 txt (save-match-data
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11726 (org-html-expand
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11727 (match-string 3 line)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11728 todo
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11729 (or (and (match-beginning 2)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11730 (not (equal (match-string 2 line)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11731 org-done-string)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11732 ; TODO, not DONE
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11733 (and org-export-mark-todo-in-toc
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11734 (= level umax)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11735 (org-search-todo-below
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11736 line lines level))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11737 (if org-export-with-section-numbers
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11738 (setq txt (concat (org-section-number level)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11739 " " txt)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11740 (if (<= level umax)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11741 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11742 (setq head-count (+ head-count 1))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11743 (if (> level org-last-level)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11744 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11745 (setq cnt (- level org-last-level))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11746 (while (>= (setq cnt (1- cnt)) 0)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11747 (insert "<ul>"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11748 (insert "\n")))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11749 (if (< level org-last-level)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11750 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11751 (setq cnt (- org-last-level level))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11752 (while (>= (setq cnt (1- cnt)) 0)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11753 (insert "</ul>"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11754 (insert "\n")))
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11755 ;; Check for targets
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11756 (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
11757 (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
11758 line (replace-match
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11759 (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
11760 t t line))
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11761 (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
11762 (format "sec-%d" head-count))
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11763 target-alist))
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11764 (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
11765 (setq txt (replace-match "" t t txt)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11766 (insert
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11767 (format
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11768 (if todo
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
11769 "<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
11770 "<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
11771 head-count txt))
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11772
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11773 (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
11774 )))
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11775 line)
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11776 lines))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11777 (while (> org-last-level 0)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11778 (setq org-last-level (1- org-last-level))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11779 (insert "</ul>\n"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11780 ))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11781 (setq head-count 0)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11782 (org-init-section-numbers)
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11783
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11784 (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
11785 (catch 'nextline
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11786
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11787 ;; end of quote section?
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11788 (when (and inquote (string-match "^\\*+" line))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11789 (insert "</pre>\n")
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11790 (setq inquote nil))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11791 ;; inside a quote section?
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11792 (when inquote
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11793 (insert (org-html-protect line) "\n")
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11794 (throw 'nextline nil))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11795
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11796 ;; verbatim lines
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11797 (when (and org-export-with-fixed-width
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11798 (string-match "^[ \t]*:\\(.*\\)" line))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11799 (when (not infixed)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11800 (setq infixed t)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11801 (insert "<pre>\n"))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11802 (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
11803 (when (and lines
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
11804 (not (string-match "^[ \t]*\\(:.*\\)"
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11805 (car lines))))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11806 (setq infixed nil)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11807 (insert "</pre>\n"))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11808 (throw 'nextline nil))
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11809
69116
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
11810
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
11811 ;; make targets to anchors
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11812 (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
11813 (cond
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11814 ((match-end 2)
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11815 (setq line (replace-match
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11816 (concat "@<a name=\""
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11817 (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
11818 "\">\\nbsp@</a>")
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11819 t t line)))
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11820 ((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
11821 (setq line (replace-match
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11822 (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
11823 ; (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
11824 t t line)))
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11825 (t
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11826 (setq line (replace-match
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11827 (concat "@<a name=\""
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11828 (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
11829 "\" 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
11830 t t line)))))
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11831
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11832 ;; 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
11833 ;; handle @<..> HTML tags (replace "@&gt;..&lt;" by "<..>")
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11834 (setq line (org-html-expand line))
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11835
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11836 ;; Format the links
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11837 (setq start 0)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11838 (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
11839 (setq start (match-beginning 0))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11840 (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
11841 (setq path (match-string 3 line))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11842 (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
11843 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
11844 desc (or desc1 desc2))
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11845 (cond
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11846 ((equal type "internal")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11847 (setq rpl
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11848 (concat
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11849 "<a href=\"#"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11850 (org-solidify-link-text path target-alist)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11851 "\">" desc "</a>")))
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11852 ((member type '("http" "https" "ftp" "mailto" "news"))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11853 ;; standard URL
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11854 (setq link (concat type ":" path))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11855 (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
11856 ((string= type "file")
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11857 ;; FILE link
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11858 (let* ((filename path)
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11859 (abs-p (file-name-absolute-p filename))
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
11860 thefile file-is-image-p search)
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
11861 (save-match-data
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
11862 (if (string-match "::\\(.*\\)" filename)
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
11863 (setq search (match-string 1 filename)
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
11864 filename (replace-match "" nil nil filename)))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
11865 (setq file-is-image-p
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
11866 (string-match (org-image-file-name-regexp) filename))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
11867 (setq thefile (if abs-p (expand-file-name filename) filename))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
11868 (when (and org-export-html-link-org-files-as-html
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
11869 (string-match "\\.org$" thefile))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
11870 (setq thefile (concat (substring thefile 0
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
11871 (match-beginning 0))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
11872 ".html"))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
11873 (if (and search
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
11874 ;; make sure this is can be used as target search
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
11875 (not (string-match "^[0-9]*$" search))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
11876 (not (string-match "^\\*" search))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
11877 (not (string-match "^/.*/$" search)))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
11878 (setq thefile (concat thefile "#"
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
11879 (org-solidify-link-text
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
11880 (org-link-unescape search)))))))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11881 (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
11882 file-is-image-p)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11883 (concat "<img src=\"" thefile "\"/>")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11884 (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
11885 ((member type '("bbdb" "vm" "wl" "mhe" "rmail" "gnus" "shell"))
70064
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
11886 (setq rpl (concat "<i>&lt;" type ":"
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
11887 (save-match-data (org-link-unescape path))
28d6f65fa9e6 (org-insert-heading): Insert heading before current if at
Carsten Dominik <dominik@science.uva.nl>
parents: 70019
diff changeset
11888 "&gt;</i>"))))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11889 (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
11890 start (+ start (length rpl))))
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11891 ;; TODO items
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11892 (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
11893 (match-beginning 2))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11894 (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
11895 (setq line (replace-match
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
11896 "<span class=\"done\">\\2</span>"
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11897 nil nil line 2))
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
11898 (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
11899 nil nil line 2))))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11900
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11901 ;; DEADLINES
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11902 (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
11903 (progn
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11904 (if (save-match-data
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11905 (string-match "<a href"
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11906 (substring line 0 (match-beginning 0))))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11907 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
11908 (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
11909 nil nil line 1)))))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11910 (cond
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11911 ((string-match "^\\(\\*+\\)[ \t]*\\(.*\\)" line)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11912 ;; This is a headline
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11913 (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
11914 txt (match-string 2 line))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11915 (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
11916 (when in-local-list
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11917 ;; 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
11918 (while local-list-num
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11919 (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
11920 (pop local-list-num))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11921 (setq local-list-indent nil
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11922 in-local-list nil))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11923 (org-html-level-start level txt umax
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11924 (and org-export-with-toc (<= level umax))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11925 head-count)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11926 ;; QUOTES
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11927 (when (string-match quote-re line)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11928 (insert "<pre>")
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11929 (setq inquote t)))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11930
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11931 ((and org-export-with-tables
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11932 (string-match "^\\([ \t]*\\)\\(|\\|\\+-+\\+\\)" line))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11933 (if (not table-open)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11934 ;; New table starts
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11935 (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
11936 ;; Accumulate lines
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11937 (setq table-buffer (cons line table-buffer)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11938 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
11939 (when (or (not lines)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11940 (not (string-match "^\\([ \t]*\\)\\(|\\|\\+-+\\+\\)"
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11941 (car lines))))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11942 (setq table-open nil
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11943 table-buffer (nreverse table-buffer)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11944 table-orig-buffer (nreverse table-orig-buffer))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11945 (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
11946 (t
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11947 ;; Normal lines
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11948 (when (and (string-match
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
11949 (cond
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
11950 ((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
11951 ((= 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
11952 ((= 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
11953 (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
11954 line))
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
11955 (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
11956 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
11957 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
11958 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
11959 (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
11960 ;; 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
11961 (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
11962 (while (and in-local-list
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11963 (or (and (= ind (car local-list-indent))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11964 (not starter))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11965 (< ind (car local-list-indent))))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11966 (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
11967 (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
11968 (setq in-local-list local-list-indent))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11969 (cond
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11970 ((and starter
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11971 (or (not in-local-list)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11972 (> ind (car local-list-indent))))
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11973 ;; Start new (level of ) list
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11974 (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
11975 (push start-is-num local-list-num)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11976 (push ind local-list-indent)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11977 (setq in-local-list t))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11978 (starter
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11979 ;; continue current list
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
11980 (insert "<li>\n"))))
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11981 ;; 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
11982 ;; are not fully interpreted, lines starting with "-", "+", "*"
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11983 ;; also start a new paragraph.
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11984 (if (string-match "^ [-+*]-\\|^[ \t]*$" line) (insert "<p>"))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11985 (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
11986 ))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11987 (if org-export-html-with-timestamp
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11988 (insert org-export-html-html-helper-timestamp))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11989 (insert "</body>\n</html>\n")
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11990 (normal-mode)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11991 (save-buffer)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11992 (goto-char (point-min)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11993
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11994 (defun org-format-table-html (lines olines)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11995 "Find out which HTML converter to use and return the HTML code."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11996 (if (string-match "^[ \t]*|" (car lines))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11997 ;; A normal org table
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11998 (org-format-org-table-html lines)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11999 ;; Table made by table.el - test for spanning
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12000 (let* ((hlines (delq nil (mapcar
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12001 (lambda (x)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12002 (if (string-match "^[ \t]*\\+-" x) x
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12003 nil))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12004 lines)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12005 (first (car hlines))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12006 (ll (and (string-match "\\S-+" first)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12007 (match-string 0 first)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12008 (re (concat "^[ \t]*" (regexp-quote ll)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12009 (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
12010 hlines))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12011 (if (and (not spanning)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12012 (not org-export-prefer-native-exporter-for-tables))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12013 ;; 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
12014 (org-format-table-table-html lines)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12015 ;; 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
12016 (org-format-table-table-html-using-table-generate-source olines)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12017
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12018 (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
12019 "Format a table into HTML."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12020 (if (string-match "^[ \t]*|-" (car lines)) (setq lines (cdr lines)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12021 (setq lines (nreverse lines))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12022 (if (string-match "^[ \t]*|-" (car lines)) (setq lines (cdr lines)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12023 (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
12024 (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
12025 ;; 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
12026 ;; 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
12027 (let* ((special
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
12028 (not
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
12029 (memq nil
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
12030 (mapcar
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
12031 (lambda (x)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
12032 (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
12033 (string-match "^[ \t]*| *\\([#!$*_^ ]\\) *|" x)))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
12034 lines)))))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
12035 (if special
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
12036 (setq lines
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
12037 (delq nil
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
12038 (mapcar
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
12039 (lambda (x)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
12040 (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
12041 nil ; ignore this line
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
12042 (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
12043 (string-match "^[ \t]*|[^|]*|" x))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
12044 (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
12045 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
12046
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12047 (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
12048 (delq nil (mapcar
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12049 (lambda (x) (string-match "^[ \t]*|-" x))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12050 (cdr lines)))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12051 line fields html)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12052 (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
12053 (while (setq line (pop lines))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12054 (catch 'next-line
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12055 (if (string-match "^[ \t]*|-" line)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12056 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12057 (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
12058 ;; ignore this line
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12059 (throw 'next-line t)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12060 ;; Break the line into fields
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12061 (setq fields (org-split-string line "[ \t]*|[ \t]*"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12062 (setq html (concat
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12063 html
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12064 "<tr>"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12065 (mapconcat (lambda (x)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12066 (if head
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12067 (concat "<th>" x "</th>")
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
12068 (concat "<td>" x "</td>")))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12069 fields "")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12070 "</tr>\n"))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12071 (setq html (concat html "</table>\n"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12072 html))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12073
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12074 (defun org-fake-empty-table-line (line)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12075 "Replace everything except \"|\" with spaces."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12076 (let ((i (length line))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12077 (newstr (copy-sequence line)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12078 (while (> i 0)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12079 (setq i (1- i))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12080 (if (not (eq (aref newstr i) ?|))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12081 (aset newstr i ?\ )))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12082 newstr))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12083
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12084 (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
12085 "Format a table generated by table.el into HTML.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12086 This conversion does *not* use `table-generate-source' from table.el.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12087 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
12088 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
12089 (let (line field-buffer
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12090 (head org-export-highlight-first-table-line)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12091 fields html empty)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12092 (setq html (concat org-export-html-table-tag "\n"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12093 (while (setq line (pop lines))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12094 (setq empty "&nbsp")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12095 (catch 'next-line
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12096 (if (string-match "^[ \t]*\\+-" line)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12097 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12098 (if field-buffer
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12099 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12100 (setq html (concat
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12101 html
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12102 "<tr>"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12103 (mapconcat
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12104 (lambda (x)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12105 (if (equal x "") (setq x empty))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12106 (if head
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
12107 (concat "<th>" x "</th>\n")
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
12108 (concat "<td>" x "</td>\n")))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12109 field-buffer "\n")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12110 "</tr>\n"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12111 (setq head nil)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12112 (setq field-buffer nil)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12113 ;; Ignore this line
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12114 (throw 'next-line t)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12115 ;; 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
12116 (setq fields (org-split-string line "[ \t]*|[ \t]*"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12117 (if field-buffer
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12118 (setq field-buffer (mapcar
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12119 (lambda (x)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12120 (concat x "<br>" (pop fields)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12121 field-buffer))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12122 (setq field-buffer fields))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12123 (setq html (concat html "</table>\n"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12124 html))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12125
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12126 (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
12127 "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
12128 This has the advantage that cell- or row-spanning is allowed.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12129 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
12130 (require 'table)
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
12131 (with-current-buffer (get-buffer-create " org-tmp1 ")
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12132 (erase-buffer)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12133 (insert (mapconcat 'identity lines "\n"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12134 (goto-char (point-min))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12135 (if (not (re-search-forward "|[^+]" nil t))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12136 (error "Error processing table"))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12137 (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
12138 (with-current-buffer (get-buffer-create " org-tmp2 ") (erase-buffer))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12139 (table-generate-source 'html " org-tmp2 ")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12140 (set-buffer " org-tmp2 ")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12141 (buffer-substring (point-min) (point-max))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12142
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
12143 (defun org-html-protect (s)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
12144 ;; 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
12145 (let ((start 0))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
12146 (while (string-match "&" s start)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
12147 (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
12148 start (1+ (match-beginning 0))))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
12149 (while (string-match "<" s)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
12150 (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
12151 (while (string-match ">" s)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
12152 (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
12153 s)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
12154
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12155 (defun org-html-expand (string)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12156 "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
12157 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
12158 (let* (m s l res)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12159 (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
12160 (setq s (substring string 0 m)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12161 l (match-string 0 string)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12162 string (substring string (match-end 0)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12163 (push (org-html-do-expand s) res)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12164 (push l res))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12165 (push (org-html-do-expand string) res)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12166 (apply 'concat (nreverse res))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12167
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12168 (defun org-html-do-expand (s)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12169 "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
12170 (setq s (org-html-protect s))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12171 (if org-export-html-expand
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12172 (while (string-match "@&lt;\\([^&]*\\)&gt;" s)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12173 (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
12174 (if org-export-with-emphasize
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12175 (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
12176 (if org-export-with-sub-superscripts
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12177 (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
12178 (if org-export-with-TeX-macros
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12179 (let ((start 0) wd ass)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12180 (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
12181 (setq wd (match-string 1 s))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12182 (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
12183 (setq s (replace-match (or (cdr ass)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12184 (concat "&" (car ass) ";"))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12185 t t s))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12186 (setq start (+ start (length wd)))))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12187 s)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12188
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12189 (defun org-create-multibrace-regexp (left right n)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12190 "Create a regular expression which will match a balanced sexp.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12191 Opening delimiter is LEFT, and closing delimiter is RIGHT, both given
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12192 as single character strings.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12193 The regexp returned will match the entire expression including the
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12194 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
12195 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
12196 stacked delimiters is N. Escaping delimiters is not possible."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12197 (let* ((nothing (concat "[^" "\\" left "\\" right "]*?"))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12198 (or "\\|")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12199 (re nothing)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12200 (next (concat "\\(?:" nothing left nothing right "\\)+" nothing)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12201 (while (> n 1)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12202 (setq n (1- n)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12203 re (concat re or next)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12204 next (concat "\\(?:" nothing left next right "\\)+" nothing)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12205 (concat left "\\(" re "\\)" right)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12206
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12207 (defvar org-match-substring-regexp
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12208 (concat
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12209 "\\([^\\]\\)\\([_^]\\)\\("
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12210 "\\(" (org-create-multibrace-regexp "{" "}" org-match-sexp-depth) "\\)"
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 "\\(" (org-create-multibrace-regexp "(" ")" org-match-sexp-depth) "\\)"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12213 "\\|"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12214 "\\(\\(?:\\*\\|[-+]?[^-+*!@#$%^_ \t\r\n,:\"?<>~;./{}=()]+\\)\\)\\)")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12215 "The regular expression matching a sub- or superscript.")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12216
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12217 (defun org-export-html-convert-sub-super (string)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12218 "Convert sub- and superscripts in STRING to HTML."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12219 (let (key c)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12220 (while (string-match org-match-substring-regexp string)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12221 (setq key (if (string= (match-string 2 string) "_") "sub" "sup"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12222 (setq c (or (match-string 8 string)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12223 (match-string 6 string)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12224 (match-string 5 string)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12225 (setq string (replace-match
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12226 (concat (match-string 1 string)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12227 "<" key ">" c "</" key ">")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12228 t t string)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12229 (while (string-match "\\\\\\([_^]\\)" string)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12230 (setq string (replace-match (match-string 1 string) t t string))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12231 string)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12232
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12233 (defun org-export-html-convert-emphasize (string)
70132
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
12234 (while (string-match org-italic-re string)
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
12235 (setq string (replace-match "\\1<i>\\3</i>\\4" t nil string)))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
12236 (while (string-match org-bold-re string)
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
12237 (setq string (replace-match "\\1<b>\\3</b>\\4" t nil string)))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
12238 (while (string-match org-underline-re string)
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
12239 (setq string (replace-match "\\1<u>\\3</u>\\4" t nil string)))
f8b9335f0cad * org.el (org-deadline-announce): Face removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 70064
diff changeset
12240 string)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12241
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12242 (defun org-parse-key-lines ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12243 "Find the special key lines with the information for exporters."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12244 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12245 (goto-char 0)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12246 (let ((re (org-make-options-regexp
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12247 '("TITLE" "AUTHOR" "EMAIL" "TEXT" "OPTIONS" "LANGUAGE")))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12248 key)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12249 (while (re-search-forward re nil t)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12250 (setq key (match-string 1))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12251 (cond ((string-equal key "TITLE")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12252 (setq title (match-string 2)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12253 ((string-equal key "AUTHOR")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12254 (setq author (match-string 2)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12255 ((string-equal key "EMAIL")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12256 (setq email (match-string 2)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12257 ((string-equal key "LANGUAGE")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12258 (setq language (match-string 2)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12259 ((string-equal key "TEXT")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12260 (setq text (concat text "\n" (match-string 2))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12261 ((string-equal key "OPTIONS")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12262 (setq options (match-string 2))))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12263
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12264 (defun org-parse-export-options (s)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12265 "Parse the export options line."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12266 (let ((op '(("H" . org-export-headline-levels)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12267 ("num" . org-export-with-section-numbers)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12268 ("toc" . org-export-with-toc)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12269 ("\\n" . org-export-preserve-breaks)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12270 ("@" . org-export-html-expand)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12271 (":" . org-export-with-fixed-width)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12272 ("|" . org-export-with-tables)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12273 ("^" . org-export-with-sub-superscripts)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12274 ("*" . org-export-with-emphasize)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12275 ("TeX" . org-export-with-TeX-macros)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12276 o)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12277 (while (setq o (pop op))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12278 (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
12279 s)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12280 (set (make-local-variable (cdr o))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12281 (car (read-from-string (match-string 1 s))))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12282
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12283 (defun org-html-level-start (level title umax with-toc head-count)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12284 "Insert a new level in HTML export."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12285 (let ((l (1+ (max level umax))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12286 (while (<= l org-level-max)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12287 (if (aref levels-open (1- l))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12288 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12289 (org-html-level-close l)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12290 (aset levels-open (1- l) nil)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12291 (setq l (1+ l)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12292 (if (> level umax)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12293 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12294 (if (aref levels-open (1- level))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12295 (insert "<li>" title "<p>\n")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12296 (aset levels-open (1- level) t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12297 (insert "<ul><li>" title "<p>\n")))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12298 (if org-export-with-section-numbers
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12299 (setq title (concat (org-section-number level) " " title)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12300 (setq level (+ level 1))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12301 (if with-toc
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12302 (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
12303 level head-count title level))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12304 (insert (format "\n<H%d>%s</H%d>\n" level title level))))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12305
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
12306 (defun org-html-level-close (&rest args)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12307 "Terminate one level in HTML export."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12308 (insert "</ul>"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12309
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12310 ;; Variable holding the vector with section numbers
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12311 (defvar org-section-numbers (make-vector org-level-max 0))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12312
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12313 (defun org-init-section-numbers ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12314 "Initialize the vector for the section numbers."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12315 (let* ((level -1)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12316 (numbers (nreverse (org-split-string "" "\\.")))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12317 (depth (1- (length org-section-numbers)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12318 (i depth) number-string)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12319 (while (>= i 0)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12320 (if (> i level)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12321 (aset org-section-numbers i 0)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12322 (setq number-string (or (car numbers) "0"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12323 (if (string-match "\\`[A-Z]\\'" number-string)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12324 (aset org-section-numbers i
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12325 (- (string-to-char number-string) ?A -1))
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
12326 (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
12327 (pop numbers))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12328 (setq i (1- i)))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12329
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12330 (defun org-section-number (&optional level)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12331 "Return a string with the current section number.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12332 When LEVEL is non-nil, increase section numbers on that level."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12333 (let* ((depth (1- (length org-section-numbers))) idx n (string ""))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12334 (when level
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12335 (when (> level -1)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12336 (aset org-section-numbers
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12337 level (1+ (aref org-section-numbers level))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12338 (setq idx (1+ level))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12339 (while (<= idx depth)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12340 (if (not (= idx 1))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12341 (aset org-section-numbers idx 0))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12342 (setq idx (1+ idx))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12343 (setq idx 0)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12344 (while (<= idx depth)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12345 (setq n (aref org-section-numbers idx))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12346 (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
12347 (int-to-string n)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12348 (setq idx (1+ idx)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12349 (save-match-data
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12350 (if (string-match "\\`\\([@0]\\.\\)+" string)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12351 (setq string (replace-match "" nil nil string)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12352 (if (string-match "\\(\\.0\\)+\\'" string)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12353 (setq string (replace-match "" nil nil string))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12354 string))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12355
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12356
66262
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12357 (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
12358 "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
12359 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
12360 file, but with extension `.ics'."
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12361 (interactive)
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
12362 (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
12363
70010
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12364 (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
12365 "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
12366 (interactive)
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12367 (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
12368 (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
12369
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12370 (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
12371 (with-current-buffer buffer
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12372 (apply 'insert output)))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12373
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12374 (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
12375 "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
12376 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
12377 (interactive (list (current-buffer)))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12378 ;; A quickie abstraction
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12379
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12380 ;; Output everything as XOXO
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12381 (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
12382 (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
12383 (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
12384 ".xml"))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12385 (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
12386 (last-level 1)
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12387 (hanging-li nil))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12388 ;; 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
12389 (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
12390 ;; Kick off the output
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12391 (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
12392 (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
12393 (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
12394 (level (length hd))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12395 (text (concat
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12396 (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
12397 (save-excursion
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12398 (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
12399 (let ((str ""))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12400 (catch 'loop
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12401 (while 't
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12402 (forward-line)
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12403 (if (looking-at "^[ \t]\\(.*\\)")
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12404 (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
12405 (throw 'loop str)))))))))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12406
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12407 ;; Handle level rendering
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12408 (cond
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12409 ((> level last-level)
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12410 (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
12411
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12412 ((< level last-level)
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12413 (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
12414 (if hanging-li
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12415 (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
12416 (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
12417 (when hanging-li
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12418 (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
12419 (setq hanging-li nil)))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12420
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12421 ((equal level last-level)
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12422 (if hanging-li
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12423 (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
12424 )
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12425
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12426 (setq last-level level)
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12427
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12428 ;; 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
12429 (setq hanging-li 't)
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12430 (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
12431 (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
12432 (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
12433
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12434 ;; 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
12435 (dotimes (- last-level 1)
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12436 (if hanging-li
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12437 (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
12438 (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
12439
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12440 ;; 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
12441 (switch-to-buffer-other-window out)
70162
1f7b0f5ff852 (org-export-as-xoxo): Fix call to `indent-region'.
Carsten Dominik <dominik@science.uva.nl>
parents: 70161
diff changeset
12442 (indent-region (point-min) (point-max) nil)
70010
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12443 (save-buffer)
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12444 (goto-char (point-min))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12445 )))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12446
66262
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12447 ;;;###autoload
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12448 (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
12449 "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
12450 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
12451 file, but with extension `.ics'."
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12452 (interactive)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12453 (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
12454
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12455 ;;;###autoload
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12456 (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
12457 "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
12458 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
12459 (interactive)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12460 (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
12461
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12462 (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
12463 "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
12464 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
12465 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
12466 (save-excursion
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12467 (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
12468 (when combine
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12469 (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
12470 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
12471 (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
12472 (while (setq file (pop files))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12473 (catch 'nextfile
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12474 (org-check-agenda-file file)
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12475 (unless combine
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12476 (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
12477 (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
12478 (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
12479 (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
12480 (setq category (or org-category
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12481 (file-name-sans-extension
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
12482 (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
12483 (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
12484 (let ((standard-output ical-buffer))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12485 (if combine
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12486 (and (not started) (setq started t)
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
12487 (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
12488 (org-start-icalendar-file category))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12489 (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
12490 (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
12491 (org-finish-icalendar-file)
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12492 (set-buffer ical-buffer)
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12493 (save-buffer)
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12494 (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
12495 (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
12496
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12497 (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
12498 "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
12499 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
12500 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
12501 the iCalendar file.")
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12502
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12503 (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
12504 "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
12505 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
12506 (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
12507 (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
12508 (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
12509 "DTSTART"))
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
12510 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
12511 (save-excursion
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12512 (goto-char (point-min))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12513 (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
12514 (setq pos (match-beginning 0)
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12515 ts (match-string 0)
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12516 inc t
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12517 hd (org-get-heading))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12518 (if (looking-at re2)
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12519 (progn
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12520 (goto-char (match-end 0))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12521 (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
12522 (setq ts2 ts
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12523 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
12524 (- pos org-ds-keyword-length))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12525 pos)
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12526 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
12527 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
12528 ;; donep (org-entry-is-done-p)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
12529 ))
66262
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12530 (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
12531 (string-match org-ts-regexp hd))
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
12532 (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
12533 (if combine
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12534 (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
12535 (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
12536 (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
12537 (princ (format "BEGIN:VEVENT
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12538 %s
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12539 %s
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12540 SUMMARY:%s
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12541 END:VEVENT\n"
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12542 (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
12543 (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
12544 hd)))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12545 (when org-icalendar-include-todo
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12546 (goto-char (point-min))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12547 (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
12548 (setq state (match-string 1))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12549 (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
12550 (setq hd (match-string 3))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12551 (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
12552 (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
12553 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
12554 (substring hd (- (match-end 1)))))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12555 (setq pri org-default-priority))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12556 (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
12557 (- org-lowest-priority ?A))))))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12558
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12559 (princ (format "BEGIN:VTODO
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12560 %s
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12561 SUMMARY:%s
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12562 SEQUENCE:1
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12563 PRIORITY:%d
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12564 END:VTODO\n"
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12565 dts hd pri))))))))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12566
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12567 (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
12568 "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
12569 (let ((user user-full-name)
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12570 (name (or name "unknown"))
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
12571 (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
12572 (princ
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12573 (format "BEGIN:VCALENDAR
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12574 VERSION:2.0
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12575 X-WR-CALNAME:%s
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12576 PRODID:-//%s//Emacs with Org-mode//EN
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
12577 X-WR-TIMEZONE:%s
66262
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12578 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
12579
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12580 (defun org-finish-icalendar-file ()
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12581 "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
12582 (princ "END:VCALENDAR\n"))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12583
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12584 (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
12585 "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
12586 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
12587 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
12588 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
12589 (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
12590 t2 fmt have-time time)
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12591 (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
12592 (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
12593 (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
12594 (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
12595 (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
12596 (when inc
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12597 (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
12598 (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
12599 (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
12600 (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
12601
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12602
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12603 ;;; Key bindings
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12604
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12605 ;; - Bindings in Org-mode map are currently
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12606 ;; 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
12607 ;; abcd fgh j lmnopqrstuvwxyz!? #$ ^ -+*/= [] ; |,.<>~ '\t necessary bindings
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12608 ;; e (?) useful from outline-mode
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12609 ;; 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
12610 ;; 0123456789 % & ()_{} " ` free
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12611
65964
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
12612 ;; 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
12613 (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
12614
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12615 ;; 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
12616 (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
12617 (define-key org-mode-map [(tab)] 'org-cycle)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12618 (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
12619 (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
12620 ;; 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
12621 (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
12622 (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
12623 (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
12624
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12625 (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
12626 (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
12627 (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
12628 (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
12629 (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
12630 (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
12631 (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
12632
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12633 ;; 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
12634 (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
12635 (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
12636 (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
12637 (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
12638 (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
12639 (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
12640 (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
12641 (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
12642 (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
12643 (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
12644 (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
12645 (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
12646
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12647 (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
12648 (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
12649 (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
12650 (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
12651 (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
12652 (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
12653 (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
12654 (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
12655 (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
12656 (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
12657 (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
12658 (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
12659 (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
12660 (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
12661 (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
12662 (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
12663
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12664 ;; All the other keys
70161
b9e09a4a2168 (org-mode-map): Catch conflict with old allout.el.
Carsten Dominik <dominik@science.uva.nl>
parents: 70136
diff changeset
12665
b9e09a4a2168 (org-mode-map): Catch conflict with old allout.el.
Carsten Dominik <dominik@science.uva.nl>
parents: 70136
diff changeset
12666 (define-key org-mode-map "\C-c\C-a" 'show-all) ; in case allout messed up.
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
12667 (define-key org-mode-map "\C-c$" 'org-archive-subtree)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12668 (define-key org-mode-map "\C-c\C-j" 'org-goto)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12669 (define-key org-mode-map "\C-c\C-t" 'org-todo)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12670 (define-key org-mode-map "\C-c\C-s" 'org-schedule)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12671 (define-key org-mode-map "\C-c\C-d" 'org-deadline)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12672 (define-key org-mode-map "\C-c;" 'org-toggle-comment)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12673 (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
12674 (define-key org-mode-map "\C-c\C-w" 'org-check-deadlines)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12675 (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
12676 (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
12677 (define-key org-mode-map "\C-c\C-m" 'org-insert-heading)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12678 (define-key org-mode-map "\M-\C-m" 'org-insert-heading)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12679 (define-key org-mode-map "\C-c\C-l" 'org-insert-link)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12680 (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
12681 (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
12682 (define-key org-mode-map "\C-c&" 'org-mark-ring-goto)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12683 (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
12684 (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
12685 (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
12686 (define-key org-mode-map "\C-c," 'org-priority) ; Minor-mode reserved
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12687 (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
12688 (define-key org-mode-map "\C-c>" 'org-goto-calendar)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12689 (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
12690 (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
12691 (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
12692 (define-key org-mode-map "\C-c]" 'org-remove-file)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12693 (define-key org-mode-map "\C-c\C-r" 'org-timeline)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12694 (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
12695 (define-key org-mode-map "\C-c^" 'org-table-sort-lines)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12696 (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
12697 (define-key org-mode-map "\C-m" 'org-return)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12698 (define-key org-mode-map "\C-c?" 'org-table-current-column)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12699 (define-key org-mode-map "\C-c " 'org-table-blank-field)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12700 (define-key org-mode-map "\C-c+" 'org-table-sum)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12701 (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
12702 (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
12703 (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
12704 (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
12705 (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
12706 (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
12707 (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
12708 (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
12709 (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
12710 (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
12711 (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
12712 (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
12713 ;; 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
12714 ;(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
12715 ;(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
12716 (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
12717 (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
12718 (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
12719 (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
12720 (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
12721 (define-key org-mode-map "\C-c:" 'org-toggle-fixed-width-section)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12722 (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
12723 (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
12724 (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
12725 (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
12726 (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
12727
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
12728 (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
12729 (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
12730 (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
12731 (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
12732
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12733 (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
12734
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12735 (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
12736 "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
12737 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
12738 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
12739 (interactive "p")
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12740 (if (and (org-table-p)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12741 (progn
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12742 ;; 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
12743 (and org-table-auto-blank-field
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12744 (member last-command
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12745 '(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
12746 (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
12747 ;; 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
12748 (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
12749 ;; 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
12750 (org-table-blank-field)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12751 t)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12752 (eq N 1)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12753 (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
12754 (let (org-table-may-need-update)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12755 (goto-char (1- (match-end 0)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12756 (delete-backward-char 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12757 (goto-char (match-beginning 0))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12758 (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
12759 (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
12760 (self-insert-command N)))
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12761
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12762 (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
12763 "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
12764 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
12765 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
12766 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
12767 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
12768 (interactive "p")
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12769 (if (and (org-table-p)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12770 (eq N 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12771 (string-match "|" (buffer-substring (point-at-bol) (point)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12772 (looking-at ".*?|"))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12773 (let ((pos (point))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12774 (noalign (looking-at "[^|\n\r]* |"))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12775 (c org-table-may-need-update))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12776 (backward-delete-char N)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12777 (skip-chars-forward "^|")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12778 (insert " ")
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12779 (goto-char (1- pos))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12780 ;; 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
12781 ;; 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
12782 (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
12783 (backward-delete-char N)))
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12784
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12785 (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
12786 "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
12787 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
12788 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
12789 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
12790 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
12791 (interactive "p")
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12792 (if (and (org-table-p)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12793 (not (bolp))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12794 (not (= (char-after) ?|))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12795 (eq N 1))
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12796 (if (looking-at ".*?|")
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12797 (let ((pos (point))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12798 (noalign (looking-at "[^|\n\r]* |"))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12799 (c org-table-may-need-update))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12800 (replace-match (concat
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12801 (substring (match-string 0) 1 -1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12802 " |"))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12803 (goto-char pos)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12804 ;; 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
12805 ;; 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
12806 (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
12807 (delete-char N)))
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12808
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12809 ;; 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
12810 ;; 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
12811
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12812 (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
12813 "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
12814 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
12815 (let (new old)
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12816 (while commands
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12817 (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
12818 (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
12819 (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
12820 (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
12821
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12822 (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
12823 ;; 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
12824 ;; 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
12825 (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
12826 '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
12827 '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
12828 '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
12829 (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
12830
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12831 (defun org-shiftcursor-error ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12832 "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
12833 (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
12834
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12835 (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
12836 "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
12837 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
12838 See the individual commands for more information."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12839 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12840 (cond
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12841 ((org-at-table-p) (org-table-previous-field))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12842 (t (org-cycle '(4)))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12843
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
12844 (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
12845 "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
12846 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
12847 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
12848 (interactive)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12849 (cond
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
12850 ((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
12851 ((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
12852 ((org-at-item-p) (call-interactively 'org-outdent-item))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12853 (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
12854
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
12855 (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
12856 "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
12857 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
12858 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
12859 (interactive)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12860 (cond
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
12861 ((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
12862 ((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
12863 ((org-at-item-p) (call-interactively 'org-indent-item))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12864 (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
12865
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12866 (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
12867 "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
12868 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
12869 `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
12870 for more information."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12871 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12872 (cond
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
12873 ((org-at-table-p) (org-table-kill-row))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12874 ((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
12875 ((org-at-item-p) (org-move-item-up arg))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12876 (t (org-shiftcursor-error))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12877 (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
12878 "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
12879 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
12880 `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
12881 commands for more information."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12882 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12883 (cond
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12884 ((org-at-table-p) (org-table-insert-row arg))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12885 ((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
12886 ((org-at-item-p) (org-move-item-down arg))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12887 (t (org-shiftcursor-error))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12888
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12889 (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
12890 "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
12891 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
12892 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
12893 See the individual commands for more information."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12894 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12895 (cond
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12896 ((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
12897 ((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
12898 (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
12899
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12900 (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
12901 "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
12902 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
12903 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
12904 See the individual commands for more information."
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 (cond
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12907 ((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
12908 ((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
12909 (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
12910
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12911 (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
12912 "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
12913 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
12914 `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
12915 for more information."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12916 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12917 (cond
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12918 ((org-at-table-p) (org-table-move-row 'up))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12919 ((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
12920 ((org-at-item-p) (org-move-item-up arg))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12921 (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
12922
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12923 (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
12924 "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
12925 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
12926 `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
12927 commands for more information."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12928 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12929 (cond
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12930 ((org-at-table-p) (org-table-move-row nil))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12931 ((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
12932 ((org-at-item-p) (org-move-item-down arg))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12933 (t (org-shiftcursor-error))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12934
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12935 (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
12936 "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
12937 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
12938 See the individual commands for more information."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12939 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12940 (cond
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12941 ((org-at-timestamp-p) (org-timestamp-up arg))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12942 (t (org-priority-up))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12943
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12944 (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
12945 "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
12946 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
12947 See the individual commands for more information."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12948 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12949 (cond
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12950 ((org-at-timestamp-p) (org-timestamp-down arg))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12951 (t (org-priority-down))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12952
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
12953 (defun org-shiftright ()
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
12954 "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
12955 (interactive)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
12956 (cond
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
12957 ((org-at-timestamp-p) (org-timestamp-up-day))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
12958 ((org-on-heading-p) (org-todo 'right))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
12959 (t (org-shiftcursor-error))))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
12960
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
12961 (defun org-shiftleft ()
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
12962 "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
12963 (interactive)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
12964 (cond
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
12965 ((org-at-timestamp-p) (org-timestamp-down-day))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
12966 ((org-on-heading-p) (org-todo 'left))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
12967 (t (org-shiftcursor-error))))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
12968
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
12969 (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
12970 "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
12971 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
12972 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
12973 (interactive)
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
12974 (call-interactively
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12975 (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
12976
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
12977 (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
12978 "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
12979 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
12980 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
12981 (interactive)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12982 (call-interactively
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12983 (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
12984
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12985 (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
12986 "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
12987 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
12988 See the individual commands for more information."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12989 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12990 (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
12991 (org-table-paste-rectangle)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12992 (org-paste-subtree arg)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12993
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12994 (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
12995 "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
12996
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
12997 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
12998
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
12999 - 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
13000 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
13001 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
13002
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
13003 - 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
13004 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
13005 information.
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
13006
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
13007 - 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
13008 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
13009
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
13010 - 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
13011 the entire table.
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
13012
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
13013 - 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
13014 activate that table.
69997
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
13015
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
13016 - 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
13017 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
13018 location.
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
13019
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
13020 - 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
13021 links in this buffer.
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
13022
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
13023 - 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
13024 ordered list."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13025 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13026 (let ((org-enable-table-editor t))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13027 (cond
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13028 ((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
13029 (fboundp org-finish-function))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13030 (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
13031 ((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
13032 ((org-on-heading-p) (org-set-tags arg))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13033 ((org-at-table.el-p)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13034 (require 'table)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13035 (beginning-of-line 1)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
13036 (re-search-forward "|" (save-excursion (end-of-line 2) (point)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13037 (table-recognize-table))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13038 ((org-at-table-p)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
13039 (org-table-maybe-eval-formula)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
13040 (if arg
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13041 (org-table-recalculate t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13042 (org-table-maybe-recalculate-line))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13043 (org-table-align))
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
13044 ((org-at-item-p)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
13045 (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
13046 ((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
13047 (cond
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
13048 ((equal (match-string 1) "TBLFM")
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13049 ;; Recalculate the table before this line
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13050 (save-excursion
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13051 (beginning-of-line 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13052 (skip-chars-backward " \r\n\t")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13053 (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
13054 (t
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
13055 (org-mode-restart))))
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
13056 (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
13057
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
13058 (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
13059 "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
13060 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
13061 (interactive)
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
13062 (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
13063 (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
13064
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
13065 (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
13066 "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
13067 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
13068 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
13069 (interactive)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13070 (cond
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
13071 ((org-at-table-p)
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
13072 (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
13073 (org-table-next-row))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13074 (t (newline))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13075
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
13076 (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
13077 "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
13078 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
13079 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
13080 (interactive "P")
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
13081 (cond
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
13082 ((org-at-table-p)
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
13083 (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
13084 (t (org-insert-heading arg))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13085
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13086 ;;; Menu entries
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13087
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13088 ;; Define the Org-mode menus
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
13089 (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
13090 '("Tbl"
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
13091 ["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
13092 ["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
13093 ["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
13094 ["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
13095 "--"
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
13096 ["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
13097 ["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
13098 ["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
13099 "--"
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
13100 ("Column"
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
13101 ["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
13102 ["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
13103 ["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
13104 ["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
13105 "--"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13106 ["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
13107 ("Row"
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
13108 ["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
13109 ["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
13110 ["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
13111 ["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
13112 ["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
13113 "--"
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
13114 ["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
13115 ("Rectangle"
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
13116 ["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
13117 ["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
13118 ["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
13119 ["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
13120 "--"
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
13121 ("Calculate"
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
13122 ["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
13123 ["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
13124 ["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
13125 "--"
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
13126 ["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
13127 ["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
13128 ["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
13129 "--"
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
13130 ["Sum Column/Rectangle" org-table-sum
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
13131 (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
13132 ["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
13133 ["Debug Formulas"
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
13134 (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
13135 :style toggle :selected org-table-formula-debug]
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
13136 "--"
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
13137 ["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
13138 org-enable-table-editor)]
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13139 ["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
13140 ["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
13141 ["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
13142 "--"
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
13143 ["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
13144
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13145 (easy-menu-define org-org-menu org-mode-map "Org menu"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13146 '("Org"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13147 ["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
13148 ["Cycle Global Visibility" org-shifttab (not (org-at-table-p))]
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13149 ["Sparse Tree" org-occur t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13150 ["Show All" show-all t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13151 "--"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13152 ["New Heading" org-insert-heading t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13153 ("Navigate Headings"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13154 ["Up" outline-up-heading t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13155 ["Next" outline-next-visible-heading t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13156 ["Previous" outline-previous-visible-heading t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13157 ["Next Same Level" outline-forward-same-level t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13158 ["Previous Same Level" outline-backward-same-level t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13159 "--"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13160 ["Jump" org-goto t])
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13161 ("Edit Structure"
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
13162 ["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
13163 ["Move Subtree Down" org-shiftmetadown (not (org-at-table-p))]
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13164 "--"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13165 ["Copy Subtree" org-copy-special (not (org-at-table-p))]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13166 ["Cut Subtree" org-cut-special (not (org-at-table-p))]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13167 ["Paste Subtree" org-paste-special (not (org-at-table-p))]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13168 "--"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13169 ["Promote Heading" org-metaleft (not (org-at-table-p))]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13170 ["Promote Subtree" org-shiftmetaleft (not (org-at-table-p))]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13171 ["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
13172 ["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
13173 "--"
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
13174 ["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
13175 "--"
69454
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
13176 ["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
13177 ["Convert to odd/even levels" org-convert-to-oddeven-levels t])
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13178 "--"
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
13179 ("TODO Lists"
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13180 ["TODO/DONE/-" org-todo t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13181 ["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
13182 ["Global TODO list" org-todo-list t]
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13183 "--"
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
13184 ["Set Priority" org-priority t]
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
13185 ["Priority Up" org-shiftup t]
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
13186 ["Priority Down" org-shiftdown t])
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13187 ("Dates and Scheduling"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13188 ["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
13189 ["Timestamp (inactive)" org-time-stamp-inactive t]
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13190 ("Change Date"
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
13191 ["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
13192 ["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
13193 ["1 ... Later" org-shiftup t]
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
13194 ["1 ... Earlier" org-shiftdown t])
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13195 ["Compute Time Range" org-evaluate-time-range t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13196 ["Schedule Item" org-schedule t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13197 ["Deadline" org-deadline t]
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 ["Goto Calendar" org-goto-calendar t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13200 ["Date from Calendar" org-date-from-calendar t])
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13201 "--"
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
13202 ["Agenda Command" org-agenda t]
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
13203 ("File List for Agenda")
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
13204 ("Special views current file"
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
13205 ["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
13206 ["Check Deadlines" org-check-deadlines t]
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
13207 ["Timeline" org-timeline t]
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
13208 ["Tags Tree" org-tags-sparse-tree t])
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13209 "--"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13210 ("Hyperlinks"
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
13211 ["Store Link (Global)" org-store-link t]
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13212 ["Insert Link" org-insert-link t]
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13213 ["Follow Link" org-open-at-point t]
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13214 "--"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13215 ["Descriptive Links"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13216 (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
13217 :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
13218 ["Literal Links"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13219 (progn
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13220 (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
13221 :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
13222 "--"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13223 ["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
13224 (save-excursion (goto-char (point-min))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13225 (re-search-forward "<[a-z]+:" nil t))])
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13226 "--"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13227 ("Export"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13228 ["ASCII" org-export-as-ascii t]
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
13229 ["Extract Visible Text" org-export-copy-visible t]
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13230 ["HTML" org-export-as-html t]
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
13231 ["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
13232 ["XML (XOXO)" org-export-as-xml t]
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13233 "--"
66262
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
13234 ["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
13235 ["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
13236 :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
13237 ["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
13238 "--"
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
13239 ["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
13240 ["Toggle Fixed Width" org-toggle-fixed-width-section t])
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13241 "--"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13242 ("Documentation"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13243 ["Show Version" org-version t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13244 ["Info Documentation" org-info t])
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13245 ("Customize"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13246 ["Browse Org Group" org-customize t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13247 "--"
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13248 ["Expand This Menu" org-create-customize-menu
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13249 (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
13250 "--"
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
13251 ["Refresh setup" org-mode-restart t]
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13252 ))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13253
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13254 (defun org-info (&optional node)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13255 "Read documentation for Org-mode in the info system.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13256 With optional NODE, go directly to that node."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13257 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13258 (require 'info)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13259 (Info-goto-node (format "(org)%s" (or node ""))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13260
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13261 (defun org-install-agenda-files-menu ()
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13262 (let ((bl (buffer-list)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13263 (save-excursion
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13264 (while bl
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13265 (set-buffer (pop bl))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13266 (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
13267 (when (eq major-mode 'org-mode)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13268 (easy-menu-change
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13269 '("Org") "File List for Agenda"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13270 (append
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13271 (list
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13272 ["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
13273 ["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
13274 ["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
13275 ["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
13276 "--")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13277 (mapcar 'org-file-menu-entry (org-agenda-files t))))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13278
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13279 ;;; Documentation
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-customize ()
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13282 "Call the customize function with org as argument."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13283 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13284 (customize-browse 'org))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13285
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13286 (defun org-create-customize-menu ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13287 "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
13288 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13289 (if (fboundp 'customize-menu-create)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13290 (progn
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13291 (easy-menu-change
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13292 '("Org") "Customize"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13293 `(["Browse Org group" org-customize t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13294 "--"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13295 ,(customize-menu-create 'org)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13296 ["Set" Custom-set t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13297 ["Save" Custom-save t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13298 ["Reset to Current" Custom-reset-current t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13299 ["Reset to Saved" Custom-reset-saved t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13300 ["Reset to Standard Settings" Custom-reset-standard t]))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13301 (message "\"Org\"-menu now contains full customization menu"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13302 (error "Cannot expand menu (outdated version of cus-edit.el)")))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13303
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13304 ;;; Miscellaneous stuff
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13305
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13306 (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
13307 "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
13308 (interactive "p")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13309 (let ((col (current-column))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13310 beg end pos)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13311 (beginning-of-line 1) (setq beg (point))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13312 (beginning-of-line 2) (setq end (point))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13313 (beginning-of-line (+ 1 arg))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13314 (setq pos (move-marker (make-marker) (point)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13315 (insert (delete-and-extract-region beg end))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13316 (goto-char pos)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13317 (move-to-column col)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13318
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13319 (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
13320 "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
13321 (interactive "p")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13322 (let ((col (current-column))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13323 beg end pos)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13324 (beginning-of-line 1) (setq beg (point))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13325 (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
13326 (beginning-of-line (- arg))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13327 (setq pos (move-marker (make-marker) (point)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13328 (insert (delete-and-extract-region beg end))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13329 (goto-char pos)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13330 (move-to-column col)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13331
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13332 ;; Paragraph filling stuff.
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13333 ;; 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
13334 ;; 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
13335 ;; filladapt package works slightly differently.
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13336
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13337 (defun org-set-autofill-regexps ()
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13338 (interactive)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13339 ;; 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
13340 ;; 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
13341 ;; fill the headline as well.
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13342 (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
13343 ;; The paragraph starter includes hand-formatted lists.
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13344 (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
13345 "\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
13346 ;; 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
13347 ;; 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
13348 (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
13349 (concat "\\*\\|#"
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13350 (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
13351 (concat
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13352 "\\|[ \t]*["
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13353 (if org-enable-table-editor "|" "")
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13354 (if org-enable-fixed-width-editor ":" "")
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13355 "]"))))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13356 ;; 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
13357 ;; 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
13358 ;; through to `fill-paragraph' when appropriate.
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13359 (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
13360 ;; Adaptive filling: To get full control, first make sure that
70018
513397bbb13c *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 70017
diff changeset
13361 ;; `adaptive-fill-regexp' never matches. Then install our own matcher.
70017
65315013f21a *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 70016
diff changeset
13362 (set (make-local-variable 'adaptive-fill-regexp) "\000")
65315013f21a *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 70016
diff changeset
13363 (set (make-local-variable 'adaptive-fill-function)
65315013f21a *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 70016
diff changeset
13364 'org-adaptive-fill-function))
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13365
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13366 (defun org-fill-paragraph (&optional justify)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13367 "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
13368 (let ((table-p (org-at-table-p))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13369 (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
13370 (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
13371 (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
13372 (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
13373 (t nil)))) ; call paragraph-fill
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13374
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13375 ;; 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
13376 ;; "[ \t]*\\([-|#;>*]+[ \t]*\\|(?[0-9]+[.)][ \t]*\\)*"
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13377
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13378 (defun org-adaptive-fill-function ()
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13379 "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
13380 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
13381 work correctly."
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
13382 (if (looking-at " *\\([-*+] \\|[0-9]+[.)] \\)?")
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13383 (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
13384
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13385 ;; Functions needed for Emacs/XEmacs region compatibility
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13386
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
13387 (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
13388 "Add-hook, compatible with both Emacsen."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13389 (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
13390 (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
13391 (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
13392
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13393 (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
13394 "Is `transient-mark-mode' on and the region active?
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13395 Works on both Emacs and XEmacs."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13396 (if org-ignore-region
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13397 nil
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13398 (if (featurep 'xemacs)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13399 (and zmacs-regions (region-active-p))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13400 (and transient-mark-mode mark-active))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13401
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13402 (defun org-add-to-invisibility-spec (arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13403 "Add elements to `buffer-invisibility-spec'.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13404 See documentation for `buffer-invisibility-spec' for the kind of elements
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13405 that can be added."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13406 (cond
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13407 ((fboundp 'add-to-invisibility-spec)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13408 (add-to-invisibility-spec arg))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13409 ((or (null buffer-invisibility-spec) (eq buffer-invisibility-spec t))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13410 (setq buffer-invisibility-spec (list arg)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13411 (t
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13412 (setq buffer-invisibility-spec
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13413 (cons arg buffer-invisibility-spec)))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13414
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13415 (defun org-remove-from-invisibility-spec (arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13416 "Remove elements from `buffer-invisibility-spec'."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13417 (if (fboundp 'remove-from-invisibility-spec)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13418 (remove-from-invisibility-spec arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13419 (if (consp buffer-invisibility-spec)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13420 (setq buffer-invisibility-spec
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13421 (delete arg buffer-invisibility-spec)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13422
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13423 (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
13424 "Is ARG a member of `buffer-invisibility-spec'?"
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13425 (if (consp buffer-invisibility-spec)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13426 (member arg buffer-invisibility-spec)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13427 nil))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13428
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13429 (defun org-image-file-name-regexp ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13430 "Return regexp matching the file names of images."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13431 (if (fboundp 'image-file-name-regexp)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13432 (image-file-name-regexp)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13433 (let ((image-file-name-extensions
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13434 '("png" "jpeg" "jpg" "gif" "tiff" "tif"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13435 "xbm" "xpm" "pbm" "pgm" "ppm")))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13436 (concat "\\."
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13437 (regexp-opt (nconc (mapcar 'upcase
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13438 image-file-name-extensions)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13439 image-file-name-extensions)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13440 t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13441 "\\'"))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13442
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
13443 ;; 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
13444
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
13445 ;; 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
13446 ;; 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
13447 ;; 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
13448 ;; 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
13449 ;; treatment when the old outline.el is being used.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13450
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13451 ;; 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
13452 ;; 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
13453 ;; 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
13454 ;; `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
13455
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13456 ;; 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
13457 ;; new outline.el. I guess this should be patched into Emacs?
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13458 (defun org-beginning-of-line ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13459 "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
13460 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
13461 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13462 (beginning-of-line 1)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13463 (if (bobp)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13464 nil
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13465 (backward-char 1)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13466 (if (org-invisible-p)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13467 (while (and (not (bobp)) (org-invisible-p))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13468 (backward-char 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13469 (beginning-of-line 1))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13470 (forward-char 1))))
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
13471
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13472 (when org-noutline-p
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13473 (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
13474 ;; 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
13475 ;; of beginning-of-line?
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13476
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13477 (defun org-invisible-p ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13478 "Check if point is at a character currently not visible."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13479 (if org-noutline-p
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13480 ;; Early versions of noutline don't have `outline-invisible-p'.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13481 (if (fboundp 'outline-invisible-p)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13482 (outline-invisible-p)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13483 (get-char-property (point) 'invisible))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13484 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13485 (skip-chars-backward "^\r\n")
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
13486 (equal (char-before) ?\r))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13487
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
13488 (defun org-invisible-p2 ()
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
13489 "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
13490 (save-excursion
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
13491 (if org-noutline-p
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
13492 (progn
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
13493 (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
13494 ;; 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
13495 (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
13496 (outline-invisible-p)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
13497 (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
13498 (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
13499 (equal (char-before) ?\r))))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
13500
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13501 (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
13502 "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
13503 Only visible heading lines are considered, unless INVISIBLE-OK is non-nil."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13504 (if org-noutline-p
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13505 (outline-back-to-heading invisible-ok)
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
13506 (if (and (memq (char-before) '(?\n ?\r))
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
13507 (looking-at outline-regexp))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13508 t
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
13509 (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
13510 outline-regexp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13511 nil t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13512 (if invisible-ok
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13513 (progn (goto-char (match-end 1))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13514 (looking-at outline-regexp)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13515 (error "Before first heading")))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13516
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13517 (defun org-on-heading-p (&optional invisible-ok)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13518 "Return t if point is on a (visible) heading line.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13519 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
13520 (if org-noutline-p
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13521 (outline-on-heading-p 'invisible-ok)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13522 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13523 (skip-chars-backward "^\n\r")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13524 (and (looking-at outline-regexp)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13525 (or invisible-ok
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13526 (bobp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13527 (equal (char-before) ?\n))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13528
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
13529 (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
13530 (let ((pos (point)))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
13531 (save-excursion
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
13532 (skip-chars-forward "<")
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
13533 (and (re-search-backward "<<" nil t)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13534 (or (looking-at org-radio-target-regexp)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13535 (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
13536 (<= (match-beginning 0) pos)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13537 (>= (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
13538
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13539 (defun org-up-heading-all (arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13540 "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
13541 This function considers both visible and invisible heading lines.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13542 With argument, move up ARG levels."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13543 (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
13544 (if (fboundp 'outline-up-heading-all)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13545 (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
13546 (outline-up-heading arg t)) ; emacs 22 version of outline.el
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13547 (org-back-to-heading t)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13548 (looking-at outline-regexp)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13549 (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
13550 (error "Cannot move up %d levels" arg)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13551 (re-search-backward
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13552 (concat "[\n\r]" (regexp-quote
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13553 (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
13554 ?*))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13555 "[^*]"))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13556 (forward-char 1))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13557
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13558 (defun org-show-hidden-entry ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13559 "Show an entry where even the heading is hidden."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13560 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13561 (if (not org-noutline-p)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13562 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13563 (org-back-to-heading t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13564 (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
13565 (org-show-entry)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13566
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13567 (defun org-check-occur-regexp (regexp)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13568 "If REGEXP starts with \"^\", modify it to check for \\r as well.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13569 Of course, only for the old outline mode."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13570 (if org-noutline-p
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13571 regexp
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13572 (if (string-match "^\\^" regexp)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13573 (concat "[\n\r]" (substring regexp 1))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13574 regexp)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13575
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13576 (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
13577 "Flag the current heading. FLAG non-nil means make invisible.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13578 When ENTRY is non-nil, show the entire entry."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13579 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13580 (org-back-to-heading t)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13581 (if (not org-noutline-p)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13582 ;; Make the current headline visible
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13583 (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
13584 ;; Check if we should show the entire entry
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13585 (if entry
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13586 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13587 (org-show-entry)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13588 (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
13589 ;; middle of text? |
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13590 (and (outline-next-heading) ;; |
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13591 (org-flag-heading nil)))) ; show the next heading _|
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13592 (outline-flag-region (max 1 (1- (point)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13593 (save-excursion (outline-end-of-heading) (point))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13594 (if org-noutline-p
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13595 flag
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13596 (if flag ?\r ?\n))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13597
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
13598 (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
13599 ;; 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
13600 ;; `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
13601 ;; 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
13602 ;; 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
13603 (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
13604 (let ((first t)
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
13605 (level (funcall outline-level)))
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
13606 (while (and (not (eobp))
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
13607 (or first (> (funcall outline-level) level)))
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
13608 (setq first nil)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
13609 (outline-next-heading))
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
13610 (if (memq (preceding-char) '(?\n ?\^M))
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
13611 (progn
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
13612 ;; Go to end of line before heading
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
13613 (forward-char -1)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
13614 (if (memq (preceding-char) '(?\n ?\^M))
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
13615 ;; leave blank line before heading
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
13616 (forward-char -1))))))
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
13617
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
13618 (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
13619 "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
13620 (outline-flag-region
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
13621 (point)
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
13622 (save-excursion
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
13623 (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
13624 (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
13625
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
13626 (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
13627 "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
13628 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
13629 (interactive)
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
13630 (save-excursion
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
13631 (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
13632 (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
13633 (1- (point))
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
13634 (save-excursion
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
13635 (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
13636 (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
13637 (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
13638
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13639 (defun org-make-options-regexp (kwds)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13640 "Make a regular expression for keyword lines."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13641 (concat
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13642 (if org-noutline-p "^" "[\n\r]")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13643 "#?[ \t]*\\+\\("
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13644 (mapconcat 'regexp-quote kwds "\\|")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13645 "\\):[ \t]*"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13646 (if org-noutline-p "\\(.+\\)" "\\([^\n\r]+\\)")))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13647
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13648 ;; Make `bookmark-jump' show the jump location if it was hidden.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13649 (eval-after-load "bookmark"
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13650 '(if (boundp 'bookmark-after-jump-hook)
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13651 ;; We can use the hook
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13652 (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
13653 ;; Hook not available, use advice
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13654 (defadvice bookmark-jump (after org-make-visible activate)
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13655 "Make the position visible."
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13656 (org-bookmark-jump-unhide))))
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13657
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13658 (defun org-bookmark-jump-unhide ()
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13659 "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
13660 (and (eq major-mode 'org-mode)
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13661 (or (org-invisible-p)
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13662 (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
13663 (org-invisible-p)))
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13664 (org-show-hierarchy-above)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13665
68245
1a47b5a03b4a Move defvars out of eval-when-compile. Move code
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 68175
diff changeset
13666 ;;; Finish up
1a47b5a03b4a Move defvars out of eval-when-compile. Move code
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 68175
diff changeset
13667
1a47b5a03b4a Move defvars out of eval-when-compile. Move code
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 68175
diff changeset
13668 (provide 'org)
1a47b5a03b4a Move defvars out of eval-when-compile. Move code
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 68175
diff changeset
13669
1a47b5a03b4a Move defvars out of eval-when-compile. Move code
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 68175
diff changeset
13670 (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
13671
1a47b5a03b4a Move defvars out of eval-when-compile. Move code
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 68175
diff changeset
13672 ;; 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
13673 ;;; 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
13674