diff options
| author | Carsten Dominik | 2010-11-11 22:10:19 -0600 |
|---|---|---|
| committer | Carsten Dominik | 2010-11-11 22:10:19 -0600 |
| commit | afe98dfa700de5cf0493e8bf95b7d894e2734e47 (patch) | |
| tree | 92a812b353bb09c1286e8a44fb552de9f1af3384 /lisp/org/org.el | |
| parent | df26e1f58a7e484b7ed500ea48d0e1c49345ffbf (diff) | |
| download | emacs-afe98dfa700de5cf0493e8bf95b7d894e2734e47.tar.gz emacs-afe98dfa700de5cf0493e8bf95b7d894e2734e47.zip | |
Install org-mode version 7.3
Diffstat (limited to 'lisp/org/org.el')
| -rw-r--r-- | lisp/org/org.el | 1081 |
1 files changed, 689 insertions, 392 deletions
diff --git a/lisp/org/org.el b/lisp/org/org.el index 19759371023..f7e7c9fd2f4 100644 --- a/lisp/org/org.el +++ b/lisp/org/org.el | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | ;; Author: Carsten Dominik <carsten at orgmode dot org> | 6 | ;; Author: Carsten Dominik <carsten at orgmode dot org> |
| 7 | ;; Keywords: outlines, hypermedia, calendar, wp | 7 | ;; Keywords: outlines, hypermedia, calendar, wp |
| 8 | ;; Homepage: http://orgmode.org | 8 | ;; Homepage: http://orgmode.org |
| 9 | ;; Version: 7.01 | 9 | ;; Version: 7.3 |
| 10 | ;; | 10 | ;; |
| 11 | ;; This file is part of GNU Emacs. | 11 | ;; This file is part of GNU Emacs. |
| 12 | ;; | 12 | ;; |
| @@ -86,10 +86,6 @@ | |||
| 86 | (unless (boundp 'diary-fancy-buffer) | 86 | (unless (boundp 'diary-fancy-buffer) |
| 87 | (defvaralias 'diary-fancy-buffer 'fancy-diary-buffer))) | 87 | (defvaralias 'diary-fancy-buffer 'fancy-diary-buffer))) |
| 88 | 88 | ||
| 89 | ;; For XEmacs, noutline is not yet provided by outline.el, so arrange for | ||
| 90 | ;; the file noutline.el being loaded. | ||
| 91 | (if (featurep 'xemacs) (condition-case nil (require 'noutline))) | ||
| 92 | ;; We require noutline, which might be provided in outline.el | ||
| 93 | (require 'outline) (require 'noutline) | 89 | (require 'outline) (require 'noutline) |
| 94 | ;; Other stuff we need. | 90 | ;; Other stuff we need. |
| 95 | (require 'time-date) | 91 | (require 'time-date) |
| @@ -151,6 +147,7 @@ requirements) is loaded." | |||
| 151 | (const :tag "C" C) | 147 | (const :tag "C" C) |
| 152 | (const :tag "R" R) | 148 | (const :tag "R" R) |
| 153 | (const :tag "Asymptote" asymptote) | 149 | (const :tag "Asymptote" asymptote) |
| 150 | (const :tag "Calc" calc) | ||
| 154 | (const :tag "Clojure" clojure) | 151 | (const :tag "Clojure" clojure) |
| 155 | (const :tag "CSS" css) | 152 | (const :tag "CSS" css) |
| 156 | (const :tag "Ditaa" ditaa) | 153 | (const :tag "Ditaa" ditaa) |
| @@ -158,15 +155,20 @@ requirements) is loaded." | |||
| 158 | (const :tag "Emacs Lisp" emacs-lisp) | 155 | (const :tag "Emacs Lisp" emacs-lisp) |
| 159 | (const :tag "Gnuplot" gnuplot) | 156 | (const :tag "Gnuplot" gnuplot) |
| 160 | (const :tag "Haskell" haskell) | 157 | (const :tag "Haskell" haskell) |
| 158 | (const :tag "Javascript" js) | ||
| 161 | (const :tag "Latex" latex) | 159 | (const :tag "Latex" latex) |
| 160 | (const :tag "Ledger" ledger) | ||
| 162 | (const :tag "Matlab" matlab) | 161 | (const :tag "Matlab" matlab) |
| 163 | (const :tag "Mscgen" mscgen) | 162 | (const :tag "Mscgen" mscgen) |
| 164 | (const :tag "Ocaml" ocaml) | 163 | (const :tag "Ocaml" ocaml) |
| 165 | (const :tag "Octave" octave) | 164 | (const :tag "Octave" octave) |
| 165 | (const :tag "Org" org) | ||
| 166 | (const :tag "Perl" perl) | 166 | (const :tag "Perl" perl) |
| 167 | (const :tag "PlantUML" plantuml) | ||
| 167 | (const :tag "Python" python) | 168 | (const :tag "Python" python) |
| 168 | (const :tag "Ruby" ruby) | 169 | (const :tag "Ruby" ruby) |
| 169 | (const :tag "Sass" sass) | 170 | (const :tag "Sass" sass) |
| 171 | (const :tag "Scheme" scheme) | ||
| 170 | (const :tag "Screen" screen) | 172 | (const :tag "Screen" screen) |
| 171 | (const :tag "Shell Script" sh) | 173 | (const :tag "Shell Script" sh) |
| 172 | (const :tag "Sql" sql) | 174 | (const :tag "Sql" sql) |
| @@ -184,7 +186,7 @@ identifier." | |||
| 184 | 186 | ||
| 185 | ;;; Version | 187 | ;;; Version |
| 186 | 188 | ||
| 187 | (defconst org-version "7.01" | 189 | (defconst org-version "7.3" |
| 188 | "The version number of the file org.el.") | 190 | "The version number of the file org.el.") |
| 189 | 191 | ||
| 190 | (defun org-version (&optional here) | 192 | (defun org-version (&optional here) |
| @@ -295,6 +297,7 @@ to add the symbol `xyz', and the package must have a call to | |||
| 295 | (const :tag " wl: Links to Wanderlust folders/messages" org-wl) | 297 | (const :tag " wl: Links to Wanderlust folders/messages" org-wl) |
| 296 | (const :tag " w3m: Special cut/paste from w3m to Org-mode." org-w3m) | 298 | (const :tag " w3m: Special cut/paste from w3m to Org-mode." org-w3m) |
| 297 | (const :tag " mouse: Additional mouse support" org-mouse) | 299 | (const :tag " mouse: Additional mouse support" org-mouse) |
| 300 | (const :tag " TaskJuggler: Export tasks to a TaskJuggler project" org-taskjuggler) | ||
| 298 | 301 | ||
| 299 | (const :tag "C annotate-file: Annotate a file with org syntax" org-annotate-file) | 302 | (const :tag "C annotate-file: Annotate a file with org syntax" org-annotate-file) |
| 300 | (const :tag "C bookmark: Org-mode links to bookmarks" org-bookmark) | 303 | (const :tag "C bookmark: Org-mode links to bookmarks" org-bookmark) |
| @@ -328,7 +331,8 @@ to add the symbol `xyz', and the package must have a call to | |||
| 328 | (const :tag "C sqlinsert: Convert Org-mode tables to SQL insertions" orgtbl-sqlinsert) | 331 | (const :tag "C sqlinsert: Convert Org-mode tables to SQL insertions" orgtbl-sqlinsert) |
| 329 | (const :tag "C toc: Table of contents for Org-mode buffer" org-toc) | 332 | (const :tag "C toc: Table of contents for Org-mode buffer" org-toc) |
| 330 | (const :tag "C track: Keep up with Org-mode development" org-track) | 333 | (const :tag "C track: Keep up with Org-mode development" org-track) |
| 331 | (const :tag "C TaskJuggler: Export tasks to a TaskJuggler project" org-taskjuggler) | 334 | (const :tag "C velocity Something like Notational Velocity for Org" org-velocity) |
| 335 | (const :tag "C wikinodes: CamelCase wiki-like links" org-wikinodes) | ||
| 332 | (repeat :tag "External packages" :inline t (symbol :tag "Package")))) | 336 | (repeat :tag "External packages" :inline t (symbol :tag "Package")))) |
| 333 | 337 | ||
| 334 | (defcustom org-support-shift-select nil | 338 | (defcustom org-support-shift-select nil |
| @@ -468,6 +472,15 @@ the following lines anywhere in the buffer: | |||
| 468 | :group 'org-startup | 472 | :group 'org-startup |
| 469 | :type 'boolean) | 473 | :type 'boolean) |
| 470 | 474 | ||
| 475 | (defcustom org-startup-with-inline-images nil | ||
| 476 | "Non-nil means show inline images when loading a new Org file. | ||
| 477 | This can also be configured on a per-file basis by adding one of | ||
| 478 | the following lines anywhere in the buffer: | ||
| 479 | #+STARTUP: inlineimages | ||
| 480 | #+STARTUP: noinlineimages" | ||
| 481 | :group 'org-startup | ||
| 482 | :type 'boolean) | ||
| 483 | |||
| 471 | (defcustom org-insert-mode-line-in-empty-file nil | 484 | (defcustom org-insert-mode-line-in-empty-file nil |
| 472 | "Non-nil means insert the first line setting Org-mode in empty files. | 485 | "Non-nil means insert the first line setting Org-mode in empty files. |
| 473 | When the function `org-mode' is called interactively in an empty file, this | 486 | When the function `org-mode' is called interactively in an empty file, this |
| @@ -1064,9 +1077,13 @@ for the duration of the command." | |||
| 1064 | (plain-list-item . auto)) | 1077 | (plain-list-item . auto)) |
| 1065 | "Should `org-insert-heading' leave a blank line before new heading/item? | 1078 | "Should `org-insert-heading' leave a blank line before new heading/item? |
| 1066 | The value is an alist, with `heading' and `plain-list-item' as car, | 1079 | The value is an alist, with `heading' and `plain-list-item' as car, |
| 1067 | and a boolean flag as cdr. For plain lists, if the variable | 1080 | and a boolean flag as cdr. The cdr may lso be the symbol `auto', and then |
| 1068 | `org-empty-line-terminates-plain-lists' is set, the setting here | 1081 | Org will look at the surrounding headings/items and try to make an |
| 1069 | is ignored and no empty line is inserted, to keep the list in tact." | 1082 | intelligent decision wether to insert a blank line or not. |
| 1083 | |||
| 1084 | For plain lists, if the variable `org-empty-line-terminates-plain-lists' is | ||
| 1085 | set, the setting here is ignored and no empty line is inserted, to avoid | ||
| 1086 | breaking the list structure." | ||
| 1070 | :group 'org-edit-structure | 1087 | :group 'org-edit-structure |
| 1071 | :type '(list | 1088 | :type '(list |
| 1072 | (cons (const heading) | 1089 | (cons (const heading) |
| @@ -1258,7 +1275,7 @@ type. In principle, it does not hurt to turn on most link types - there may | |||
| 1258 | be a small gain when turning off unused link types. The types are: | 1275 | be a small gain when turning off unused link types. The types are: |
| 1259 | 1276 | ||
| 1260 | bracket The recommended [[link][description]] or [[link]] links with hiding. | 1277 | bracket The recommended [[link][description]] or [[link]] links with hiding. |
| 1261 | angular Links in angular brackets that may contain whitespace like | 1278 | angle Links in angular brackets that may contain whitespace like |
| 1262 | <bbdb:Carsten Dominik>. | 1279 | <bbdb:Carsten Dominik>. |
| 1263 | plain Plain links in normal text, no whitespace, like http://google.com. | 1280 | plain Plain links in normal text, no whitespace, like http://google.com. |
| 1264 | radio Text that is matched by a radio target, see manual for details. | 1281 | radio Text that is matched by a radio target, see manual for details. |
| @@ -1269,8 +1286,8 @@ footnote Footnote labels. | |||
| 1269 | Changing this variable requires a restart of Emacs to become effective." | 1286 | Changing this variable requires a restart of Emacs to become effective." |
| 1270 | :group 'org-link | 1287 | :group 'org-link |
| 1271 | :type '(set :greedy t | 1288 | :type '(set :greedy t |
| 1272 | (const :tag "Double bracket links (new style)" bracket) | 1289 | (const :tag "Double bracket links" bracket) |
| 1273 | (const :tag "Angular bracket links (old style)" angular) | 1290 | (const :tag "Angular bracket links" angle) |
| 1274 | (const :tag "Plain text links" plain) | 1291 | (const :tag "Plain text links" plain) |
| 1275 | (const :tag "Radio target matches" radio) | 1292 | (const :tag "Radio target matches" radio) |
| 1276 | (const :tag "Tags" tag) | 1293 | (const :tag "Tags" tag) |
| @@ -1437,6 +1454,17 @@ Changing this requires a restart of Emacs to work correctly." | |||
| 1437 | :group 'org-link-follow | 1454 | :group 'org-link-follow |
| 1438 | :type 'integer) | 1455 | :type 'integer) |
| 1439 | 1456 | ||
| 1457 | (defcustom org-link-search-must-match-exact-headline 'query-to-create | ||
| 1458 | "Non-nil means internal links in Org files must exactly match a headline. | ||
| 1459 | When nil, the link search tries to match a phrase will all words | ||
| 1460 | in the search text." | ||
| 1461 | :group 'org-link-follow | ||
| 1462 | :type '(choice | ||
| 1463 | (const :tag "Use fuzy text search" nil) | ||
| 1464 | (const :tag "Match only exact headline" t) | ||
| 1465 | (const :tag "Match extact headline or query to create it" | ||
| 1466 | query-to-create))) | ||
| 1467 | |||
| 1440 | (defcustom org-link-frame-setup | 1468 | (defcustom org-link-frame-setup |
| 1441 | '((vm . vm-visit-folder-other-frame) | 1469 | '((vm . vm-visit-folder-other-frame) |
| 1442 | (gnus . org-gnus-no-new-news) | 1470 | (gnus . org-gnus-no-new-news) |
| @@ -1797,8 +1825,8 @@ This is list of cons cells. Each cell contains: | |||
| 1797 | - a specification of the files to be considered, either a list of files, | 1825 | - a specification of the files to be considered, either a list of files, |
| 1798 | or a symbol whose function or variable value will be used to retrieve | 1826 | or a symbol whose function or variable value will be used to retrieve |
| 1799 | a file name or a list of file names. If you use `org-agenda-files' for | 1827 | a file name or a list of file names. If you use `org-agenda-files' for |
| 1800 | that, all agenda files will be scanned for targets. The value nil means | 1828 | that, all agenda files will be scanned for targets. Nil means consider |
| 1801 | consider headings in the current buffer. | 1829 | headings in the current buffer. |
| 1802 | - A specification of how to find candidate refile targets. This may be | 1830 | - A specification of how to find candidate refile targets. This may be |
| 1803 | any of: | 1831 | any of: |
| 1804 | - a cons cell (:tag . \"TAG\") to identify refile targets by a tag. | 1832 | - a cons cell (:tag . \"TAG\") to identify refile targets by a tag. |
| @@ -2568,13 +2596,28 @@ will work: | |||
| 2568 | Currently none of this works for ISO week specifications. | 2596 | Currently none of this works for ISO week specifications. |
| 2569 | 2597 | ||
| 2570 | When this option is nil, the current day, month and year will always be | 2598 | When this option is nil, the current day, month and year will always be |
| 2571 | used as defaults." | 2599 | used as defaults. |
| 2600 | |||
| 2601 | See also `org-agenda-jump-prefer-future'." | ||
| 2572 | :group 'org-time | 2602 | :group 'org-time |
| 2573 | :type '(choice | 2603 | :type '(choice |
| 2574 | (const :tag "Never" nil) | 2604 | (const :tag "Never" nil) |
| 2575 | (const :tag "Check month and day" t) | 2605 | (const :tag "Check month and day" t) |
| 2576 | (const :tag "Check month, day, and time" time))) | 2606 | (const :tag "Check month, day, and time" time))) |
| 2577 | 2607 | ||
| 2608 | (defcustom org-agenda-jump-prefer-future 'org-read-date-prefer-future | ||
| 2609 | "Should the agenda jump command prefer the future for incomplete dates? | ||
| 2610 | The default is to do the same as configured in `org-read-date-prefer-future'. | ||
| 2611 | But you can alse set a deviating value here. | ||
| 2612 | This may t or nil, or the symbol `org-read-date-prefer-future'." | ||
| 2613 | :group 'org-agenda | ||
| 2614 | :group 'org-time | ||
| 2615 | :type '(choice | ||
| 2616 | (const :tag "Use org-aread-date-prefer-future" | ||
| 2617 | org-read-date-prefer-future) | ||
| 2618 | (const :tag "Never" nil) | ||
| 2619 | (const :tag "Always" t))) | ||
| 2620 | |||
| 2578 | (defcustom org-read-date-display-live t | 2621 | (defcustom org-read-date-display-live t |
| 2579 | "Non-nil means display current interpretation of date prompt live. | 2622 | "Non-nil means display current interpretation of date prompt live. |
| 2580 | This display will be in an overlay, in the minibuffer." | 2623 | This display will be in an overlay, in the minibuffer." |
| @@ -3074,15 +3117,15 @@ points to a file, `org-agenda-diary-entry' will be used instead." | |||
| 3074 | 3117 | ||
| 3075 | (defcustom org-format-latex-options | 3118 | (defcustom org-format-latex-options |
| 3076 | '(:foreground default :background default :scale 1.0 | 3119 | '(:foreground default :background default :scale 1.0 |
| 3077 | :html-foreground "Black" :html-background "Transparent" :html-scale 1.0 | 3120 | :html-foreground "Black" :html-background "Transparent" |
| 3078 | :matchers ("begin" "$1" "$" "$$" "\\(" "\\[")) | 3121 | :html-scale 1.0 :matchers ("begin" "$1" "$" "$$" "\\(" "\\[")) |
| 3079 | "Options for creating images from LaTeX fragments. | 3122 | "Options for creating images from LaTeX fragments. |
| 3080 | This is a property list with the following properties: | 3123 | This is a property list with the following properties: |
| 3081 | :foreground the foreground color for images embedded in Emacs, e.g. \"Black\". | 3124 | :foreground the foreground color for images embedded in Emacs, e.g. \"Black\". |
| 3082 | `default' means use the foreground of the default face. | 3125 | `default' means use the foreground of the default face. |
| 3083 | :background the background color, or \"Transparent\". | 3126 | :background the background color, or \"Transparent\". |
| 3084 | `default' means use the background of the default face. | 3127 | `default' means use the background of the default face. |
| 3085 | :scale a scaling factor for the size of the images. | 3128 | :scale a scaling factor for the size of the images, to get more pixels |
| 3086 | :html-foreground, :html-background, :html-scale | 3129 | :html-foreground, :html-background, :html-scale |
| 3087 | the same numbers for HTML export. | 3130 | the same numbers for HTML export. |
| 3088 | :matchers a list indicating which matchers should be used to | 3131 | :matchers a list indicating which matchers should be used to |
| @@ -3162,7 +3205,6 @@ will be appended." | |||
| 3162 | ("" "float" nil) | 3205 | ("" "float" nil) |
| 3163 | ("" "wrapfig" nil) | 3206 | ("" "wrapfig" nil) |
| 3164 | ("" "soul" t) | 3207 | ("" "soul" t) |
| 3165 | ("" "t1enc" t) | ||
| 3166 | ("" "textcomp" t) | 3208 | ("" "textcomp" t) |
| 3167 | ("" "marvosym" t) | 3209 | ("" "marvosym" t) |
| 3168 | ("" "wasysym" t) | 3210 | ("" "wasysym" t) |
| @@ -3177,7 +3219,7 @@ with another package you are using. | |||
| 3177 | The packages in this list are needed by one part or another of Org-mode | 3219 | The packages in this list are needed by one part or another of Org-mode |
| 3178 | to function properly. | 3220 | to function properly. |
| 3179 | 3221 | ||
| 3180 | - inputenc, fontenc, t1enc: for basic font and character selection | 3222 | - inputenc, fontenc: for basic font and character selection |
| 3181 | - textcomp, marvosymb, wasysym, latexsym, amssym: for various symbols used | 3223 | - textcomp, marvosymb, wasysym, latexsym, amssym: for various symbols used |
| 3182 | for interpreting the entities in `org-entities'. You can skip some of these | 3224 | for interpreting the entities in `org-entities'. You can skip some of these |
| 3183 | packages if you don't use any of the symbols in it. | 3225 | packages if you don't use any of the symbols in it. |
| @@ -3311,6 +3353,8 @@ When nil, the \\name form remains in the buffer." | |||
| 3311 | (defvar org-emph-re nil | 3353 | (defvar org-emph-re nil |
| 3312 | "Regular expression for matching emphasis. | 3354 | "Regular expression for matching emphasis. |
| 3313 | After a match, the match groups contain these elements: | 3355 | After a match, the match groups contain these elements: |
| 3356 | 0 The match of the full regular expression, including the characters | ||
| 3357 | before and after the proper match | ||
| 3314 | 1 The character before the proper match, or empty at beginning of line | 3358 | 1 The character before the proper match, or empty at beginning of line |
| 3315 | 2 The proper match, including the leading and trailing markers | 3359 | 2 The proper match, including the leading and trailing markers |
| 3316 | 3 The leading marker like * or /, indicating the type of highlighting | 3360 | 3 The leading marker like * or /, indicating the type of highlighting |
| @@ -3510,6 +3554,7 @@ Normal means no org-mode-specific context." | |||
| 3510 | (declare-function org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item | 3554 | (declare-function org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item |
| 3511 | "org-agenda" (&optional end)) | 3555 | "org-agenda" (&optional end)) |
| 3512 | (declare-function org-inlinetask-remove-END-maybe "org-inlinetask" ()) | 3556 | (declare-function org-inlinetask-remove-END-maybe "org-inlinetask" ()) |
| 3557 | (declare-function org-inlinetask-in-task-p "org-inlinetask" ()) | ||
| 3513 | (declare-function org-indent-mode "org-indent" (&optional arg)) | 3558 | (declare-function org-indent-mode "org-indent" (&optional arg)) |
| 3514 | (declare-function parse-time-string "parse-time" (string)) | 3559 | (declare-function parse-time-string "parse-time" (string)) |
| 3515 | (declare-function org-attach-reveal "org-attach" (&optional if-exists)) | 3560 | (declare-function org-attach-reveal "org-attach" (&optional if-exists)) |
| @@ -3701,7 +3746,6 @@ If TABLE-TYPE is non-nil, also check for table.el-type tables." | |||
| 3701 | 3746 | ||
| 3702 | ;; Autoload org-clock.el | 3747 | ;; Autoload org-clock.el |
| 3703 | 3748 | ||
| 3704 | |||
| 3705 | (declare-function org-clock-save-markers-for-cut-and-paste "org-clock" | 3749 | (declare-function org-clock-save-markers-for-cut-and-paste "org-clock" |
| 3706 | (beg end)) | 3750 | (beg end)) |
| 3707 | (declare-function org-clock-update-mode-line "org-clock" ()) | 3751 | (declare-function org-clock-update-mode-line "org-clock" ()) |
| @@ -3991,7 +4035,7 @@ collapsed state." | |||
| 3991 | (org-autoload "org-id" | 4035 | (org-autoload "org-id" |
| 3992 | '(org-id-get-create org-id-new org-id-copy org-id-get | 4036 | '(org-id-get-create org-id-new org-id-copy org-id-get |
| 3993 | org-id-get-with-outline-path-completion | 4037 | org-id-get-with-outline-path-completion |
| 3994 | org-id-get-with-outline-drilling | 4038 | org-id-get-with-outline-drilling org-id-store-link |
| 3995 | org-id-goto org-id-find org-id-store-link)) | 4039 | org-id-goto org-id-find org-id-store-link)) |
| 3996 | 4040 | ||
| 3997 | ;; Autoload Plotting Code | 4041 | ;; Autoload Plotting Code |
| @@ -4024,7 +4068,11 @@ group 3: Priority cookie | |||
| 4024 | group 4: True headline | 4068 | group 4: True headline |
| 4025 | group 5: Tags") | 4069 | group 5: Tags") |
| 4026 | (make-variable-buffer-local 'org-complex-heading-regexp) | 4070 | (make-variable-buffer-local 'org-complex-heading-regexp) |
| 4027 | (defvar org-complex-heading-regexp-format nil) | 4071 | (defvar org-complex-heading-regexp-format nil |
| 4072 | "Printf format to make regexp to match an exact headline. | ||
| 4073 | This regexp will match the headline of any node which hase the exact | ||
| 4074 | headline text that is put into the format, but may have any TODO state, | ||
| 4075 | priority and tags.") | ||
| 4028 | (make-variable-buffer-local 'org-complex-heading-regexp-format) | 4076 | (make-variable-buffer-local 'org-complex-heading-regexp-format) |
| 4029 | (defvar org-todo-line-tags-regexp nil | 4077 | (defvar org-todo-line-tags-regexp nil |
| 4030 | "Matches a headline and puts TODO state into group 2 if present. | 4078 | "Matches a headline and puts TODO state into group 2 if present. |
| @@ -4129,6 +4177,8 @@ After a match, the following groups carry important information: | |||
| 4129 | ("oddeven" org-odd-levels-only nil) | 4177 | ("oddeven" org-odd-levels-only nil) |
| 4130 | ("align" org-startup-align-all-tables t) | 4178 | ("align" org-startup-align-all-tables t) |
| 4131 | ("noalign" org-startup-align-all-tables nil) | 4179 | ("noalign" org-startup-align-all-tables nil) |
| 4180 | ("inlineimages" org-startup-with-inline-images t) | ||
| 4181 | ("noinlineimages" org-startup-with-inline-images nil) | ||
| 4132 | ("customtime" org-display-custom-times t) | 4182 | ("customtime" org-display-custom-times t) |
| 4133 | ("logdone" org-log-done time) | 4183 | ("logdone" org-log-done time) |
| 4134 | ("lognotedone" org-log-done note) | 4184 | ("lognotedone" org-log-done note) |
| @@ -4357,7 +4407,7 @@ means to push this value onto the list in the variable.") | |||
| 4357 | ((equal e "{") (push '(:startgroup) tgs)) | 4407 | ((equal e "{") (push '(:startgroup) tgs)) |
| 4358 | ((equal e "}") (push '(:endgroup) tgs)) | 4408 | ((equal e "}") (push '(:endgroup) tgs)) |
| 4359 | ((equal e "\\n") (push '(:newline) tgs)) | 4409 | ((equal e "\\n") (push '(:newline) tgs)) |
| 4360 | ((string-match (org-re "^\\([[:alnum:]_@]+\\)(\\(.\\))$") e) | 4410 | ((string-match (org-re "^\\([[:alnum:]_@#%]+\\)(\\(.\\))$") e) |
| 4361 | (push (cons (match-string 1 e) | 4411 | (push (cons (match-string 1 e) |
| 4362 | (string-to-char (match-string 2 e))) | 4412 | (string-to-char (match-string 2 e))) |
| 4363 | tgs)) | 4413 | tgs)) |
| @@ -4401,7 +4451,7 @@ means to push this value onto the list in the variable.") | |||
| 4401 | (concat "^\\(\\*+\\)[ \t]+\\(?:\\(" | 4451 | (concat "^\\(\\*+\\)[ \t]+\\(?:\\(" |
| 4402 | (mapconcat 'regexp-quote org-todo-keywords-1 "\\|") | 4452 | (mapconcat 'regexp-quote org-todo-keywords-1 "\\|") |
| 4403 | "\\)\\>\\)?\\(?:[ \t]*\\(\\[#.\\]\\)\\)?[ \t]*\\(.*?\\)" | 4453 | "\\)\\>\\)?\\(?:[ \t]*\\(\\[#.\\]\\)\\)?[ \t]*\\(.*?\\)" |
| 4404 | "\\(?:[ \t]+\\(:[[:alnum:]_@:]+:\\)\\)?[ \t]*$") | 4454 | "\\(?:[ \t]+\\(:[[:alnum:]_@#%:]+:\\)\\)?[ \t]*$") |
| 4405 | org-complex-heading-regexp-format | 4455 | org-complex-heading-regexp-format |
| 4406 | (concat "^\\(\\*+\\)[ \t]+\\(?:\\(" | 4456 | (concat "^\\(\\*+\\)[ \t]+\\(?:\\(" |
| 4407 | (mapconcat 'regexp-quote org-todo-keywords-1 "\\|") | 4457 | (mapconcat 'regexp-quote org-todo-keywords-1 "\\|") |
| @@ -4410,7 +4460,7 @@ means to push this value onto the list in the variable.") | |||
| 4410 | "\\(?:[ \t]*\\(?:\\[[0-9%%/]+\\]\\)\\)?" ;; stats cookie | 4460 | "\\(?:[ \t]*\\(?:\\[[0-9%%/]+\\]\\)\\)?" ;; stats cookie |
| 4411 | "[ \t]*\\(%s\\)" | 4461 | "[ \t]*\\(%s\\)" |
| 4412 | "\\(?:[ \t]*\\(?:\\[[0-9%%/]+\\]\\)\\)?" ;; stats cookie | 4462 | "\\(?:[ \t]*\\(?:\\[[0-9%%/]+\\]\\)\\)?" ;; stats cookie |
| 4413 | "\\(?:[ \t]+\\(:[[:alnum:]_@:]+:\\)\\)?[ \t]*$") | 4463 | "\\(?:[ \t]+\\(:[[:alnum:]_@#%%:]+:\\)\\)?[ \t]*$") |
| 4414 | org-nl-done-regexp | 4464 | org-nl-done-regexp |
| 4415 | (concat "\n\\*+[ \t]+" | 4465 | (concat "\n\\*+[ \t]+" |
| 4416 | "\\(?:" (mapconcat 'regexp-quote org-done-keywords "\\|") | 4466 | "\\(?:" (mapconcat 'regexp-quote org-done-keywords "\\|") |
| @@ -4419,7 +4469,7 @@ means to push this value onto the list in the variable.") | |||
| 4419 | (concat "^\\(\\*+\\)[ \t]+\\(?:\\(" | 4469 | (concat "^\\(\\*+\\)[ \t]+\\(?:\\(" |
| 4420 | (mapconcat 'regexp-quote org-todo-keywords-1 "\\|") | 4470 | (mapconcat 'regexp-quote org-todo-keywords-1 "\\|") |
| 4421 | (org-re | 4471 | (org-re |
| 4422 | "\\)\\>\\)? *\\(.*?\\([ \t]:[[:alnum:]:_@]+:[ \t]*\\)?$\\)")) | 4472 | "\\)\\>\\)? *\\(.*?\\([ \t]:[[:alnum:]:_@#%]+:[ \t]*\\)?$\\)")) |
| 4423 | org-looking-at-done-regexp | 4473 | org-looking-at-done-regexp |
| 4424 | (concat "^" "\\(?:" | 4474 | (concat "^" "\\(?:" |
| 4425 | (mapconcat 'regexp-quote org-done-keywords "\\|") "\\)" | 4475 | (mapconcat 'regexp-quote org-done-keywords "\\|") "\\)" |
| @@ -4699,6 +4749,8 @@ The following commands are available: | |||
| 4699 | (let ((bmp (buffer-modified-p))) | 4749 | (let ((bmp (buffer-modified-p))) |
| 4700 | (org-table-map-tables 'org-table-align 'quietly) | 4750 | (org-table-map-tables 'org-table-align 'quietly) |
| 4701 | (set-buffer-modified-p bmp))) | 4751 | (set-buffer-modified-p bmp))) |
| 4752 | (when org-startup-with-inline-images | ||
| 4753 | (org-display-inline-images)) | ||
| 4702 | (when org-startup-indented | 4754 | (when org-startup-indented |
| 4703 | (require 'org-indent) | 4755 | (require 'org-indent) |
| 4704 | (org-indent-mode 1)) | 4756 | (org-indent-mode 1)) |
| @@ -4736,7 +4788,7 @@ The following commands are available: | |||
| 4736 | 4788 | ||
| 4737 | (defconst org-non-link-chars "]\t\n\r<>") | 4789 | (defconst org-non-link-chars "]\t\n\r<>") |
| 4738 | (defvar org-link-types '("http" "https" "ftp" "mailto" "file" "news" | 4790 | (defvar org-link-types '("http" "https" "ftp" "mailto" "file" "news" |
| 4739 | "shell" "elisp" "doi")) | 4791 | "shell" "elisp" "doi" "message")) |
| 4740 | (defvar org-link-types-re nil | 4792 | (defvar org-link-types-re nil |
| 4741 | "Matches a link that has a url-like prefix like \"http:\"") | 4793 | "Matches a link that has a url-like prefix like \"http:\"") |
| 4742 | (defvar org-link-re-with-space nil | 4794 | (defvar org-link-re-with-space nil |
| @@ -4837,7 +4889,7 @@ This should be called after the variable `org-link-types' has changed." | |||
| 4837 | org-plain-link-re | 4889 | org-plain-link-re |
| 4838 | (concat | 4890 | (concat |
| 4839 | "\\<\\(" (mapconcat 'regexp-quote org-link-types "\\|") "\\):" | 4891 | "\\<\\(" (mapconcat 'regexp-quote org-link-types "\\|") "\\):" |
| 4840 | (org-re "\\([^ \t\n()<>]+\\(?:([[:word:]0-9]+)\\|\\([^[:punct:] \t\n]\\|/\\)\\)\\)")) | 4892 | (org-re "\\([^ \t\n()<>]+\\(?:([[:word:]0-9_]+)\\|\\([^[:punct:] \t\n]\\|/\\)\\)\\)")) |
| 4841 | ;; "\\([^]\t\n\r<>() ]+[^]\t\n\r<>,.;() ]\\)") | 4893 | ;; "\\([^]\t\n\r<>() ]+[^]\t\n\r<>,.;() ]\\)") |
| 4842 | org-bracket-link-regexp | 4894 | org-bracket-link-regexp |
| 4843 | "\\[\\[\\([^][]+\\)\\]\\(\\[\\([^][]+\\)\\]\\)?\\]" | 4895 | "\\[\\[\\([^][]+\\)\\]\\(\\[\\([^][]+\\)\\]\\)?\\]" |
| @@ -5003,13 +5055,22 @@ will be prompted for." | |||
| 5003 | '(display t invisible t intangible t)) | 5055 | '(display t invisible t intangible t)) |
| 5004 | t))) | 5056 | t))) |
| 5005 | 5057 | ||
| 5058 | (defcustom org-src-fontify-natively nil | ||
| 5059 | "When non-nil, fontify code in code blocks." | ||
| 5060 | :type 'boolean | ||
| 5061 | :group 'org-appearance | ||
| 5062 | :group 'org-babel) | ||
| 5063 | |||
| 5006 | (defun org-fontify-meta-lines-and-blocks (limit) | 5064 | (defun org-fontify-meta-lines-and-blocks (limit) |
| 5007 | "Fontify #+ lines and blocks, in the correct ways." | 5065 | "Fontify #+ lines and blocks, in the correct ways." |
| 5008 | (let ((case-fold-search t)) | 5066 | (let ((case-fold-search t)) |
| 5009 | (if (re-search-forward | 5067 | (if (re-search-forward |
| 5010 | "^\\([ \t]*#\\+\\(\\([a-zA-Z]+:?\\| \\|$\\)\\(_\\([a-zA-Z]+\\)\\)?\\)\\(.*\\)\\)" | 5068 | "^\\([ \t]*#\\+\\(\\([a-zA-Z]+:?\\| \\|$\\)\\(_\\([a-zA-Z]+\\)\\)?\\)[ \t]*\\(\\([^ \t\n]*\\)[ \t]*\\(.*\\)\\)\\)" |
| 5011 | limit t) | 5069 | limit t) |
| 5012 | (let ((beg (match-beginning 0)) | 5070 | (let ((beg (match-beginning 0)) |
| 5071 | (block-start (match-end 0)) | ||
| 5072 | (block-end nil) | ||
| 5073 | (lang (match-string 7)) | ||
| 5013 | (beg1 (line-beginning-position 2)) | 5074 | (beg1 (line-beginning-position 2)) |
| 5014 | (dc1 (downcase (match-string 2))) | 5075 | (dc1 (downcase (match-string 2))) |
| 5015 | (dc3 (downcase (match-string 3))) | 5076 | (dc3 (downcase (match-string 3))) |
| @@ -5022,8 +5083,9 @@ will be prompted for." | |||
| 5022 | '(display t invisible t intangible t)) | 5083 | '(display t invisible t intangible t)) |
| 5023 | (add-text-properties (match-beginning 1) (match-end 3) | 5084 | (add-text-properties (match-beginning 1) (match-end 3) |
| 5024 | '(font-lock-fontified t face org-meta-line)) | 5085 | '(font-lock-fontified t face org-meta-line)) |
| 5025 | (add-text-properties (match-beginning 6) (match-end 6) | 5086 | (add-text-properties (match-beginning 6) (+ (match-end 6) 1) |
| 5026 | '(font-lock-fontified t face org-block)) | 5087 | '(font-lock-fontified t face org-block)) |
| 5088 | ; for backend-specific code | ||
| 5027 | t) | 5089 | t) |
| 5028 | ((and (match-end 4) (equal dc3 "begin")) | 5090 | ((and (match-end 4) (equal dc3 "begin")) |
| 5029 | ;; Truly a block | 5091 | ;; Truly a block |
| @@ -5033,6 +5095,7 @@ will be prompted for." | |||
| 5033 | (concat "^[ \t]*#\\+end" (match-string 4) "\\>.*") | 5095 | (concat "^[ \t]*#\\+end" (match-string 4) "\\>.*") |
| 5034 | nil t) ;; on purpose, we look further than LIMIT | 5096 | nil t) ;; on purpose, we look further than LIMIT |
| 5035 | (setq end (match-end 0) end1 (1- (match-beginning 0))) | 5097 | (setq end (match-end 0) end1 (1- (match-beginning 0))) |
| 5098 | (setq block-end (match-beginning 0)) | ||
| 5036 | (when quoting | 5099 | (when quoting |
| 5037 | (remove-text-properties beg end | 5100 | (remove-text-properties beg end |
| 5038 | '(display t invisible t intangible t))) | 5101 | '(display t invisible t intangible t))) |
| @@ -5040,10 +5103,15 @@ will be prompted for." | |||
| 5040 | beg end | 5103 | beg end |
| 5041 | '(font-lock-fontified t font-lock-multiline t)) | 5104 | '(font-lock-fontified t font-lock-multiline t)) |
| 5042 | (add-text-properties beg beg1 '(face org-meta-line)) | 5105 | (add-text-properties beg beg1 '(face org-meta-line)) |
| 5043 | (add-text-properties end1 end '(face org-meta-line)) | 5106 | (add-text-properties end1 (+ end 1) '(face org-meta-line)) |
| 5107 | ; for end_src | ||
| 5044 | (cond | 5108 | (cond |
| 5109 | ((and lang org-src-fontify-natively) | ||
| 5110 | (org-src-font-lock-fontify-block lang block-start block-end)) | ||
| 5045 | (quoting | 5111 | (quoting |
| 5046 | (add-text-properties beg1 end1 '(face org-block))) | 5112 | (add-text-properties beg1 (+ end1 1) '(face |
| 5113 | org-block))) | ||
| 5114 | ; end of source block | ||
| 5047 | ((not org-fontify-quote-and-verse-blocks)) | 5115 | ((not org-fontify-quote-and-verse-blocks)) |
| 5048 | ((string= block-type "quote") | 5116 | ((string= block-type "quote") |
| 5049 | (add-text-properties beg1 end1 '(face org-quote))) | 5117 | (add-text-properties beg1 end1 '(face org-quote))) |
| @@ -5329,7 +5397,7 @@ between words." | |||
| 5329 | "\\)\\>"))) | 5397 | "\\)\\>"))) |
| 5330 | 5398 | ||
| 5331 | (defun org-activate-tags (limit) | 5399 | (defun org-activate-tags (limit) |
| 5332 | (if (re-search-forward (org-re "^\\*+.*[ \t]\\(:[[:alnum:]_@:]+:\\)[ \r\n]") limit t) | 5400 | (if (re-search-forward (org-re "^\\*+.*[ \t]\\(:[[:alnum:]_@#%:]+:\\)[ \r\n]") limit t) |
| 5333 | (progn | 5401 | (progn |
| 5334 | (org-remove-flyspell-overlays-in (match-beginning 1) (match-end 1)) | 5402 | (org-remove-flyspell-overlays-in (match-beginning 1) (match-end 1)) |
| 5335 | (add-text-properties (match-beginning 1) (match-end 1) | 5403 | (add-text-properties (match-beginning 1) (match-end 1) |
| @@ -5360,6 +5428,12 @@ For plain list items, if they are matched by `outline-regexp', this returns | |||
| 5360 | (defvar org-font-lock-hook nil | 5428 | (defvar org-font-lock-hook nil |
| 5361 | "Functions to be called for special font lock stuff.") | 5429 | "Functions to be called for special font lock stuff.") |
| 5362 | 5430 | ||
| 5431 | (defvar org-font-lock-set-keywords-hook nil | ||
| 5432 | "Functions that can manipulate `org-font-lock-extra-keywords'. | ||
| 5433 | This is calles after `org-font-lock-extra-keywords' is defined, but before | ||
| 5434 | it is installed to be used by font lock. This can be useful if something | ||
| 5435 | needs to be inserted at a specific position in the font-lock sequence.") | ||
| 5436 | |||
| 5363 | (defun org-font-lock-hook (limit) | 5437 | (defun org-font-lock-hook (limit) |
| 5364 | (run-hook-with-args 'org-font-lock-hook limit)) | 5438 | (run-hook-with-args 'org-font-lock-hook limit)) |
| 5365 | 5439 | ||
| @@ -5384,7 +5458,7 @@ For plain list items, if they are matched by `outline-regexp', this returns | |||
| 5384 | '("^[ \t]*|\\(?:.*?|\\)? *\\(:?=[^|\n]*\\)" (1 'org-formula t)) | 5458 | '("^[ \t]*|\\(?:.*?|\\)? *\\(:?=[^|\n]*\\)" (1 'org-formula t)) |
| 5385 | '("^[ \t]*| *\\([#*]\\) *|" (1 'org-formula t)) | 5459 | '("^[ \t]*| *\\([#*]\\) *|" (1 'org-formula t)) |
| 5386 | '("^[ \t]*|\\( *\\([$!_^/]\\) *|.*\\)|" (1 'org-formula t)) | 5460 | '("^[ \t]*|\\( *\\([$!_^/]\\) *|.*\\)|" (1 'org-formula t)) |
| 5387 | '("| *\\(<[lr]?[0-9]*>\\)" (1 'org-formula t)) | 5461 | '("| *\\(<[lrc]?[0-9]*>\\)" (1 'org-formula t)) |
| 5388 | ;; Drawers | 5462 | ;; Drawers |
| 5389 | (list org-drawer-regexp '(0 'org-special-keyword t)) | 5463 | (list org-drawer-regexp '(0 'org-special-keyword t)) |
| 5390 | (list "^[ \t]*:END:" '(0 'org-special-keyword t)) | 5464 | (list "^[ \t]*:END:" '(0 'org-special-keyword t)) |
| @@ -5428,13 +5502,13 @@ For plain list items, if they are matched by `outline-regexp', this returns | |||
| 5428 | '(org-do-emphasis-faces (0 nil append)) | 5502 | '(org-do-emphasis-faces (0 nil append)) |
| 5429 | '(org-do-emphasis-faces))) | 5503 | '(org-do-emphasis-faces))) |
| 5430 | ;; Checkboxes | 5504 | ;; Checkboxes |
| 5431 | '("^[ \t]*\\([-+*]\\|[0-9]+[.)]\\) +\\(\\[[- X]\\]\\)" | 5505 | '("^[ \t]*\\(?:[-+*]\\|[0-9]+[.)]\\)[ \t]+\\(?:\\[@\\(?:start:\\)?[0-9]+\\][ \t]*\\)?\\(\\[[- X]\\]\\)" |
| 5432 | 2 'org-checkbox prepend) | 5506 | 1 'org-checkbox prepend) |
| 5433 | (if org-provide-checkbox-statistics | 5507 | (if (cdr (assq 'checkbox org-list-automatic-rules)) |
| 5434 | '("\\[\\([0-9]*%\\)\\]\\|\\[\\([0-9]*\\)/\\([0-9]*\\)\\]" | 5508 | '("\\[\\([0-9]*%\\)\\]\\|\\[\\([0-9]*\\)/\\([0-9]*\\)\\]" |
| 5435 | (0 (org-get-checkbox-statistics-face) t))) | 5509 | (0 (org-get-checkbox-statistics-face) t))) |
| 5436 | ;; Description list items | 5510 | ;; Description list items |
| 5437 | '("^[ \t]*\\([-+*]\\|[0-9]+[.)]\\) +\\(.*? ::\\)" | 5511 | '("^[ \t]*\\([-+*]\\|[0-9]+[.)]\\)[ \t]+\\(.*? ::\\)" |
| 5438 | 2 'bold prepend) | 5512 | 2 'bold prepend) |
| 5439 | ;; ARCHIVEd headings | 5513 | ;; ARCHIVEd headings |
| 5440 | (list (concat "^\\*+ \\(.*:" org-archive-tag ":.*\\)") | 5514 | (list (concat "^\\*+ \\(.*:" org-archive-tag ":.*\\)") |
| @@ -5454,6 +5528,7 @@ For plain list items, if they are matched by `outline-regexp', this returns | |||
| 5454 | '(org-fontify-meta-lines-and-blocks) | 5528 | '(org-fontify-meta-lines-and-blocks) |
| 5455 | ))) | 5529 | ))) |
| 5456 | (setq org-font-lock-extra-keywords (delq nil org-font-lock-extra-keywords)) | 5530 | (setq org-font-lock-extra-keywords (delq nil org-font-lock-extra-keywords)) |
| 5531 | (run-hooks 'org-font-lock-set-keywords-hook) | ||
| 5457 | ;; Now set the full font-lock-keywords | 5532 | ;; Now set the full font-lock-keywords |
| 5458 | (org-set-local 'org-font-lock-keywords org-font-lock-extra-keywords) | 5533 | (org-set-local 'org-font-lock-keywords org-font-lock-extra-keywords) |
| 5459 | (org-set-local 'font-lock-defaults | 5534 | (org-set-local 'font-lock-defaults |
| @@ -5469,7 +5544,7 @@ For plain list items, if they are matched by `outline-regexp', this returns | |||
| 5469 | (message "Entities are displayed as UTF8 characers") | 5544 | (message "Entities are displayed as UTF8 characers") |
| 5470 | (save-restriction | 5545 | (save-restriction |
| 5471 | (widen) | 5546 | (widen) |
| 5472 | (decompose-region (point-min) (point-max)) | 5547 | (org-decompose-region (point-min) (point-max)) |
| 5473 | (message "Entities are displayed plain")))) | 5548 | (message "Entities are displayed plain")))) |
| 5474 | 5549 | ||
| 5475 | (defun org-fontify-entities (limit) | 5550 | (defun org-fontify-entities (limit) |
| @@ -5569,7 +5644,7 @@ If KWD is a number, get the corresponding match group." | |||
| 5569 | (inhibit-read-only t) (inhibit-point-motion-hooks t) | 5644 | (inhibit-read-only t) (inhibit-point-motion-hooks t) |
| 5570 | (inhibit-modification-hooks t) | 5645 | (inhibit-modification-hooks t) |
| 5571 | deactivate-mark buffer-file-name buffer-file-truename) | 5646 | deactivate-mark buffer-file-name buffer-file-truename) |
| 5572 | (decompose-region beg end) | 5647 | (org-decompose-region beg end) |
| 5573 | (remove-text-properties | 5648 | (remove-text-properties |
| 5574 | beg end | 5649 | beg end |
| 5575 | (if org-indent-mode | 5650 | (if org-indent-mode |
| @@ -5698,7 +5773,8 @@ in special contexts. | |||
| 5698 | `org-cycle-emulate-tab' for details. | 5773 | `org-cycle-emulate-tab' for details. |
| 5699 | 5774 | ||
| 5700 | - Special case: if point is at the beginning of the buffer and there is | 5775 | - Special case: if point is at the beginning of the buffer and there is |
| 5701 | no headline in line 1, this function will act as if called with prefix arg. | 5776 | no headline in line 1, this function will act as if called with prefix arg |
| 5777 | (C-u TAB, same as S-TAB) also when called without prefix arg. | ||
| 5702 | But only if also the variable `org-cycle-global-at-bob' is t." | 5778 | But only if also the variable `org-cycle-global-at-bob' is t." |
| 5703 | (interactive "P") | 5779 | (interactive "P") |
| 5704 | (org-load-modules-maybe) | 5780 | (org-load-modules-maybe) |
| @@ -5724,7 +5800,7 @@ in special contexts. | |||
| 5724 | (if nstars (format "\\{1,%d\\}" nstars) "+") | 5800 | (if nstars (format "\\{1,%d\\}" nstars) "+") |
| 5725 | " \\|\\([ \t]*\\)\\([-+*]\\|[0-9]+[.)]\\) \\)")) | 5801 | " \\|\\([ \t]*\\)\\([-+*]\\|[0-9]+[.)]\\) \\)")) |
| 5726 | (t (concat "\\*" (if nstars (format "\\{1,%d\\} " nstars) "+ "))))) | 5802 | (t (concat "\\*" (if nstars (format "\\{1,%d\\} " nstars) "+ "))))) |
| 5727 | (bob-special (and org-cycle-global-at-bob (bobp) | 5803 | (bob-special (and org-cycle-global-at-bob (not arg) (bobp) |
| 5728 | (not (looking-at outline-regexp)))) | 5804 | (not (looking-at outline-regexp)))) |
| 5729 | (org-cycle-hook | 5805 | (org-cycle-hook |
| 5730 | (if bob-special | 5806 | (if bob-special |
| @@ -5740,6 +5816,7 @@ in special contexts. | |||
| 5740 | (cond | 5816 | (cond |
| 5741 | 5817 | ||
| 5742 | ((equal arg '(16)) | 5818 | ((equal arg '(16)) |
| 5819 | (setq last-command 'dummy) | ||
| 5743 | (org-set-startup-visibility) | 5820 | (org-set-startup-visibility) |
| 5744 | (message "Startup visibility, plus VISIBILITY properties")) | 5821 | (message "Startup visibility, plus VISIBILITY properties")) |
| 5745 | 5822 | ||
| @@ -5847,7 +5924,6 @@ in special contexts. | |||
| 5847 | 5924 | ||
| 5848 | (defun org-cycle-internal-local () | 5925 | (defun org-cycle-internal-local () |
| 5849 | "Do the local cycling action." | 5926 | "Do the local cycling action." |
| 5850 | (org-back-to-heading) | ||
| 5851 | (let ((goal-column 0) eoh eol eos level has-children children-skipped) | 5927 | (let ((goal-column 0) eoh eol eos level has-children children-skipped) |
| 5852 | ;; First, some boundaries | 5928 | ;; First, some boundaries |
| 5853 | (save-excursion | 5929 | (save-excursion |
| @@ -5871,12 +5947,15 @@ in special contexts. | |||
| 5871 | (outline-next-heading) | 5947 | (outline-next-heading) |
| 5872 | (setq has-children (and (org-at-heading-p t) | 5948 | (setq has-children (and (org-at-heading-p t) |
| 5873 | (> (funcall outline-level) level)))) | 5949 | (> (funcall outline-level) level)))) |
| 5874 | (org-end-of-subtree t) | 5950 | ;; if we're in a list, org-end-of-subtree is in fact org-end-of-item. |
| 5875 | (unless (eobp) | 5951 | (if (org-at-item-p) |
| 5876 | (skip-chars-forward " \t\n") | 5952 | (setq eos (if (and (org-end-of-item) (bolp)) |
| 5877 | (beginning-of-line 1) ; in case this is an item | 5953 | (1- (point)) |
| 5878 | ) | 5954 | (point))) |
| 5879 | (setq eos (if (eobp) (point) (1- (point))))) | 5955 | (org-end-of-subtree t) |
| 5956 | (unless (eobp) | ||
| 5957 | (skip-chars-forward " \t\n")) | ||
| 5958 | (setq eos (if (eobp) (point) (1- (point)))))) | ||
| 5880 | ;; Find out what to do next and set `this-command' | 5959 | ;; Find out what to do next and set `this-command' |
| 5881 | (cond | 5960 | (cond |
| 5882 | ((= eos eoh) | 5961 | ((= eos eoh) |
| @@ -5910,14 +5989,14 @@ in special contexts. | |||
| 5910 | ;; We just showed the children, or no children are there, | 5989 | ;; We just showed the children, or no children are there, |
| 5911 | ;; now show everything. | 5990 | ;; now show everything. |
| 5912 | (run-hook-with-args 'org-pre-cycle-hook 'subtree) | 5991 | (run-hook-with-args 'org-pre-cycle-hook 'subtree) |
| 5913 | (org-show-subtree) | 5992 | (outline-flag-region eoh eos nil) |
| 5914 | (message (if children-skipped "SUBTREE (NO CHILDREN)" "SUBTREE")) | 5993 | (message (if children-skipped "SUBTREE (NO CHILDREN)" "SUBTREE")) |
| 5915 | (setq org-cycle-subtree-status 'subtree) | 5994 | (setq org-cycle-subtree-status 'subtree) |
| 5916 | (run-hook-with-args 'org-cycle-hook 'subtree)) | 5995 | (run-hook-with-args 'org-cycle-hook 'subtree)) |
| 5917 | (t | 5996 | (t |
| 5918 | ;; Default action: hide the subtree. | 5997 | ;; Default action: hide the subtree. |
| 5919 | (run-hook-with-args 'org-pre-cycle-hook 'folded) | 5998 | (run-hook-with-args 'org-pre-cycle-hook 'folded) |
| 5920 | (hide-subtree) | 5999 | (outline-flag-region eoh eos t) |
| 5921 | (message "FOLDED") | 6000 | (message "FOLDED") |
| 5922 | (setq org-cycle-subtree-status 'folded) | 6001 | (setq org-cycle-subtree-status 'folded) |
| 5923 | (run-hook-with-args 'org-cycle-hook 'folded))))) | 6002 | (run-hook-with-args 'org-cycle-hook 'folded))))) |
| @@ -5961,8 +6040,8 @@ With a numeric prefix, show all headlines up to that level." | |||
| 5961 | (interactive) | 6040 | (interactive) |
| 5962 | (let (org-show-entry-below state) | 6041 | (let (org-show-entry-below state) |
| 5963 | (save-excursion | 6042 | (save-excursion |
| 5964 | (goto-char (point-min)) | 6043 | (goto-char (point-max)) |
| 5965 | (while (re-search-forward | 6044 | (while (re-search-backward |
| 5966 | "^[ \t]*:VISIBILITY:[ \t]+\\([a-z]+\\)" | 6045 | "^[ \t]*:VISIBILITY:[ \t]+\\([a-z]+\\)" |
| 5967 | nil t) | 6046 | nil t) |
| 5968 | (setq state (match-string 1)) | 6047 | (setq state (match-string 1)) |
| @@ -6190,6 +6269,42 @@ Optional argument N means put the headline into the Nth line of the window." | |||
| 6190 | (beginning-of-line) | 6269 | (beginning-of-line) |
| 6191 | (recenter (prefix-numeric-value N)))) | 6270 | (recenter (prefix-numeric-value N)))) |
| 6192 | 6271 | ||
| 6272 | ;;; Saving and restoring visibility | ||
| 6273 | |||
| 6274 | (defun org-outline-overlay-data (&optional use-markers) | ||
| 6275 | "Return a list of the locations of all outline overlays. | ||
| 6276 | These are overlays with the `invisible' property value `outline'. | ||
| 6277 | The return value is a list of cons cells, with start and stop | ||
| 6278 | positions for each overlay. | ||
| 6279 | If USE-MARKERS is set, return the positions as markers." | ||
| 6280 | (let (beg end) | ||
| 6281 | (save-excursion | ||
| 6282 | (save-restriction | ||
| 6283 | (widen) | ||
| 6284 | (delq nil | ||
| 6285 | (mapcar (lambda (o) | ||
| 6286 | (when (eq (overlay-get o 'invisible) 'outline) | ||
| 6287 | (setq beg (overlay-start o) | ||
| 6288 | end (overlay-end o)) | ||
| 6289 | (and beg end (> end beg) | ||
| 6290 | (if use-markers | ||
| 6291 | (cons (move-marker (make-marker) beg) | ||
| 6292 | (move-marker (make-marker) end)) | ||
| 6293 | (cons beg end))))) | ||
| 6294 | (overlays-in (point-min) (point-max)))))))) | ||
| 6295 | |||
| 6296 | (defun org-set-outline-overlay-data (data) | ||
| 6297 | "Create visibility overlays for all positions in DATA. | ||
| 6298 | DATA should have been made by `org-outline-overlay-data'." | ||
| 6299 | (let (o) | ||
| 6300 | (save-excursion | ||
| 6301 | (save-restriction | ||
| 6302 | (widen) | ||
| 6303 | (show-all) | ||
| 6304 | (mapc (lambda (c) | ||
| 6305 | (setq o (make-overlay (car c) (cdr c))) | ||
| 6306 | (overlay-put o 'invisible 'outline)) | ||
| 6307 | data))))) | ||
| 6193 | 6308 | ||
| 6194 | ;;; Folding of blocks | 6309 | ;;; Folding of blocks |
| 6195 | 6310 | ||
| @@ -6360,7 +6475,9 @@ the headline hierarchy above." | |||
| 6360 | (selected-point | 6475 | (selected-point |
| 6361 | (if (eq interface 'outline) | 6476 | (if (eq interface 'outline) |
| 6362 | (car (org-get-location (current-buffer) org-goto-help)) | 6477 | (car (org-get-location (current-buffer) org-goto-help)) |
| 6363 | (nth 3 (org-refile-get-location "Goto: "))))) | 6478 | (let ((pa (org-refile-get-location "Goto: "))) |
| 6479 | (org-refile-check-position pa) | ||
| 6480 | (nth 3 pa))))) | ||
| 6364 | (if selected-point | 6481 | (if selected-point |
| 6365 | (progn | 6482 | (progn |
| 6366 | (org-mark-ring-push org-goto-start-pos) | 6483 | (org-mark-ring-push org-goto-start-pos) |
| @@ -6582,22 +6699,40 @@ frame is not changed." | |||
| 6582 | "Insert a new heading or item with same depth at point. | 6699 | "Insert a new heading or item with same depth at point. |
| 6583 | If point is in a plain list and FORCE-HEADING is nil, create a new list item. | 6700 | If point is in a plain list and FORCE-HEADING is nil, create a new list item. |
| 6584 | If point is at the beginning of a headline, insert a sibling before the | 6701 | If point is at the beginning of a headline, insert a sibling before the |
| 6585 | current headline. If point is not at the beginning, do not split the line, | 6702 | current headline. If point is not at the beginning, split the line, |
| 6586 | but create the new headline after the current line. | 6703 | create the new headline with the text in the current line after point |
| 6704 | \(but see also the variable `org-M-RET-may-split-line'). | ||
| 6705 | |||
| 6587 | When INVISIBLE-OK is set, stop at invisible headlines when going back. | 6706 | When INVISIBLE-OK is set, stop at invisible headlines when going back. |
| 6588 | This is important for non-interactive uses of the command." | 6707 | This is important for non-interactive uses of the command." |
| 6589 | (interactive "P") | 6708 | (interactive "P") |
| 6590 | (if (or (= (buffer-size) 0) | 6709 | (if (or (= (buffer-size) 0) |
| 6591 | (and (not (save-excursion (and (ignore-errors (org-back-to-heading invisible-ok)) | 6710 | (and (not (save-excursion |
| 6592 | (org-on-heading-p)))) | 6711 | (and (ignore-errors (org-back-to-heading invisible-ok)) |
| 6712 | (org-on-heading-p)))) | ||
| 6593 | (not (org-in-item-p)))) | 6713 | (not (org-in-item-p)))) |
| 6594 | (insert "\n* ") | 6714 | (progn |
| 6715 | (insert "\n* ") | ||
| 6716 | (run-hooks 'org-insert-heading-hook)) | ||
| 6595 | (when (or force-heading (not (org-insert-item))) | 6717 | (when (or force-heading (not (org-insert-item))) |
| 6596 | (let* ((empty-line-p nil) | 6718 | (let* ((empty-line-p nil) |
| 6719 | (level nil) | ||
| 6720 | (on-heading (org-on-heading-p)) | ||
| 6597 | (head (save-excursion | 6721 | (head (save-excursion |
| 6598 | (condition-case nil | 6722 | (condition-case nil |
| 6599 | (progn | 6723 | (progn |
| 6600 | (org-back-to-heading invisible-ok) | 6724 | (org-back-to-heading invisible-ok) |
| 6725 | (when (and (not on-heading) | ||
| 6726 | (featurep 'org-inlinetask) | ||
| 6727 | (integerp org-inlinetask-min-level) | ||
| 6728 | (>= (length (match-string 0)) | ||
| 6729 | org-inlinetask-min-level)) | ||
| 6730 | ;; Find a heading level before the inline task | ||
| 6731 | (while (and (setq level (org-up-heading-safe)) | ||
| 6732 | (>= level org-inlinetask-min-level))) | ||
| 6733 | (if (org-on-heading-p) | ||
| 6734 | (org-back-to-heading invisible-ok) | ||
| 6735 | (error "This should not happen"))) | ||
| 6601 | (setq empty-line-p (org-previous-line-empty-p)) | 6736 | (setq empty-line-p (org-previous-line-empty-p)) |
| 6602 | (match-string 0)) | 6737 | (match-string 0)) |
| 6603 | (error "*")))) | 6738 | (error "*")))) |
| @@ -6635,6 +6770,12 @@ This is important for non-interactive uses of the command." | |||
| 6635 | (cond | 6770 | (cond |
| 6636 | (org-insert-heading-respect-content | 6771 | (org-insert-heading-respect-content |
| 6637 | (org-end-of-subtree nil t) | 6772 | (org-end-of-subtree nil t) |
| 6773 | (when (featurep 'org-inlinetask) | ||
| 6774 | (while (and (not (eobp)) | ||
| 6775 | (looking-at "\\(\\*+\\)[ \t]+") | ||
| 6776 | (>= (length (match-string 1)) | ||
| 6777 | org-inlinetask-min-level)) | ||
| 6778 | (org-end-of-subtree nil t))) | ||
| 6638 | (or (bolp) (newline)) | 6779 | (or (bolp) (newline)) |
| 6639 | (or (org-previous-line-empty-p) | 6780 | (or (org-previous-line-empty-p) |
| 6640 | (and blank (newline))) | 6781 | (and blank (newline))) |
| @@ -6643,7 +6784,7 @@ This is important for non-interactive uses of the command." | |||
| 6643 | (when hide-previous | 6784 | (when hide-previous |
| 6644 | (show-children) | 6785 | (show-children) |
| 6645 | (org-show-entry)) | 6786 | (org-show-entry)) |
| 6646 | (looking-at ".*?\\([ \t]+\\(:[[:alnum:]_@:]+:\\)\\)?[ \t]*$") | 6787 | (looking-at ".*?\\([ \t]+\\(:[[:alnum:]_@#%:]+:\\)\\)?[ \t]*$") |
| 6647 | (setq tags (and (match-end 2) (match-string 2))) | 6788 | (setq tags (and (match-end 2) (match-string 2))) |
| 6648 | (and (match-end 1) | 6789 | (and (match-end 1) |
| 6649 | (delete-region (match-beginning 1) (match-end 1))) | 6790 | (delete-region (match-beginning 1) (match-end 1))) |
| @@ -6679,7 +6820,7 @@ This is important for non-interactive uses of the command." | |||
| 6679 | (org-back-to-heading t) | 6820 | (org-back-to-heading t) |
| 6680 | (if (looking-at | 6821 | (if (looking-at |
| 6681 | (if no-tags | 6822 | (if no-tags |
| 6682 | (org-re "\\*+[ \t]+\\([^\n\r]*?\\)\\([ \t]+:[[:alnum:]:_@]+:[ \t]*\\)?$") | 6823 | (org-re "\\*+[ \t]+\\([^\n\r]*?\\)\\([ \t]+:[[:alnum:]:_@#%]+:[ \t]*\\)?$") |
| 6683 | "\\*+[ \t]+\\([^\r\n]*\\)")) | 6824 | "\\*+[ \t]+\\([^\r\n]*\\)")) |
| 6684 | (match-string 1) ""))) | 6825 | (match-string 1) ""))) |
| 6685 | 6826 | ||
| @@ -6764,7 +6905,7 @@ Works for outline headings and for plain lists alike." | |||
| 6764 | (org-insert-heading arg) | 6905 | (org-insert-heading arg) |
| 6765 | (cond | 6906 | (cond |
| 6766 | ((org-on-heading-p) (org-do-demote)) | 6907 | ((org-on-heading-p) (org-do-demote)) |
| 6767 | ((org-at-item-p) (org-indent-item 1)))) | 6908 | ((org-at-item-p) (org-indent-item)))) |
| 6768 | 6909 | ||
| 6769 | (defun org-insert-todo-subheading (arg) | 6910 | (defun org-insert-todo-subheading (arg) |
| 6770 | "Insert a new subheading with TODO keyword or checkbox and demote it. | 6911 | "Insert a new subheading with TODO keyword or checkbox and demote it. |
| @@ -6773,7 +6914,7 @@ Works for outline headings and for plain lists alike." | |||
| 6773 | (org-insert-todo-heading arg) | 6914 | (org-insert-todo-heading arg) |
| 6774 | (cond | 6915 | (cond |
| 6775 | ((org-on-heading-p) (org-do-demote)) | 6916 | ((org-on-heading-p) (org-do-demote)) |
| 6776 | ((org-at-item-p) (org-indent-item 1)))) | 6917 | ((org-at-item-p) (org-indent-item)))) |
| 6777 | 6918 | ||
| 6778 | ;;; Promotion and Demotion | 6919 | ;;; Promotion and Demotion |
| 6779 | 6920 | ||
| @@ -7449,13 +7590,15 @@ and still retain the repeater to cover future instances of the task." | |||
| 7449 | ;;; Outline Sorting | 7590 | ;;; Outline Sorting |
| 7450 | 7591 | ||
| 7451 | (defun org-sort (with-case) | 7592 | (defun org-sort (with-case) |
| 7452 | "Call `org-sort-entries-or-items' or `org-table-sort-lines'. | 7593 | "Call `org-sort-entries', `org-table-sort-lines' or `org-sort-list'. |
| 7453 | Optional argument WITH-CASE means sort case-sensitively. | 7594 | Optional argument WITH-CASE means sort case-sensitively. |
| 7454 | With a double prefix argument, also remove duplicate entries." | 7595 | With a double prefix argument, also remove duplicate entries." |
| 7455 | (interactive "P") | 7596 | (interactive "P") |
| 7456 | (if (org-at-table-p) | 7597 | (cond |
| 7457 | (org-call-with-arg 'org-table-sort-lines with-case) | 7598 | ((org-at-table-p) (org-call-with-arg 'org-table-sort-lines with-case)) |
| 7458 | (org-call-with-arg 'org-sort-entries-or-items with-case))) | 7599 | ((org-at-item-p) (org-call-with-arg 'org-sort-list with-case)) |
| 7600 | (t | ||
| 7601 | (org-call-with-arg 'org-sort-entries with-case)))) | ||
| 7459 | 7602 | ||
| 7460 | (defun org-sort-remove-invisible (s) | 7603 | (defun org-sort-remove-invisible (s) |
| 7461 | (remove-text-properties 0 (length s) org-rm-props s) | 7604 | (remove-text-properties 0 (length s) org-rm-props s) |
| @@ -7473,14 +7616,12 @@ When children are sorted, the cursor is in the parent line when this | |||
| 7473 | hook gets called. When a region or a plain list is sorted, the cursor | 7616 | hook gets called. When a region or a plain list is sorted, the cursor |
| 7474 | will be in the first entry of the sorted region/list.") | 7617 | will be in the first entry of the sorted region/list.") |
| 7475 | 7618 | ||
| 7476 | (defun org-sort-entries-or-items | 7619 | (defun org-sort-entries |
| 7477 | (&optional with-case sorting-type getkey-func compare-func property) | 7620 | (&optional with-case sorting-type getkey-func compare-func property) |
| 7478 | "Sort entries on a certain level of an outline tree, or plain list items. | 7621 | "Sort entries on a certain level of an outline tree. |
| 7479 | If there is an active region, the entries in the region are sorted. | 7622 | If there is an active region, the entries in the region are sorted. |
| 7480 | Else, if the cursor is before the first entry, sort the top-level items. | 7623 | Else, if the cursor is before the first entry, sort the top-level items. |
| 7481 | Else, the children of the entry at point are sorted. | 7624 | Else, the children of the entry at point are sorted. |
| 7482 | If the cursor is at the first item in a plain list, the list items will be | ||
| 7483 | sorted. | ||
| 7484 | 7625 | ||
| 7485 | Sorting can be alphabetically, numerically, by date/time as given by | 7626 | Sorting can be alphabetically, numerically, by date/time as given by |
| 7486 | a time stamp, by a property or by priority. | 7627 | a time stamp, by a property or by priority. |
| @@ -7494,7 +7635,6 @@ n Numerically, by converting the beginning of the entry/item to a number. | |||
| 7494 | a Alphabetically, ignoring the TODO keyword and the priority, if any. | 7635 | a Alphabetically, ignoring the TODO keyword and the priority, if any. |
| 7495 | t By date/time, either the first active time stamp in the entry, or, if | 7636 | t By date/time, either the first active time stamp in the entry, or, if |
| 7496 | none exist, by the first inactive one. | 7637 | none exist, by the first inactive one. |
| 7497 | In items, only the first line will be checked. | ||
| 7498 | s By the scheduled date/time. | 7638 | s By the scheduled date/time. |
| 7499 | d By deadline date/time. | 7639 | d By deadline date/time. |
| 7500 | c By creation time, which is assumed to be the first inactive time stamp | 7640 | c By creation time, which is assumed to be the first inactive time stamp |
| @@ -7513,7 +7653,7 @@ WITH-CASE, the sorting considers case as well." | |||
| 7513 | (interactive "P") | 7653 | (interactive "P") |
| 7514 | (let ((case-func (if with-case 'identity 'downcase)) | 7654 | (let ((case-func (if with-case 'identity 'downcase)) |
| 7515 | start beg end stars re re2 | 7655 | start beg end stars re re2 |
| 7516 | txt what tmp plain-list-p) | 7656 | txt what tmp) |
| 7517 | ;; Find beginning and end of region to sort | 7657 | ;; Find beginning and end of region to sort |
| 7518 | (cond | 7658 | (cond |
| 7519 | ((org-region-active-p) | 7659 | ((org-region-active-p) |
| @@ -7523,15 +7663,6 @@ WITH-CASE, the sorting considers case as well." | |||
| 7523 | (goto-char (region-beginning)) | 7663 | (goto-char (region-beginning)) |
| 7524 | (if (not (org-on-heading-p)) (outline-next-heading)) | 7664 | (if (not (org-on-heading-p)) (outline-next-heading)) |
| 7525 | (setq start (point))) | 7665 | (setq start (point))) |
| 7526 | ((org-at-item-p) | ||
| 7527 | ;; we will sort this plain list | ||
| 7528 | (org-beginning-of-item-list) (setq start (point)) | ||
| 7529 | (org-end-of-item-list) | ||
| 7530 | (or (bolp) (insert "\n")) | ||
| 7531 | (setq end (point)) | ||
| 7532 | (goto-char start) | ||
| 7533 | (setq plain-list-p t | ||
| 7534 | what "plain list")) | ||
| 7535 | ((or (org-on-heading-p) | 7666 | ((or (org-on-heading-p) |
| 7536 | (condition-case nil (progn (org-back-to-heading) t) (error nil))) | 7667 | (condition-case nil (progn (org-back-to-heading) t) (error nil))) |
| 7537 | ;; we will sort the children of the current headline | 7668 | ;; we will sort the children of the current headline |
| @@ -7564,43 +7695,39 @@ WITH-CASE, the sorting considers case as well." | |||
| 7564 | (setq beg (point)) | 7695 | (setq beg (point)) |
| 7565 | (if (>= beg end) (error "Nothing to sort")) | 7696 | (if (>= beg end) (error "Nothing to sort")) |
| 7566 | 7697 | ||
| 7567 | (unless plain-list-p | 7698 | (looking-at "\\(\\*+\\)") |
| 7568 | (looking-at "\\(\\*+\\)") | 7699 | (setq stars (match-string 1) |
| 7569 | (setq stars (match-string 1) | 7700 | re (concat "^" (regexp-quote stars) " +") |
| 7570 | re (concat "^" (regexp-quote stars) " +") | 7701 | re2 (concat "^" (regexp-quote (substring stars 0 -1)) "[^*]") |
| 7571 | re2 (concat "^" (regexp-quote (substring stars 0 -1)) "[^*]") | 7702 | txt (buffer-substring beg end)) |
| 7572 | txt (buffer-substring beg end)) | 7703 | (if (not (equal (substring txt -1) "\n")) (setq txt (concat txt "\n"))) |
| 7573 | (if (not (equal (substring txt -1) "\n")) (setq txt (concat txt "\n"))) | 7704 | (if (and (not (equal stars "*")) (string-match re2 txt)) |
| 7574 | (if (and (not (equal stars "*")) (string-match re2 txt)) | 7705 | (error "Region to sort contains a level above the first entry")) |
| 7575 | (error "Region to sort contains a level above the first entry"))) | ||
| 7576 | 7706 | ||
| 7577 | (unless sorting-type | 7707 | (unless sorting-type |
| 7578 | (message | 7708 | (message |
| 7579 | (if plain-list-p | 7709 | "Sort %s: [a]lpha [n]umeric [p]riority p[r]operty todo[o]rder [f]unc |
| 7580 | "Sort %s: [a]lpha [n]umeric [t]ime [f]unc A/N/T/F means reversed:" | ||
| 7581 | "Sort %s: [a]lpha [n]umeric [p]riority p[r]operty todo[o]rder [f]unc | ||
| 7582 | [t]ime [s]cheduled [d]eadline [c]reated | 7710 | [t]ime [s]cheduled [d]eadline [c]reated |
| 7583 | A/N/T/S/D/C/P/O/F means reversed:") | 7711 | A/N/T/S/D/C/P/O/F means reversed:" |
| 7584 | what) | 7712 | what) |
| 7585 | (setq sorting-type (read-char-exclusive)) | 7713 | (setq sorting-type (read-char-exclusive)) |
| 7586 | 7714 | ||
| 7587 | (and (= (downcase sorting-type) ?f) | 7715 | (and (= (downcase sorting-type) ?f) |
| 7588 | (setq getkey-func | 7716 | (setq getkey-func |
| 7589 | (org-icompleting-read "Sort using function: " | 7717 | (org-icompleting-read "Sort using function: " |
| 7590 | obarray 'fboundp t nil nil)) | 7718 | obarray 'fboundp t nil nil)) |
| 7591 | (setq getkey-func (intern getkey-func))) | 7719 | (setq getkey-func (intern getkey-func))) |
| 7592 | 7720 | ||
| 7593 | (and (= (downcase sorting-type) ?r) | 7721 | (and (= (downcase sorting-type) ?r) |
| 7594 | (setq property | 7722 | (setq property |
| 7595 | (org-icompleting-read "Property: " | 7723 | (org-icompleting-read "Property: " |
| 7596 | (mapcar 'list (org-buffer-property-keys t)) | 7724 | (mapcar 'list (org-buffer-property-keys t)) |
| 7597 | nil t)))) | 7725 | nil t)))) |
| 7598 | 7726 | ||
| 7599 | (message "Sorting entries...") | 7727 | (message "Sorting entries...") |
| 7600 | 7728 | ||
| 7601 | (save-restriction | 7729 | (save-restriction |
| 7602 | (narrow-to-region start end) | 7730 | (narrow-to-region start end) |
| 7603 | |||
| 7604 | (let ((dcst (downcase sorting-type)) | 7731 | (let ((dcst (downcase sorting-type)) |
| 7605 | (case-fold-search nil) | 7732 | (case-fold-search nil) |
| 7606 | (now (current-time))) | 7733 | (now (current-time))) |
| @@ -7608,99 +7735,70 @@ WITH-CASE, the sorting considers case as well." | |||
| 7608 | (/= dcst sorting-type) | 7735 | (/= dcst sorting-type) |
| 7609 | ;; This function moves to the beginning character of the "record" to | 7736 | ;; This function moves to the beginning character of the "record" to |
| 7610 | ;; be sorted. | 7737 | ;; be sorted. |
| 7611 | (if plain-list-p | 7738 | (lambda nil |
| 7612 | (lambda nil | 7739 | (if (re-search-forward re nil t) |
| 7613 | (if (org-at-item-p) t (goto-char (point-max)))) | 7740 | (goto-char (match-beginning 0)) |
| 7614 | (lambda nil | 7741 | (goto-char (point-max)))) |
| 7615 | (if (re-search-forward re nil t) | ||
| 7616 | (goto-char (match-beginning 0)) | ||
| 7617 | (goto-char (point-max))))) | ||
| 7618 | ;; This function moves to the last character of the "record" being | 7742 | ;; This function moves to the last character of the "record" being |
| 7619 | ;; sorted. | 7743 | ;; sorted. |
| 7620 | (if plain-list-p | 7744 | (lambda nil |
| 7621 | 'org-end-of-item | 7745 | (save-match-data |
| 7622 | (lambda nil | 7746 | (condition-case nil |
| 7623 | (save-match-data | 7747 | (outline-forward-same-level 1) |
| 7624 | (condition-case nil | 7748 | (error |
| 7625 | (outline-forward-same-level 1) | 7749 | (goto-char (point-max)))))) |
| 7626 | (error | ||
| 7627 | (goto-char (point-max))))))) | ||
| 7628 | |||
| 7629 | ;; This function returns the value that gets sorted against. | 7750 | ;; This function returns the value that gets sorted against. |
| 7630 | (if plain-list-p | 7751 | (lambda nil |
| 7631 | (lambda nil | 7752 | (cond |
| 7632 | (when (looking-at "[ \t]*[-+*0-9.)]+[ \t]+") | 7753 | ((= dcst ?n) |
| 7633 | (cond | 7754 | (if (looking-at org-complex-heading-regexp) |
| 7634 | ((= dcst ?n) | 7755 | (string-to-number (match-string 4)) |
| 7635 | (string-to-number (buffer-substring (match-end 0) | 7756 | nil)) |
| 7636 | (point-at-eol)))) | 7757 | ((= dcst ?a) |
| 7637 | ((= dcst ?a) | 7758 | (if (looking-at org-complex-heading-regexp) |
| 7638 | (buffer-substring (match-end 0) (point-at-eol))) | 7759 | (funcall case-func (match-string 4)) |
| 7639 | ((= dcst ?t) | 7760 | nil)) |
| 7640 | (if (or (re-search-forward org-ts-regexp (point-at-eol) t) | 7761 | ((= dcst ?t) |
| 7641 | (re-search-forward org-ts-regexp-both | 7762 | (let ((end (save-excursion (outline-next-heading) (point)))) |
| 7642 | (point-at-eol) t)) | 7763 | (if (or (re-search-forward org-ts-regexp end t) |
| 7643 | (org-time-string-to-seconds (match-string 0)) | 7764 | (re-search-forward org-ts-regexp-both end t)) |
| 7644 | (org-float-time now))) | 7765 | (org-time-string-to-seconds (match-string 0)) |
| 7645 | ((= dcst ?f) | 7766 | (org-float-time now)))) |
| 7646 | (if getkey-func | 7767 | ((= dcst ?c) |
| 7647 | (progn | 7768 | (let ((end (save-excursion (outline-next-heading) (point)))) |
| 7648 | (setq tmp (funcall getkey-func)) | 7769 | (if (re-search-forward |
| 7649 | (if (stringp tmp) (setq tmp (funcall case-func tmp))) | 7770 | (concat "^[ \t]*\\[" org-ts-regexp1 "\\]") |
| 7650 | tmp) | 7771 | end t) |
| 7651 | (error "Invalid key function `%s'" getkey-func))) | 7772 | (org-time-string-to-seconds (match-string 0)) |
| 7652 | (t (error "Invalid sorting type `%c'" sorting-type))))) | 7773 | (org-float-time now)))) |
| 7653 | (lambda nil | 7774 | ((= dcst ?s) |
| 7654 | (cond | 7775 | (let ((end (save-excursion (outline-next-heading) (point)))) |
| 7655 | ((= dcst ?n) | 7776 | (if (re-search-forward org-scheduled-time-regexp end t) |
| 7656 | (if (looking-at org-complex-heading-regexp) | 7777 | (org-time-string-to-seconds (match-string 1)) |
| 7657 | (string-to-number (match-string 4)) | 7778 | (org-float-time now)))) |
| 7658 | nil)) | 7779 | ((= dcst ?d) |
| 7659 | ((= dcst ?a) | 7780 | (let ((end (save-excursion (outline-next-heading) (point)))) |
| 7660 | (if (looking-at org-complex-heading-regexp) | 7781 | (if (re-search-forward org-deadline-time-regexp end t) |
| 7661 | (funcall case-func (match-string 4)) | 7782 | (org-time-string-to-seconds (match-string 1)) |
| 7662 | nil)) | 7783 | (org-float-time now)))) |
| 7663 | ((= dcst ?t) | 7784 | ((= dcst ?p) |
| 7664 | (let ((end (save-excursion (outline-next-heading) (point)))) | 7785 | (if (re-search-forward org-priority-regexp (point-at-eol) t) |
| 7665 | (if (or (re-search-forward org-ts-regexp end t) | 7786 | (string-to-char (match-string 2)) |
| 7666 | (re-search-forward org-ts-regexp-both end t)) | 7787 | org-default-priority)) |
| 7667 | (org-time-string-to-seconds (match-string 0)) | 7788 | ((= dcst ?r) |
| 7668 | (org-float-time now)))) | 7789 | (or (org-entry-get nil property) "")) |
| 7669 | ((= dcst ?c) | 7790 | ((= dcst ?o) |
| 7670 | (let ((end (save-excursion (outline-next-heading) (point)))) | 7791 | (if (looking-at org-complex-heading-regexp) |
| 7671 | (if (re-search-forward | 7792 | (- 9999 (length (member (match-string 2) |
| 7672 | (concat "^[ \t]*\\[" org-ts-regexp1 "\\]") | 7793 | org-todo-keywords-1))))) |
| 7673 | end t) | 7794 | ((= dcst ?f) |
| 7674 | (org-time-string-to-seconds (match-string 0)) | 7795 | (if getkey-func |
| 7675 | (org-float-time now)))) | 7796 | (progn |
| 7676 | ((= dcst ?s) | 7797 | (setq tmp (funcall getkey-func)) |
| 7677 | (let ((end (save-excursion (outline-next-heading) (point)))) | 7798 | (if (stringp tmp) (setq tmp (funcall case-func tmp))) |
| 7678 | (if (re-search-forward org-scheduled-time-regexp end t) | 7799 | tmp) |
| 7679 | (org-time-string-to-seconds (match-string 1)) | 7800 | (error "Invalid key function `%s'" getkey-func))) |
| 7680 | (org-float-time now)))) | 7801 | (t (error "Invalid sorting type `%c'" sorting-type)))) |
| 7681 | ((= dcst ?d) | ||
| 7682 | (let ((end (save-excursion (outline-next-heading) (point)))) | ||
| 7683 | (if (re-search-forward org-deadline-time-regexp end t) | ||
| 7684 | (org-time-string-to-seconds (match-string 1)) | ||
| 7685 | (org-float-time now)))) | ||
| 7686 | ((= dcst ?p) | ||
| 7687 | (if (re-search-forward org-priority-regexp (point-at-eol) t) | ||
| 7688 | (string-to-char (match-string 2)) | ||
| 7689 | org-default-priority)) | ||
| 7690 | ((= dcst ?r) | ||
| 7691 | (or (org-entry-get nil property) "")) | ||
| 7692 | ((= dcst ?o) | ||
| 7693 | (if (looking-at org-complex-heading-regexp) | ||
| 7694 | (- 9999 (length (member (match-string 2) | ||
| 7695 | org-todo-keywords-1))))) | ||
| 7696 | ((= dcst ?f) | ||
| 7697 | (if getkey-func | ||
| 7698 | (progn | ||
| 7699 | (setq tmp (funcall getkey-func)) | ||
| 7700 | (if (stringp tmp) (setq tmp (funcall case-func tmp))) | ||
| 7701 | tmp) | ||
| 7702 | (error "Invalid key function `%s'" getkey-func))) | ||
| 7703 | (t (error "Invalid sorting type `%c'" sorting-type))))) | ||
| 7704 | nil | 7802 | nil |
| 7705 | (cond | 7803 | (cond |
| 7706 | ((= dcst ?a) 'string<) | 7804 | ((= dcst ?a) 'string<) |
| @@ -8105,11 +8203,13 @@ It should be a function accepting three arguments: | |||
| 8105 | 8203 | ||
| 8106 | path the path of the link, the text after the prefix (like \"http:\") | 8204 | path the path of the link, the text after the prefix (like \"http:\") |
| 8107 | desc the description of the link, if any, nil if there was no description | 8205 | desc the description of the link, if any, nil if there was no description |
| 8108 | format the export format, a symbol like `html' or `latex'. | 8206 | format the export format, a symbol like `html' or `latex' or `ascii'.. |
| 8109 | 8207 | ||
| 8110 | The function may use the FORMAT information to return different values | 8208 | The function may use the FORMAT information to return different values |
| 8111 | depending on the format. The return value will be put literally into | 8209 | depending on the format. The return value will be put literally into |
| 8112 | the exported file. | 8210 | the exported file. If the return value is nil, this means Org should |
| 8211 | do what it normally does with links which do not have EXPORT defined. | ||
| 8212 | |||
| 8113 | Org-mode has a built-in default for exporting links. If you are happy with | 8213 | Org-mode has a built-in default for exporting links. If you are happy with |
| 8114 | this default, there is no need to define an export function for the link | 8214 | this default, there is no need to define an export function for the link |
| 8115 | type. For a simple example of an export function, see `org-bbdb.el'." | 8215 | type. For a simple example of an export function, see `org-bbdb.el'." |
| @@ -8134,7 +8234,7 @@ For file links, arg negates `org-context-in-file-links'." | |||
| 8134 | (org-load-modules-maybe) | 8234 | (org-load-modules-maybe) |
| 8135 | (setq org-store-link-plist nil) ; reset | 8235 | (setq org-store-link-plist nil) ; reset |
| 8136 | (let ((outline-regexp (org-get-limited-outline-regexp)) | 8236 | (let ((outline-regexp (org-get-limited-outline-regexp)) |
| 8137 | link cpltxt desc description search txt custom-id) | 8237 | link cpltxt desc description search txt custom-id agenda-link) |
| 8138 | (cond | 8238 | (cond |
| 8139 | 8239 | ||
| 8140 | ((run-hook-with-args-until-success 'org-store-link-functions) | 8240 | ((run-hook-with-args-until-success 'org-store-link-functions) |
| @@ -8166,9 +8266,10 @@ For file links, arg negates `org-context-in-file-links'." | |||
| 8166 | (get-text-property (point) 'org-marker)))) | 8266 | (get-text-property (point) 'org-marker)))) |
| 8167 | (when m | 8267 | (when m |
| 8168 | (org-with-point-at m | 8268 | (org-with-point-at m |
| 8169 | (if (interactive-p) | 8269 | (setq agenda-link |
| 8170 | (call-interactively 'org-store-link) | 8270 | (if (interactive-p) |
| 8171 | (org-store-link nil)))))) | 8271 | (call-interactively 'org-store-link) |
| 8272 | (org-store-link nil))))))) | ||
| 8172 | 8273 | ||
| 8173 | ((eq major-mode 'calendar-mode) | 8274 | ((eq major-mode 'calendar-mode) |
| 8174 | (let ((cd (calendar-cursor-to-date))) | 8275 | (let ((cd (calendar-cursor-to-date))) |
| @@ -8216,13 +8317,14 @@ For file links, arg negates `org-context-in-file-links'." | |||
| 8216 | (setq cpltxt (concat "file:" file) | 8317 | (setq cpltxt (concat "file:" file) |
| 8217 | link (org-make-link cpltxt)))) | 8318 | link (org-make-link cpltxt)))) |
| 8218 | 8319 | ||
| 8219 | ((and buffer-file-name (org-mode-p)) | 8320 | ((and (buffer-file-name (buffer-base-buffer)) (org-mode-p)) |
| 8220 | (setq custom-id (ignore-errors (org-entry-get nil "CUSTOM_ID"))) | 8321 | (setq custom-id (ignore-errors (org-entry-get nil "CUSTOM_ID"))) |
| 8221 | (cond | 8322 | (cond |
| 8222 | ((org-in-regexp "<<\\(.*?\\)>>") | 8323 | ((org-in-regexp "<<\\(.*?\\)>>") |
| 8223 | (setq cpltxt | 8324 | (setq cpltxt |
| 8224 | (concat "file:" | 8325 | (concat "file:" |
| 8225 | (abbreviate-file-name buffer-file-name) | 8326 | (abbreviate-file-name |
| 8327 | (buffer-file-name (buffer-base-buffer))) | ||
| 8226 | "::" (match-string 1)) | 8328 | "::" (match-string 1)) |
| 8227 | link (org-make-link cpltxt))) | 8329 | link (org-make-link cpltxt))) |
| 8228 | ((and (featurep 'org-id) | 8330 | ((and (featurep 'org-id) |
| @@ -8244,11 +8346,13 @@ For file links, arg negates `org-context-in-file-links'." | |||
| 8244 | (error | 8346 | (error |
| 8245 | ;; probably before first headline, link to file only | 8347 | ;; probably before first headline, link to file only |
| 8246 | (concat "file:" | 8348 | (concat "file:" |
| 8247 | (abbreviate-file-name buffer-file-name)))))) | 8349 | (abbreviate-file-name |
| 8350 | (buffer-file-name (buffer-base-buffer)))))))) | ||
| 8248 | (t | 8351 | (t |
| 8249 | ;; Just link to current headline | 8352 | ;; Just link to current headline |
| 8250 | (setq cpltxt (concat "file:" | 8353 | (setq cpltxt (concat "file:" |
| 8251 | (abbreviate-file-name buffer-file-name))) | 8354 | (abbreviate-file-name |
| 8355 | (buffer-file-name (buffer-base-buffer))))) | ||
| 8252 | ;; Add a context search string | 8356 | ;; Add a context search string |
| 8253 | (when (org-xor org-context-in-file-links arg) | 8357 | (when (org-xor org-context-in-file-links arg) |
| 8254 | (setq txt (cond | 8358 | (setq txt (cond |
| @@ -8305,7 +8409,7 @@ For file links, arg negates `org-context-in-file-links'." | |||
| 8305 | "::#" custom-id)) | 8409 | "::#" custom-id)) |
| 8306 | (setq org-stored-links | 8410 | (setq org-stored-links |
| 8307 | (cons (list link desc) org-stored-links)))) | 8411 | (cons (list link desc) org-stored-links)))) |
| 8308 | (and link (org-make-link-string link desc))))) | 8412 | (or agenda-link (and link (org-make-link-string link desc)))))) |
| 8309 | 8413 | ||
| 8310 | (defun org-store-link-props (&rest plist) | 8414 | (defun org-store-link-props (&rest plist) |
| 8311 | "Store link properties, extract names and addresses." | 8415 | "Store link properties, extract names and addresses." |
| @@ -8369,7 +8473,7 @@ according to FMT (default from `org-email-link-description-format')." | |||
| 8369 | ;; We are using a headline, clean up garbage in there. | 8473 | ;; We are using a headline, clean up garbage in there. |
| 8370 | (if (string-match org-todo-regexp s) | 8474 | (if (string-match org-todo-regexp s) |
| 8371 | (setq s (replace-match "" t t s))) | 8475 | (setq s (replace-match "" t t s))) |
| 8372 | (if (string-match (org-re ":[[:alnum:]_@:]+:[ \t]*$") s) | 8476 | (if (string-match (org-re ":[[:alnum:]_@#%:]+:[ \t]*$") s) |
| 8373 | (setq s (replace-match "" t t s))) | 8477 | (setq s (replace-match "" t t s))) |
| 8374 | (setq s (org-trim s)) | 8478 | (setq s (org-trim s)) |
| 8375 | (if (string-match (concat "^\\(" org-quote-string "\\|" | 8479 | (if (string-match (concat "^\\(" org-quote-string "\\|" |
| @@ -8377,8 +8481,6 @@ according to FMT (default from `org-email-link-description-format')." | |||
| 8377 | (setq s (replace-match "" t t s))) | 8481 | (setq s (replace-match "" t t s))) |
| 8378 | (while (string-match org-ts-regexp s) | 8482 | (while (string-match org-ts-regexp s) |
| 8379 | (setq s (replace-match "" t t s)))) | 8483 | (setq s (replace-match "" t t s)))) |
| 8380 | (while (string-match "[^a-zA-Z_0-9 \t]+" s) | ||
| 8381 | (setq s (replace-match " " t t s))) | ||
| 8382 | (or string (setq s (concat "*" s))) ; Add * for headlines | 8484 | (or string (setq s (concat "*" s))) ; Add * for headlines |
| 8383 | (mapconcat 'identity (org-split-string s "[ \t]+") " "))) | 8485 | (mapconcat 'identity (org-split-string s "[ \t]+") " "))) |
| 8384 | 8486 | ||
| @@ -8406,7 +8508,11 @@ according to FMT (default from `org-email-link-description-format')." | |||
| 8406 | (when (and (not description) | 8508 | (when (and (not description) |
| 8407 | (not (equal link (org-link-escape link)))) | 8509 | (not (equal link (org-link-escape link)))) |
| 8408 | (setq description (org-extract-attributes link))) | 8510 | (setq description (org-extract-attributes link))) |
| 8409 | (concat "[[" (org-link-escape link) "]" | 8511 | (setq link (if (string-match org-link-types-re link) |
| 8512 | (concat (match-string 1 link) | ||
| 8513 | (org-link-escape (substring link (match-end 1)))) | ||
| 8514 | (org-link-escape link))) | ||
| 8515 | (concat "[[" link "]" | ||
| 8410 | (if description (concat "[" description "]") "") | 8516 | (if description (concat "[" description "]") "") |
| 8411 | "]")) | 8517 | "]")) |
| 8412 | 8518 | ||
| @@ -8914,6 +9020,13 @@ Org-mode syntax." | |||
| 8914 | org-link-abbrev-alist-local))) | 9020 | org-link-abbrev-alist-local))) |
| 8915 | (org-open-at-point arg reference-buffer))))) | 9021 | (org-open-at-point arg reference-buffer))))) |
| 8916 | 9022 | ||
| 9023 | (defvar org-open-at-point-functions nil | ||
| 9024 | "Hook that is run when following a link at point. | ||
| 9025 | |||
| 9026 | Functions in this hook must return t if they identify and follow | ||
| 9027 | a link at point. If they don't find anything interesting at point, | ||
| 9028 | they must return nil.") | ||
| 9029 | |||
| 8917 | (defun org-open-at-point (&optional in-emacs reference-buffer) | 9030 | (defun org-open-at-point (&optional in-emacs reference-buffer) |
| 8918 | "Open link at or after point. | 9031 | "Open link at or after point. |
| 8919 | If there is no link at point, this function will search forward up to | 9032 | If there is no link at point, this function will search forward up to |
| @@ -8939,6 +9052,7 @@ application the system uses for this file type." | |||
| 8939 | (not (get-text-property (point) 'org-linked-text))) | 9052 | (not (get-text-property (point) 'org-linked-text))) |
| 8940 | (or (org-offer-links-in-entry in-emacs) | 9053 | (or (org-offer-links-in-entry in-emacs) |
| 8941 | (progn (require 'org-attach) (org-attach-reveal 'if-exists)))) | 9054 | (progn (require 'org-attach) (org-attach-reveal 'if-exists)))) |
| 9055 | ((run-hook-with-args-until-success 'org-open-at-point-functions)) | ||
| 8942 | ((org-at-timestamp-p t) (org-follow-timestamp-link)) | 9056 | ((org-at-timestamp-p t) (org-follow-timestamp-link)) |
| 8943 | ((or (org-footnote-at-reference-p) (org-footnote-at-definition-p)) | 9057 | ((or (org-footnote-at-reference-p) (org-footnote-at-definition-p)) |
| 8944 | (org-footnote-action)) | 9058 | (org-footnote-action)) |
| @@ -8977,7 +9091,7 @@ application the system uses for this file type." | |||
| 8977 | (setq type (match-string 1) path (match-string 2)) | 9091 | (setq type (match-string 1) path (match-string 2)) |
| 8978 | (throw 'match t))) | 9092 | (throw 'match t))) |
| 8979 | (save-excursion | 9093 | (save-excursion |
| 8980 | (when (org-in-regexp (org-re "\\(:[[:alnum:]_@:]+\\):[ \t]*$")) | 9094 | (when (org-in-regexp (org-re "\\(:[[:alnum:]_@#%:]+\\):[ \t]*$")) |
| 8981 | (setq type "tags" | 9095 | (setq type "tags" |
| 8982 | path (match-string 1)) | 9096 | path (match-string 1)) |
| 8983 | (while (string-match ":" path) | 9097 | (while (string-match ":" path) |
| @@ -9243,6 +9357,7 @@ the window configuration before `org-open-at-point' was called using: | |||
| 9243 | 9357 | ||
| 9244 | (set-window-configuration org-window-config-before-follow-link)") | 9358 | (set-window-configuration org-window-config-before-follow-link)") |
| 9245 | 9359 | ||
| 9360 | (defvar org-link-search-inhibit-query nil) ;; dynamically scoped | ||
| 9246 | (defun org-link-search (s &optional type avoid-pos) | 9361 | (defun org-link-search (s &optional type avoid-pos) |
| 9247 | "Search for a link search option. | 9362 | "Search for a link search option. |
| 9248 | If S is surrounded by forward slashes, it is interpreted as a | 9363 | If S is surrounded by forward slashes, it is interpreted as a |
| @@ -9260,7 +9375,7 @@ in all files. If AVOID-POS is given, ignore matches near that position." | |||
| 9260 | (pre nil) (post nil) | 9375 | (pre nil) (post nil) |
| 9261 | words re0 re1 re2 re3 re4_ re4 re5 re2a re2a_ reall) | 9376 | words re0 re1 re2 re3 re4_ re4 re5 re2a re2a_ reall) |
| 9262 | (cond | 9377 | (cond |
| 9263 | ;; First check if there are any special | 9378 | ;; First check if there are any special search functions |
| 9264 | ((run-hook-with-args-until-success 'org-execute-file-search-functions s)) | 9379 | ((run-hook-with-args-until-success 'org-execute-file-search-functions s)) |
| 9265 | ;; Now try the builtin stuff | 9380 | ;; Now try the builtin stuff |
| 9266 | ((and (equal (string-to-char s0) ?#) | 9381 | ((and (equal (string-to-char s0) ?#) |
| @@ -9305,12 +9420,33 @@ in all files. If AVOID-POS is given, ignore matches near that position." | |||
| 9305 | ;;((eq major-mode 'dired-mode) | 9420 | ;;((eq major-mode 'dired-mode) |
| 9306 | ;; (grep (concat "grep -n -e '" (match-string 1 s) "' *"))) | 9421 | ;; (grep (concat "grep -n -e '" (match-string 1 s) "' *"))) |
| 9307 | (t (org-do-occur (match-string 1 s))))) | 9422 | (t (org-do-occur (match-string 1 s))))) |
| 9423 | ((and (org-mode-p) org-link-search-must-match-exact-headline) | ||
| 9424 | (and (equal (string-to-char s) ?*) (setq s (substring s 1))) | ||
| 9425 | (goto-char (point-min)) | ||
| 9426 | (cond | ||
| 9427 | ((let (case-fold-search) | ||
| 9428 | (re-search-forward (format org-complex-heading-regexp-format | ||
| 9429 | (regexp-quote s)) | ||
| 9430 | nil t)) | ||
| 9431 | ;; OK, found a match | ||
| 9432 | (setq type 'dedicated) | ||
| 9433 | (goto-char (match-beginning 0))) | ||
| 9434 | ((and (not org-link-search-inhibit-query) | ||
| 9435 | (eq org-link-search-must-match-exact-headline 'query-to-create) | ||
| 9436 | (y-or-n-p "No match - create this as a new heading? ")) | ||
| 9437 | (goto-char (point-max)) | ||
| 9438 | (or (bolp) (newline)) | ||
| 9439 | (insert "* " s "\n") | ||
| 9440 | (beginning-of-line 0)) | ||
| 9441 | (t | ||
| 9442 | (goto-char pos) | ||
| 9443 | (error "No match")))) | ||
| 9308 | (t | 9444 | (t |
| 9309 | ;; A normal search strings | 9445 | ;; A normal search string |
| 9310 | (when (equal (string-to-char s) ?*) | 9446 | (when (equal (string-to-char s) ?*) |
| 9311 | ;; Anchor on headlines, post may include tags. | 9447 | ;; Anchor on headlines, post may include tags. |
| 9312 | (setq pre "^\\*+[ \t]+\\(?:\\sw+\\)?[ \t]*" | 9448 | (setq pre "^\\*+[ \t]+\\(?:\\sw+\\)?[ \t]*" |
| 9313 | post (org-re "[ \t]*\\(?:[ \t]+:[[:alnum:]_@:+]:[ \t]*\\)?$") | 9449 | post (org-re "[ \t]*\\(?:[ \t]+:[[:alnum:]_@#%:+]:[ \t]*\\)?$") |
| 9314 | s (substring s 1))) | 9450 | s (substring s 1))) |
| 9315 | (remove-text-properties | 9451 | (remove-text-properties |
| 9316 | 0 (length s) | 9452 | 0 (length s) |
| @@ -9351,13 +9487,7 @@ in all files. If AVOID-POS is given, ignore matches near that position." | |||
| 9351 | ) | 9487 | ) |
| 9352 | (goto-char (match-beginning 1)) | 9488 | (goto-char (match-beginning 1)) |
| 9353 | (goto-char pos) | 9489 | (goto-char pos) |
| 9354 | (error "No match"))))) | 9490 | (error "No match")))))) |
| 9355 | (t | ||
| 9356 | ;; Normal string-search | ||
| 9357 | (goto-char (point-min)) | ||
| 9358 | (if (search-forward s nil t) | ||
| 9359 | (goto-char (match-beginning 0)) | ||
| 9360 | (error "No match")))) | ||
| 9361 | (and (org-mode-p) (org-show-context 'link-search)) | 9491 | (and (org-mode-p) (org-show-context 'link-search)) |
| 9362 | type)) | 9492 | type)) |
| 9363 | 9493 | ||
| @@ -9836,15 +9966,9 @@ on the system \"/user@host:\"." | |||
| 9836 | (setq level (org-reduced-level | 9966 | (setq level (org-reduced-level |
| 9837 | (- (match-end 1) (match-beginning 1))) | 9967 | (- (match-end 1) (match-beginning 1))) |
| 9838 | txt (org-link-display-format (match-string 4)) | 9968 | txt (org-link-display-format (match-string 4)) |
| 9839 | re (concat "^" (regexp-quote | 9969 | txt (replace-regexp-in-string "\\( *\[[0-9]+/?[0-9]*%?\]\\)+$" "" txt) |
| 9840 | (buffer-substring | 9970 | re (format org-complex-heading-regexp-format |
| 9841 | (match-beginning 1) | 9971 | (regexp-quote (match-string 4)))) |
| 9842 | (match-end 4))))) | ||
| 9843 | (if (match-end 5) (setq re (concat | ||
| 9844 | re "[ \t]+" | ||
| 9845 | (regexp-quote | ||
| 9846 | (match-string 5))))) | ||
| 9847 | (setq re (concat re "[ \t]*$")) | ||
| 9848 | (when org-refile-use-outline-path | 9972 | (when org-refile-use-outline-path |
| 9849 | (setq txt (mapconcat | 9973 | (setq txt (mapconcat |
| 9850 | 'org-protect-slash | 9974 | 'org-protect-slash |
| @@ -10143,6 +10267,7 @@ This can be done with a 0 prefix: `C-0 C-c C-w'" | |||
| 10143 | (setq answ (funcall cfunc prompt tbl nil (not new-nodes) | 10267 | (setq answ (funcall cfunc prompt tbl nil (not new-nodes) |
| 10144 | nil 'org-refile-history)) | 10268 | nil 'org-refile-history)) |
| 10145 | (setq pa (or (assoc answ tbl) (assoc (concat answ "/") tbl))) | 10269 | (setq pa (or (assoc answ tbl) (assoc (concat answ "/") tbl))) |
| 10270 | (org-refile-check-position pa) | ||
| 10146 | (if pa | 10271 | (if pa |
| 10147 | (progn | 10272 | (progn |
| 10148 | (when (or (not org-refile-history) | 10273 | (when (or (not org-refile-history) |
| @@ -10169,6 +10294,26 @@ This can be done with a 0 prefix: `C-0 C-c C-w'" | |||
| 10169 | (org-refile-new-child parent-target child))) | 10294 | (org-refile-new-child parent-target child))) |
| 10170 | (error "Invalid target location"))))) | 10295 | (error "Invalid target location"))))) |
| 10171 | 10296 | ||
| 10297 | (defun org-refile-check-position (refile-pointer) | ||
| 10298 | "Check if the refile pointer matches the readline to which it points." | ||
| 10299 | (let* ((file (nth 1 refile-pointer)) | ||
| 10300 | (re (nth 2 refile-pointer)) | ||
| 10301 | (pos (nth 3 refile-pointer)) | ||
| 10302 | buffer) | ||
| 10303 | (when (org-string-nw-p re) | ||
| 10304 | (setq buffer (if (markerp pos) | ||
| 10305 | (marker-buffer pos) | ||
| 10306 | (or (find-buffer-visiting file) | ||
| 10307 | (find-file-noselect file)))) | ||
| 10308 | (with-current-buffer buffer | ||
| 10309 | (save-excursion | ||
| 10310 | (save-restriction | ||
| 10311 | (widen) | ||
| 10312 | (goto-char pos) | ||
| 10313 | (beginning-of-line 1) | ||
| 10314 | (unless (org-looking-at-p re) | ||
| 10315 | (error "Invalid refile position, please rebuild the cache")))))))) | ||
| 10316 | |||
| 10172 | (defun org-refile-new-child (parent-target child) | 10317 | (defun org-refile-new-child (parent-target child) |
| 10173 | "Use refile target PARENT-TARGET to add new CHILD below it." | 10318 | "Use refile target PARENT-TARGET to add new CHILD below it." |
| 10174 | (unless parent-target | 10319 | (unless parent-target |
| @@ -10378,7 +10523,7 @@ This function can be used in a hook." | |||
| 10378 | "BEGIN_VERSE" "END_VERSE" | 10523 | "BEGIN_VERSE" "END_VERSE" |
| 10379 | "BEGIN_CENTER" "END_CENTER" | 10524 | "BEGIN_CENTER" "END_CENTER" |
| 10380 | "BEGIN_SRC" "END_SRC" | 10525 | "BEGIN_SRC" "END_SRC" |
| 10381 | "CATEGORY" "COLUMNS" | 10526 | "CATEGORY" "COLUMNS" "PROPERTY" |
| 10382 | "CAPTION" "LABEL" | 10527 | "CAPTION" "LABEL" |
| 10383 | "SETUPFILE" | 10528 | "SETUPFILE" |
| 10384 | "BIND" | 10529 | "BIND" |
| @@ -10482,7 +10627,7 @@ At all other locations, this simply calls the value of | |||
| 10482 | (let* ((a nil) | 10627 | (let* ((a nil) |
| 10483 | (end (point)) | 10628 | (end (point)) |
| 10484 | (beg1 (save-excursion | 10629 | (beg1 (save-excursion |
| 10485 | (skip-chars-backward (org-re "[:alnum:]_@")) | 10630 | (skip-chars-backward (org-re "[:alnum:]_@#%")) |
| 10486 | (point))) | 10631 | (point))) |
| 10487 | (beg (save-excursion | 10632 | (beg (save-excursion |
| 10488 | (skip-chars-backward "a-zA-Z0-9_:$") | 10633 | (skip-chars-backward "a-zA-Z0-9_:$") |
| @@ -10497,8 +10642,10 @@ At all other locations, this simply calls the value of | |||
| 10497 | (throw 'exit t))) | 10642 | (throw 'exit t))) |
| 10498 | (tag (and (equal (char-before beg1) ?:) | 10643 | (tag (and (equal (char-before beg1) ?:) |
| 10499 | (equal (char-after (point-at-bol)) ?*))) | 10644 | (equal (char-after (point-at-bol)) ?*))) |
| 10500 | (prop (and (equal (char-before beg1) ?:) | 10645 | (prop (or (and (equal (char-before beg1) ?:) |
| 10501 | (not (equal (char-after (point-at-bol)) ?*)))) | 10646 | (not (equal (char-after (point-at-bol)) ?*))) |
| 10647 | (string-match "^#\\+PROPERTY:.*" | ||
| 10648 | (buffer-substring (point-at-bol) (point))))) | ||
| 10502 | (texp (equal (char-before beg) ?\\)) | 10649 | (texp (equal (char-before beg) ?\\)) |
| 10503 | (link (equal (char-before beg) ?\[)) | 10650 | (link (equal (char-before beg) ?\[)) |
| 10504 | (opt (equal (buffer-substring (max (point-at-bol) (- beg 2)) | 10651 | (opt (equal (buffer-substring (max (point-at-bol) (- beg 2)) |
| @@ -10575,7 +10722,10 @@ At all other locations, this simply calls the value of | |||
| 10575 | (delete-window (get-buffer-window "*Completions*"))) | 10722 | (delete-window (get-buffer-window "*Completions*"))) |
| 10576 | (if (assoc completion table) | 10723 | (if (assoc completion table) |
| 10577 | (if (eq type :todo) (insert " ") | 10724 | (if (eq type :todo) (insert " ") |
| 10578 | (if (memq type '(:tag :prop)) (insert ":")))) | 10725 | (if (and (memq type '(:tag :prop)) |
| 10726 | (not (string-match "^#[ \t]*\\+property:" | ||
| 10727 | (org-current-line-string t)))) | ||
| 10728 | (insert ":")))) | ||
| 10579 | (if (and (equal type :opt) (assoc completion table)) | 10729 | (if (and (equal type :opt) (assoc completion table)) |
| 10580 | (message "%s" (substitute-command-keys | 10730 | (message "%s" (substitute-command-keys |
| 10581 | "Press \\[org-complete] again to insert example settings")))) | 10731 | "Press \\[org-complete] again to insert example settings")))) |
| @@ -10613,27 +10763,6 @@ this is nil.") | |||
| 10613 | 10763 | ||
| 10614 | (defvar org-setting-tags nil) ; dynamically skipped | 10764 | (defvar org-setting-tags nil) ; dynamically skipped |
| 10615 | 10765 | ||
| 10616 | (defun org-parse-local-options (string var) | ||
| 10617 | "Parse STRING for startup setting relevant for variable VAR." | ||
| 10618 | (let ((rtn (symbol-value var)) | ||
| 10619 | e opts) | ||
| 10620 | (save-match-data | ||
| 10621 | (if (or (not string) (not (string-match "\\S-" string))) | ||
| 10622 | rtn | ||
| 10623 | (setq opts (delq nil (mapcar (lambda (x) | ||
| 10624 | (setq e (assoc x org-startup-options)) | ||
| 10625 | (if (eq (nth 1 e) var) e nil)) | ||
| 10626 | (org-split-string string "[ \t]+")))) | ||
| 10627 | (if (not opts) | ||
| 10628 | rtn | ||
| 10629 | (setq rtn nil) | ||
| 10630 | (while (setq e (pop opts)) | ||
| 10631 | (if (not (nth 3 e)) | ||
| 10632 | (setq rtn (nth 2 e)) | ||
| 10633 | (if (not (listp rtn)) (setq rtn nil)) | ||
| 10634 | (push (nth 2 e) rtn))) | ||
| 10635 | rtn))))) | ||
| 10636 | |||
| 10637 | (defvar org-todo-setup-filter-hook nil | 10766 | (defvar org-todo-setup-filter-hook nil |
| 10638 | "Hook for functions that pre-filter todo specs. | 10767 | "Hook for functions that pre-filter todo specs. |
| 10639 | Each function takes a todo spec and returns either nil or the spec | 10768 | Each function takes a todo spec and returns either nil or the spec |
| @@ -11313,7 +11442,6 @@ This function is run automatically after each state change to a DONE state." | |||
| 11313 | (msg "Entry repeats: ") | 11442 | (msg "Entry repeats: ") |
| 11314 | (org-log-done nil) | 11443 | (org-log-done nil) |
| 11315 | (org-todo-log-states nil) | 11444 | (org-todo-log-states nil) |
| 11316 | (nshiftmax 10) (nshift 0) | ||
| 11317 | re type n what ts time to-state) | 11445 | re type n what ts time to-state) |
| 11318 | (when repeat | 11446 | (when repeat |
| 11319 | (if (eq org-log-repeat t) (setq org-log-repeat 'state)) | 11447 | (if (eq org-log-repeat t) (setq org-log-repeat 'state)) |
| @@ -11360,15 +11488,17 @@ This function is run automatically after each state change to a DONE state." | |||
| 11360 | (- (time-to-days (current-time)) (time-to-days time)) | 11488 | (- (time-to-days (current-time)) (time-to-days time)) |
| 11361 | 'day)) | 11489 | 'day)) |
| 11362 | ((equal (match-string 1 ts) "+") | 11490 | ((equal (match-string 1 ts) "+") |
| 11363 | (while (or (= nshift 0) | 11491 | (let ((nshiftmax 10) (nshift 0)) |
| 11364 | (<= (time-to-days time) (time-to-days (current-time)))) | 11492 | (while (or (= nshift 0) |
| 11365 | (when (= (incf nshift) nshiftmax) | 11493 | (<= (time-to-days time) |
| 11366 | (or (y-or-n-p (message "%d repeater intervals were not enough to shift date past today. Continue? " nshift)) | 11494 | (time-to-days (current-time)))) |
| 11367 | (error "Abort"))) | 11495 | (when (= (incf nshift) nshiftmax) |
| 11368 | (org-timestamp-change n (cdr (assoc what whata))) | 11496 | (or (y-or-n-p (message "%d repeater intervals were not enough to shift date past today. Continue? " nshift)) |
| 11369 | (org-at-timestamp-p t) | 11497 | (error "Abort"))) |
| 11370 | (setq ts (match-string 1)) | 11498 | (org-timestamp-change n (cdr (assoc what whata))) |
| 11371 | (setq time (save-match-data (org-time-string-to-time ts)))) | 11499 | (org-at-timestamp-p t) |
| 11500 | (setq ts (match-string 1)) | ||
| 11501 | (setq time (save-match-data (org-time-string-to-time ts))))) | ||
| 11372 | (org-timestamp-change (- n) (cdr (assoc what whata))) | 11502 | (org-timestamp-change (- n) (cdr (assoc what whata))) |
| 11373 | ;; rematch, so that we have everything in place for the real shift | 11503 | ;; rematch, so that we have everything in place for the real shift |
| 11374 | (org-at-timestamp-p t) | 11504 | (org-at-timestamp-p t) |
| @@ -11631,7 +11761,7 @@ This is done in the same way as adding a state change note." | |||
| 11631 | 11761 | ||
| 11632 | (defvar org-property-end-re) | 11762 | (defvar org-property-end-re) |
| 11633 | (defun org-add-log-setup (&optional purpose state prev-state | 11763 | (defun org-add-log-setup (&optional purpose state prev-state |
| 11634 | findpos how &optional extra) | 11764 | findpos how extra) |
| 11635 | "Set up the post command hook to take a note. | 11765 | "Set up the post command hook to take a note. |
| 11636 | If this is about to TODO state change, the new state is expected in STATE. | 11766 | If this is about to TODO state change, the new state is expected in STATE. |
| 11637 | When FINDPOS is non-nil, find the correct position for the note in | 11767 | When FINDPOS is non-nil, find the correct position for the note in |
| @@ -11692,10 +11822,11 @@ EXTRA is additional text that will be inserted into the notes buffer." | |||
| 11692 | (defun org-skip-over-state-notes () | 11822 | (defun org-skip-over-state-notes () |
| 11693 | "Skip past the list of State notes in an entry." | 11823 | "Skip past the list of State notes in an entry." |
| 11694 | (if (looking-at "\n[ \t]*- State") (forward-char 1)) | 11824 | (if (looking-at "\n[ \t]*- State") (forward-char 1)) |
| 11695 | (while (looking-at "[ \t]*- State") | 11825 | (when (org-in-item-p) |
| 11696 | (condition-case nil | 11826 | (let ((limit (org-list-bottom-point))) |
| 11697 | (org-next-item) | 11827 | (while (looking-at "[ \t]*- State") |
| 11698 | (error (org-end-of-item))))) | 11828 | (goto-char (or (org-get-next-item (point) limit) |
| 11829 | (org-get-end-of-item limit))))))) | ||
| 11699 | 11830 | ||
| 11700 | (defun org-add-log-note (&optional purpose) | 11831 | (defun org-add-log-note (&optional purpose) |
| 11701 | "Pop up a window for taking a note, and add this note later at point." | 11832 | "Pop up a window for taking a note, and add this note later at point." |
| @@ -11740,7 +11871,7 @@ EXTRA is additional text that will be inserted into the notes buffer." | |||
| 11740 | "Finish taking a log note, and insert it to where it belongs." | 11871 | "Finish taking a log note, and insert it to where it belongs." |
| 11741 | (let ((txt (buffer-string)) | 11872 | (let ((txt (buffer-string)) |
| 11742 | (note (cdr (assq org-log-note-purpose org-log-note-headings))) | 11873 | (note (cdr (assq org-log-note-purpose org-log-note-headings))) |
| 11743 | lines ind) | 11874 | lines ind bul) |
| 11744 | (kill-buffer (current-buffer)) | 11875 | (kill-buffer (current-buffer)) |
| 11745 | (while (string-match "\\`#.*\n[ \t\n]*" txt) | 11876 | (while (string-match "\\`#.*\n[ \t\n]*" txt) |
| 11746 | (setq txt (replace-match "" t t txt))) | 11877 | (setq txt (replace-match "" t t txt))) |
| @@ -11780,13 +11911,26 @@ EXTRA is additional text that will be inserted into the notes buffer." | |||
| 11780 | (move-marker org-log-note-marker nil) | 11911 | (move-marker org-log-note-marker nil) |
| 11781 | (end-of-line 1) | 11912 | (end-of-line 1) |
| 11782 | (if (not (bolp)) (let ((inhibit-read-only t)) (insert "\n"))) | 11913 | (if (not (bolp)) (let ((inhibit-read-only t)) (insert "\n"))) |
| 11783 | (insert "- " (pop lines)) | 11914 | (setq ind (save-excursion |
| 11784 | (org-indent-line-function) | 11915 | (if (org-in-item-p) |
| 11785 | (beginning-of-line 1) | 11916 | (progn |
| 11786 | (looking-at "[ \t]*") | 11917 | (goto-char (org-list-top-point)) |
| 11787 | (setq ind (concat (match-string 0) " ")) | 11918 | (org-get-indentation)) |
| 11788 | (end-of-line 1) | 11919 | (skip-chars-backward " \r\t\n") |
| 11789 | (while lines (insert "\n" ind (pop lines))) | 11920 | (cond |
| 11921 | ((and (org-at-heading-p) | ||
| 11922 | org-adapt-indentation) | ||
| 11923 | (1+ (org-current-level))) | ||
| 11924 | ((org-at-heading-p) 0) | ||
| 11925 | (t (org-get-indentation)))))) | ||
| 11926 | (setq bul (org-list-bullet-string "-")) | ||
| 11927 | (org-indent-line-to ind) | ||
| 11928 | (insert bul (pop lines)) | ||
| 11929 | (let ((ind-body (+ (length bul) ind))) | ||
| 11930 | (while lines | ||
| 11931 | (insert "\n") | ||
| 11932 | (org-indent-line-to ind-body) | ||
| 11933 | (insert (pop lines)))) | ||
| 11790 | (message "Note stored") | 11934 | (message "Note stored") |
| 11791 | (org-back-to-heading t) | 11935 | (org-back-to-heading t) |
| 11792 | (org-cycle-hide-drawers 'children))))) | 11936 | (org-cycle-hide-drawers 'children))))) |
| @@ -12024,7 +12168,8 @@ ACTION can be `set', `up', `down', or a character." | |||
| 12024 | (setq new action) | 12168 | (setq new action) |
| 12025 | (message "Priority %c-%c, SPC to remove: " | 12169 | (message "Priority %c-%c, SPC to remove: " |
| 12026 | org-highest-priority org-lowest-priority) | 12170 | org-highest-priority org-lowest-priority) |
| 12027 | (setq new (read-char-exclusive))) | 12171 | (save-match-data |
| 12172 | (setq new (read-char-exclusive)))) | ||
| 12028 | (if (and (= (upcase org-highest-priority) org-highest-priority) | 12173 | (if (and (= (upcase org-highest-priority) org-highest-priority) |
| 12029 | (= (upcase org-lowest-priority) org-lowest-priority)) | 12174 | (= (upcase org-lowest-priority) org-lowest-priority)) |
| 12030 | (setq new (upcase new))) | 12175 | (setq new (upcase new))) |
| @@ -12109,7 +12254,7 @@ only lines with a TODO keyword are included in the output." | |||
| 12109 | (let* ((re (concat "^" outline-regexp " *\\(\\<\\(" | 12254 | (let* ((re (concat "^" outline-regexp " *\\(\\<\\(" |
| 12110 | (mapconcat 'regexp-quote org-todo-keywords-1 "\\|") | 12255 | (mapconcat 'regexp-quote org-todo-keywords-1 "\\|") |
| 12111 | (org-re | 12256 | (org-re |
| 12112 | "\\>\\)\\)? *\\(.*?\\)\\(:[[:alnum:]_@:]+:\\)?[ \t]*$"))) | 12257 | "\\>\\)\\)? *\\(.*?\\)\\(:[[:alnum:]_@#%:]+:\\)?[ \t]*$"))) |
| 12113 | (props (list 'face 'default | 12258 | (props (list 'face 'default |
| 12114 | 'done-face 'org-agenda-done | 12259 | 'done-face 'org-agenda-done |
| 12115 | 'undone-face 'default | 12260 | 'undone-face 'default |
| @@ -12309,7 +12454,7 @@ also TODO lines." | |||
| 12309 | 12454 | ||
| 12310 | ;; Parse the string and create a lisp form | 12455 | ;; Parse the string and create a lisp form |
| 12311 | (let ((match0 match) | 12456 | (let ((match0 match) |
| 12312 | (re (org-re "^&?\\([-+:]\\)?\\({[^}]+}\\|LEVEL\\([<=>]\\{1,2\\}\\)\\([0-9]+\\)\\|\\([[:alnum:]_]+\\)\\([<>=]\\{1,2\\}\\)\\({[^}]+}\\|\"[^\"]*\"\\|-?[.0-9]+\\(?:[eE][-+]?[0-9]+\\)?\\)\\|[[:alnum:]_@]+\\)")) | 12457 | (re (org-re "^&?\\([-+:]\\)?\\({[^}]+}\\|LEVEL\\([<=>]\\{1,2\\}\\)\\([0-9]+\\)\\|\\(\\(?:[[:alnum:]_]+\\(?:\\\\-\\)*\\)+\\)\\([<>=]\\{1,2\\}\\)\\({[^}]+}\\|\"[^\"]*\"\\|-?[.0-9]+\\(?:[eE][-+]?[0-9]+\\)?\\)\\|[[:alnum:]_@#%]+\\)")) |
| 12313 | minus tag mm | 12458 | minus tag mm |
| 12314 | tagsmatch todomatch tagsmatcher todomatcher kwd matcher | 12459 | tagsmatch todomatch tagsmatcher todomatcher kwd matcher |
| 12315 | orterms term orlist re-p str-p level-p level-op time-p | 12460 | orterms term orlist re-p str-p level-p level-op time-p |
| @@ -12337,7 +12482,9 @@ also TODO lines." | |||
| 12337 | (setq rest (substring term (match-end 0)) | 12482 | (setq rest (substring term (match-end 0)) |
| 12338 | minus (and (match-end 1) | 12483 | minus (and (match-end 1) |
| 12339 | (equal (match-string 1 term) "-")) | 12484 | (equal (match-string 1 term) "-")) |
| 12340 | tag (match-string 2 term) | 12485 | tag (save-match-data (replace-regexp-in-string |
| 12486 | "\\\\-" "-" | ||
| 12487 | (match-string 2 term))) | ||
| 12341 | re-p (equal (string-to-char tag) ?{) | 12488 | re-p (equal (string-to-char tag) ?{) |
| 12342 | level-p (match-end 4) | 12489 | level-p (match-end 4) |
| 12343 | prop-p (match-end 5) | 12490 | prop-p (match-end 5) |
| @@ -12516,7 +12663,7 @@ ignore inherited ones." | |||
| 12516 | (while (not (equal lastpos (point))) | 12663 | (while (not (equal lastpos (point))) |
| 12517 | (setq lastpos (point)) | 12664 | (setq lastpos (point)) |
| 12518 | (when (looking-at | 12665 | (when (looking-at |
| 12519 | (org-re "[^\r\n]+?:\\([[:alnum:]_@:]+\\):[ \t]*$")) | 12666 | (org-re "[^\r\n]+?:\\([[:alnum:]_@#%:]+\\):[ \t]*$")) |
| 12520 | (setq ltags (org-split-string | 12667 | (setq ltags (org-split-string |
| 12521 | (org-match-string-no-properties 1) ":")) | 12668 | (org-match-string-no-properties 1) ":")) |
| 12522 | (when parent | 12669 | (when parent |
| @@ -12543,7 +12690,7 @@ If ONOFF is `on' or `off', don't toggle but set to this state." | |||
| 12543 | (let (res current) | 12690 | (let (res current) |
| 12544 | (save-excursion | 12691 | (save-excursion |
| 12545 | (org-back-to-heading t) | 12692 | (org-back-to-heading t) |
| 12546 | (if (re-search-forward (org-re "[ \t]:\\([[:alnum:]_@:]+\\):[ \t]*$") | 12693 | (if (re-search-forward (org-re "[ \t]:\\([[:alnum:]_@#%:]+\\):[ \t]*$") |
| 12547 | (point-at-eol) t) | 12694 | (point-at-eol) t) |
| 12548 | (progn | 12695 | (progn |
| 12549 | (setq current (match-string 1)) | 12696 | (setq current (match-string 1)) |
| @@ -12573,7 +12720,7 @@ If ONOFF is `on' or `off', don't toggle but set to this state." | |||
| 12573 | ;; Assumes that this is a headline | 12720 | ;; Assumes that this is a headline |
| 12574 | (let ((pos (point)) (col (current-column)) ncol tags-l p) | 12721 | (let ((pos (point)) (col (current-column)) ncol tags-l p) |
| 12575 | (beginning-of-line 1) | 12722 | (beginning-of-line 1) |
| 12576 | (if (and (looking-at (org-re ".*?\\([ \t]+\\)\\(:[[:alnum:]_@:]+:\\)[ \t]*$")) | 12723 | (if (and (looking-at (org-re ".*?\\([ \t]+\\)\\(:[[:alnum:]_@#%:]+:\\)[ \t]*$")) |
| 12577 | (< pos (match-beginning 2))) | 12724 | (< pos (match-beginning 2))) |
| 12578 | (progn | 12725 | (progn |
| 12579 | (setq tags-l (- (match-end 2) (match-beginning 2))) | 12726 | (setq tags-l (- (match-end 2) (match-beginning 2))) |
| @@ -12643,6 +12790,7 @@ If DATA is nil or the empty string, any tags will be removed." | |||
| 12643 | (org-set-tags t) | 12790 | (org-set-tags t) |
| 12644 | (message "No headings")))) | 12791 | (message "No headings")))) |
| 12645 | 12792 | ||
| 12793 | (defvar org-indent-indentation-per-level) | ||
| 12646 | (defun org-set-tags (&optional arg just-align) | 12794 | (defun org-set-tags (&optional arg just-align) |
| 12647 | "Set the tags for the current headline. | 12795 | "Set the tags for the current headline. |
| 12648 | With prefix ARG, realign all tags in headings in the current buffer." | 12796 | With prefix ARG, realign all tags in headings in the current buffer." |
| @@ -12652,7 +12800,7 @@ With prefix ARG, realign all tags in headings in the current buffer." | |||
| 12652 | (col (current-column)) | 12800 | (col (current-column)) |
| 12653 | (org-setting-tags t) | 12801 | (org-setting-tags t) |
| 12654 | table current-tags inherited-tags ; computed below when needed | 12802 | table current-tags inherited-tags ; computed below when needed |
| 12655 | tags p0 c0 c1 rpl) | 12803 | tags p0 c0 c1 rpl di tc level) |
| 12656 | (if arg | 12804 | (if arg |
| 12657 | (save-excursion | 12805 | (save-excursion |
| 12658 | (goto-char (point-min)) | 12806 | (goto-char (point-min)) |
| @@ -12667,8 +12815,10 @@ With prefix ARG, realign all tags in headings in the current buffer." | |||
| 12667 | (save-excursion | 12815 | (save-excursion |
| 12668 | (setq table (append org-tag-persistent-alist | 12816 | (setq table (append org-tag-persistent-alist |
| 12669 | (or org-tag-alist (org-get-buffer-tags)) | 12817 | (or org-tag-alist (org-get-buffer-tags)) |
| 12670 | (and org-complete-tags-always-offer-all-agenda-tags | 12818 | (and |
| 12671 | (org-global-tags-completion-table (org-agenda-files)))) | 12819 | org-complete-tags-always-offer-all-agenda-tags |
| 12820 | (org-global-tags-completion-table | ||
| 12821 | (org-agenda-files)))) | ||
| 12672 | org-last-tags-completion-table table | 12822 | org-last-tags-completion-table table |
| 12673 | current-tags (org-split-string current ":") | 12823 | current-tags (org-split-string current ":") |
| 12674 | inherited-tags (nreverse | 12824 | inherited-tags (nreverse |
| @@ -12680,19 +12830,24 @@ With prefix ARG, realign all tags in headings in the current buffer." | |||
| 12680 | (delq nil (mapcar 'cdr table)))) | 12830 | (delq nil (mapcar 'cdr table)))) |
| 12681 | (org-fast-tag-selection | 12831 | (org-fast-tag-selection |
| 12682 | current-tags inherited-tags table | 12832 | current-tags inherited-tags table |
| 12683 | (if org-fast-tag-selection-include-todo org-todo-key-alist)) | 12833 | (if org-fast-tag-selection-include-todo |
| 12834 | org-todo-key-alist)) | ||
| 12684 | (let ((org-add-colon-after-tag-completion t)) | 12835 | (let ((org-add-colon-after-tag-completion t)) |
| 12685 | (org-trim | 12836 | (org-trim |
| 12686 | (org-without-partial-completion | 12837 | (org-without-partial-completion |
| 12687 | (org-icompleting-read "Tags: " 'org-tags-completion-function | 12838 | (org-icompleting-read "Tags: " |
| 12839 | 'org-tags-completion-function | ||
| 12688 | nil nil current 'org-tags-history))))))) | 12840 | nil nil current 'org-tags-history))))))) |
| 12689 | (while (string-match "[-+&]+" tags) | 12841 | (while (string-match "[-+&]+" tags) |
| 12690 | ;; No boolean logic, just a list | 12842 | ;; No boolean logic, just a list |
| 12691 | (setq tags (replace-match ":" t t tags)))) | 12843 | (setq tags (replace-match ":" t t tags)))) |
| 12692 | 12844 | ||
| 12845 | (setq tags (replace-regexp-in-string "[ ,]" ":" tags)) | ||
| 12846 | |||
| 12693 | (if org-tags-sort-function | 12847 | (if org-tags-sort-function |
| 12694 | (setq tags (mapconcat 'identity | 12848 | (setq tags (mapconcat 'identity |
| 12695 | (sort (org-split-string tags (org-re "[^[:alnum:]_@]+")) | 12849 | (sort (org-split-string |
| 12850 | tags (org-re "[^[:alnum:]_@#%]+")) | ||
| 12696 | org-tags-sort-function) ":"))) | 12851 | org-tags-sort-function) ":"))) |
| 12697 | 12852 | ||
| 12698 | (if (string-match "\\`[\t ]*\\'" tags) | 12853 | (if (string-match "\\`[\t ]*\\'" tags) |
| @@ -12702,6 +12857,9 @@ With prefix ARG, realign all tags in headings in the current buffer." | |||
| 12702 | 12857 | ||
| 12703 | ;; Insert new tags at the correct column | 12858 | ;; Insert new tags at the correct column |
| 12704 | (beginning-of-line 1) | 12859 | (beginning-of-line 1) |
| 12860 | (setq level (or (and (looking-at org-outline-regexp) | ||
| 12861 | (- (match-end 0) (point) 1)) | ||
| 12862 | 1)) | ||
| 12705 | (cond | 12863 | (cond |
| 12706 | ((and (equal current "") (equal tags ""))) | 12864 | ((and (equal current "") (equal tags ""))) |
| 12707 | ((re-search-forward | 12865 | ((re-search-forward |
| @@ -12710,11 +12868,14 @@ With prefix ARG, realign all tags in headings in the current buffer." | |||
| 12710 | (if (equal tags "") | 12868 | (if (equal tags "") |
| 12711 | (setq rpl "") | 12869 | (setq rpl "") |
| 12712 | (goto-char (match-beginning 0)) | 12870 | (goto-char (match-beginning 0)) |
| 12713 | (setq c0 (current-column) p0 (if (equal (char-before) ?*) | 12871 | (setq c0 (current-column) |
| 12714 | (1+ (point)) (point)) | 12872 | ;; compute offset for the case of org-indent-mode active |
| 12715 | c1 (max (1+ c0) (if (> org-tags-column 0) | 12873 | di (if org-indent-mode |
| 12716 | org-tags-column | 12874 | (* (1- org-indent-indentation-per-level) (1- level)) |
| 12717 | (- (- org-tags-column) (length tags)))) | 12875 | 0) |
| 12876 | p0 (if (equal (char-before) ?*) (1+ (point)) (point)) | ||
| 12877 | tc (+ org-tags-column (if (> org-tags-column 0) (- di) di)) | ||
| 12878 | c1 (max (1+ c0) (if (> tc 0) tc (- (- tc) (length tags)))) | ||
| 12718 | rpl (concat (make-string (max 0 (- c1 c0)) ?\ ) tags))) | 12879 | rpl (concat (make-string (max 0 (- c1 c0)) ?\ ) tags))) |
| 12719 | (replace-match rpl t t) | 12880 | (replace-match rpl t t) |
| 12720 | (and (not (featurep 'xemacs)) c0 indent-tabs-mode (tabify p0 (point))) | 12881 | (and (not (featurep 'xemacs)) c0 indent-tabs-mode (tabify p0 (point))) |
| @@ -12766,7 +12927,7 @@ This works in the agenda, and also in an org-mode buffer." | |||
| 12766 | (defun org-tags-completion-function (string predicate &optional flag) | 12927 | (defun org-tags-completion-function (string predicate &optional flag) |
| 12767 | (let (s1 s2 rtn (ctable org-last-tags-completion-table) | 12928 | (let (s1 s2 rtn (ctable org-last-tags-completion-table) |
| 12768 | (confirm (lambda (x) (stringp (car x))))) | 12929 | (confirm (lambda (x) (stringp (car x))))) |
| 12769 | (if (string-match "^\\(.*[-+:&|]\\)\\([^-+:&|]*\\)$" string) | 12930 | (if (string-match "^\\(.*[-+:&,|]\\)\\([^-+:&,|]*\\)$" string) |
| 12770 | (setq s1 (match-string 1 string) | 12931 | (setq s1 (match-string 1 string) |
| 12771 | s2 (match-string 2 string)) | 12932 | s2 (match-string 2 string)) |
| 12772 | (setq s1 "" s2 string)) | 12933 | (setq s1 "" s2 string)) |
| @@ -12843,7 +13004,7 @@ Returns the new tags string, or nil to not change the current settings." | |||
| 12843 | (save-excursion | 13004 | (save-excursion |
| 12844 | (beginning-of-line 1) | 13005 | (beginning-of-line 1) |
| 12845 | (if (looking-at | 13006 | (if (looking-at |
| 12846 | (org-re ".*[ \t]\\(:[[:alnum:]_@:]+:\\)[ \t]*$")) | 13007 | (org-re ".*[ \t]\\(:[[:alnum:]_@#%:]+:\\)[ \t]*$")) |
| 12847 | (setq ov-start (match-beginning 1) | 13008 | (setq ov-start (match-beginning 1) |
| 12848 | ov-end (match-end 1) | 13009 | ov-end (match-end 1) |
| 12849 | ov-prefix "") | 13010 | ov-prefix "") |
| @@ -12993,7 +13154,7 @@ Returns the new tags string, or nil to not change the current settings." | |||
| 12993 | (org-fast-tag-insert "Current" current c-face) | 13154 | (org-fast-tag-insert "Current" current c-face) |
| 12994 | (org-set-current-tags-overlay current ov-prefix) | 13155 | (org-set-current-tags-overlay current ov-prefix) |
| 12995 | (while (re-search-forward | 13156 | (while (re-search-forward |
| 12996 | (org-re "\\[.\\] \\([[:alnum:]_@]+\\)") nil t) | 13157 | (org-re "\\[.\\] \\([[:alnum:]_@#%]+\\)") nil t) |
| 12997 | (setq tg (match-string 1)) | 13158 | (setq tg (match-string 1)) |
| 12998 | (add-text-properties | 13159 | (add-text-properties |
| 12999 | (match-beginning 1) (match-end 1) | 13160 | (match-beginning 1) (match-end 1) |
| @@ -13014,7 +13175,7 @@ Returns the new tags string, or nil to not change the current settings." | |||
| 13014 | (error "Not on a heading")) | 13175 | (error "Not on a heading")) |
| 13015 | (save-excursion | 13176 | (save-excursion |
| 13016 | (beginning-of-line 1) | 13177 | (beginning-of-line 1) |
| 13017 | (if (looking-at (org-re ".*[ \t]\\(:[[:alnum:]_@:]+:\\)[ \t]*$")) | 13178 | (if (looking-at (org-re ".*[ \t]\\(:[[:alnum:]_@#%:]+:\\)[ \t]*$")) |
| 13018 | (org-match-string-no-properties 1) | 13179 | (org-match-string-no-properties 1) |
| 13019 | ""))) | 13180 | ""))) |
| 13020 | 13181 | ||
| @@ -13028,7 +13189,7 @@ Returns the new tags string, or nil to not change the current settings." | |||
| 13028 | (save-excursion | 13189 | (save-excursion |
| 13029 | (goto-char (point-min)) | 13190 | (goto-char (point-min)) |
| 13030 | (while (re-search-forward | 13191 | (while (re-search-forward |
| 13031 | (org-re "[ \t]:\\([[:alnum:]_@:]+\\):[ \t\r\n]") nil t) | 13192 | (org-re "[ \t]:\\([[:alnum:]_@#%:]+\\):[ \t\r\n]") nil t) |
| 13032 | (when (equal (char-after (point-at-bol 0)) ?*) | 13193 | (when (equal (char-after (point-at-bol 0)) ?*) |
| 13033 | (mapc (lambda (x) (add-to-list 'tags x)) | 13194 | (mapc (lambda (x) (add-to-list 'tags x)) |
| 13034 | (org-split-string (org-match-string-no-properties 1) ":"))))) | 13195 | (org-split-string (org-match-string-no-properties 1) ":"))))) |
| @@ -13899,6 +14060,42 @@ only headings." | |||
| 13899 | (when (org-on-heading-p) | 14060 | (when (org-on-heading-p) |
| 13900 | (move-marker (make-marker) (point)))))))) | 14061 | (move-marker (make-marker) (point)))))))) |
| 13901 | 14062 | ||
| 14063 | (defun org-find-exact-headline-in-buffer (heading &optional buffer pos-only) | ||
| 14064 | "Find node HEADING in BUFFER. | ||
| 14065 | Return a marker to the heading if it was found, or nil if not. | ||
| 14066 | If POS-ONLY is set, return just the position instead of a marker. | ||
| 14067 | |||
| 14068 | The heading text must match exact, but it may have a TODO keyword, | ||
| 14069 | a priority cookie and tags in the standard locations." | ||
| 14070 | (with-current-buffer (or buffer (current-buffer)) | ||
| 14071 | (save-excursion | ||
| 14072 | (save-restriction | ||
| 14073 | (widen) | ||
| 14074 | (goto-char (point-min)) | ||
| 14075 | (let (case-fold-search) | ||
| 14076 | (if (re-search-forward | ||
| 14077 | (format org-complex-heading-regexp-format | ||
| 14078 | (regexp-quote heading)) nil t) | ||
| 14079 | (if pos-only | ||
| 14080 | (match-beginning 0) | ||
| 14081 | (move-marker (make-marker) (match-beginning 0))))))))) | ||
| 14082 | |||
| 14083 | (defun org-find-exact-heading-in-directory (heading &optional dir) | ||
| 14084 | "Find Org node headline HEADING in all .org files in directory DIR. | ||
| 14085 | When the target headline is found, return a marker to this location." | ||
| 14086 | (let ((files (directory-files (or dir default-directory) | ||
| 14087 | nil "\\`[^.#].*\\.org\\'")) | ||
| 14088 | file visiting m buffer) | ||
| 14089 | (catch 'found | ||
| 14090 | (while (setq file (pop files)) | ||
| 14091 | (message "trying %s" file) | ||
| 14092 | (setq visiting (org-find-base-buffer-visiting file)) | ||
| 14093 | (setq buffer (or visiting (find-file-noselect file))) | ||
| 14094 | (setq m (org-find-exact-headline-in-buffer | ||
| 14095 | heading buffer)) | ||
| 14096 | (when (and (not m) (not visiting)) (kill-buffer buffer)) | ||
| 14097 | (and m (throw 'found m)))))) | ||
| 14098 | |||
| 13902 | (defun org-find-entry-with-id (ident) | 14099 | (defun org-find-entry-with-id (ident) |
| 13903 | "Locate the entry that contains the ID property with exact value IDENT. | 14100 | "Locate the entry that contains the ID property with exact value IDENT. |
| 13904 | IDENT can be a string, a symbol or a number, this function will search for | 14101 | IDENT can be a string, a symbol or a number, this function will search for |
| @@ -14190,6 +14387,10 @@ user." | |||
| 14190 | (setq org-read-date-overlay nil))))) | 14387 | (setq org-read-date-overlay nil))))) |
| 14191 | 14388 | ||
| 14192 | (setq final (org-read-date-analyze ans def defdecode)) | 14389 | (setq final (org-read-date-analyze ans def defdecode)) |
| 14390 | |||
| 14391 | ;; One round trip to get rid of 34th of August and stuff like that.... | ||
| 14392 | (setq final (decode-time (apply 'encode-time final))) | ||
| 14393 | |||
| 14193 | (setq org-read-date-final-answer ans) | 14394 | (setq org-read-date-final-answer ans) |
| 14194 | 14395 | ||
| 14195 | (if to-time | 14396 | (if to-time |
| @@ -14457,9 +14658,10 @@ user function argument order change dependent on argument order." | |||
| 14457 | (list arg2 arg1 arg3)) | 14658 | (list arg2 arg1 arg3)) |
| 14458 | ((eq calendar-date-style 'iso) | 14659 | ((eq calendar-date-style 'iso) |
| 14459 | (list arg2 arg3 arg1))) | 14660 | (list arg2 arg3 arg1))) |
| 14460 | (if (org-bound-and-true-p european-calendar-style) | 14661 | (with-no-warnings ;; european-calendar-style is obsolete as of version 23.1 |
| 14461 | (list arg2 arg1 arg3) | 14662 | (if (org-bound-and-true-p european-calendar-style) |
| 14462 | (list arg1 arg2 arg3)))) | 14663 | (list arg2 arg1 arg3) |
| 14664 | (list arg1 arg2 arg3))))) | ||
| 14463 | 14665 | ||
| 14464 | (defun org-eval-in-calendar (form &optional keepdate) | 14666 | (defun org-eval-in-calendar (form &optional keepdate) |
| 14465 | "Eval FORM in the calendar window and return to current window. | 14667 | "Eval FORM in the calendar window and return to current window. |
| @@ -14498,7 +14700,6 @@ The command returns the inserted time stamp." | |||
| 14498 | stamp) | 14700 | stamp) |
| 14499 | (if inactive (setq fmt (concat "[" (substring fmt 1 -1) "]"))) | 14701 | (if inactive (setq fmt (concat "[" (substring fmt 1 -1) "]"))) |
| 14500 | (insert-before-markers (or pre "")) | 14702 | (insert-before-markers (or pre "")) |
| 14501 | (insert-before-markers (setq stamp (format-time-string fmt time))) | ||
| 14502 | (when (listp extra) | 14703 | (when (listp extra) |
| 14503 | (setq extra (car extra)) | 14704 | (setq extra (car extra)) |
| 14504 | (if (and (stringp extra) | 14705 | (if (and (stringp extra) |
| @@ -14508,9 +14709,8 @@ The command returns the inserted time stamp." | |||
| 14508 | (string-to-number (match-string 2 extra)))) | 14709 | (string-to-number (match-string 2 extra)))) |
| 14509 | (setq extra nil))) | 14710 | (setq extra nil))) |
| 14510 | (when extra | 14711 | (when extra |
| 14511 | (backward-char 1) | 14712 | (setq fmt (concat (substring fmt 0 -1) extra (substring fmt -1)))) |
| 14512 | (insert-before-markers extra) | 14713 | (insert-before-markers (setq stamp (format-time-string fmt time))) |
| 14513 | (forward-char 1)) | ||
| 14514 | (insert-before-markers (or post "")) | 14714 | (insert-before-markers (or post "")) |
| 14515 | (setq org-last-inserted-timestamp stamp))) | 14715 | (setq org-last-inserted-timestamp stamp))) |
| 14516 | 14716 | ||
| @@ -14827,7 +15027,10 @@ D may be an absolute day number, or a calendar-type list (month day year)." | |||
| 14827 | (sleep-for 2)))))) | 15027 | (sleep-for 2)))))) |
| 14828 | (cond ((stringp result) result) | 15028 | (cond ((stringp result) result) |
| 14829 | ((and (consp result) | 15029 | ((and (consp result) |
| 15030 | (not (consp (cdr result))) | ||
| 14830 | (stringp (cdr result))) (cdr result)) | 15031 | (stringp (cdr result))) (cdr result)) |
| 15032 | ((and (consp result) | ||
| 15033 | (stringp (car result))) result) | ||
| 14831 | (result entry) | 15034 | (result entry) |
| 14832 | (t nil)))) | 15035 | (t nil)))) |
| 14833 | 15036 | ||
| @@ -15747,7 +15950,7 @@ The images can be removed again with \\[org-ctrl-c-ctrl-c]." | |||
| 15747 | (concat "ltxpng/" (file-name-sans-extension | 15950 | (concat "ltxpng/" (file-name-sans-extension |
| 15748 | (file-name-nondirectory | 15951 | (file-name-nondirectory |
| 15749 | buffer-file-name))) | 15952 | buffer-file-name))) |
| 15750 | default-directory 'overlays msg at 'forbuffer) | 15953 | default-directory 'overlays msg at 'forbuffer 'dvipng) |
| 15751 | (message msg "done. Use `C-c C-c' to remove images."))))) | 15954 | (message msg "done. Use `C-c C-c' to remove images."))))) |
| 15752 | 15955 | ||
| 15753 | (defvar org-latex-regexps | 15956 | (defvar org-latex-regexps |
| @@ -15761,8 +15964,9 @@ The images can be removed again with \\[org-ctrl-c-ctrl-c]." | |||
| 15761 | ("$$" "\\$\\$[^\000]*?\\$\\$" 0 nil)) | 15964 | ("$$" "\\$\\$[^\000]*?\\$\\$" 0 nil)) |
| 15762 | "Regular expressions for matching embedded LaTeX.") | 15965 | "Regular expressions for matching embedded LaTeX.") |
| 15763 | 15966 | ||
| 15967 | (defvar org-export-have-math nil) ;; dynamic scoping | ||
| 15764 | (defun org-format-latex (prefix &optional dir overlays msg at | 15968 | (defun org-format-latex (prefix &optional dir overlays msg at |
| 15765 | forbuffer protect-only) | 15969 | forbuffer processing-type) |
| 15766 | "Replace LaTeX fragments with links to an image, and produce images. | 15970 | "Replace LaTeX fragments with links to an image, and produce images. |
| 15767 | Some of the options can be changed using the variable | 15971 | Some of the options can be changed using the variable |
| 15768 | `org-format-latex-options'." | 15972 | `org-format-latex-options'." |
| @@ -15776,7 +15980,7 @@ Some of the options can be changed using the variable | |||
| 15776 | (org-format-latex-header-extra | 15980 | (org-format-latex-header-extra |
| 15777 | (plist-get (org-infile-export-plist) :latex-header-extra)) | 15981 | (plist-get (org-infile-export-plist) :latex-header-extra)) |
| 15778 | (cnt 0) txt hash link beg end re e checkdir | 15982 | (cnt 0) txt hash link beg end re e checkdir |
| 15779 | executables-checked | 15983 | executables-checked string |
| 15780 | m n block linkfile movefile ov) | 15984 | m n block linkfile movefile ov) |
| 15781 | ;; Check the different regular expressions | 15985 | ;; Check the different regular expressions |
| 15782 | (while (setq e (pop re-list)) | 15986 | (while (setq e (pop re-list)) |
| @@ -15792,9 +15996,26 @@ Some of the options can be changed using the variable | |||
| 15792 | (not (eq (get-char-property (match-beginning n) | 15996 | (not (eq (get-char-property (match-beginning n) |
| 15793 | 'org-overlay-type) | 15997 | 'org-overlay-type) |
| 15794 | 'org-latex-overlay)))) | 15998 | 'org-latex-overlay)))) |
| 15795 | (if protect-only | 15999 | (setq org-export-have-math t) |
| 16000 | (cond | ||
| 16001 | ((eq processing-type 'verbatim) | ||
| 16002 | ;; Leave the text verbatim, just protect it | ||
| 16003 | (add-text-properties (match-beginning n) (match-end n) | ||
| 16004 | '(org-protected t))) | ||
| 16005 | ((eq processing-type 'mathjax) | ||
| 16006 | ;; Prepare for MathJax processing | ||
| 16007 | (setq string (match-string n)) | ||
| 16008 | (if (member m '("$" "$1")) | ||
| 16009 | (save-excursion | ||
| 16010 | (delete-region (match-beginning n) (match-end n)) | ||
| 16011 | (goto-char (match-beginning n)) | ||
| 16012 | (insert (org-add-props (concat "\\(" (substring string 1 -1) | ||
| 16013 | "\\)") | ||
| 16014 | '(org-protected t)))) | ||
| 15796 | (add-text-properties (match-beginning n) (match-end n) | 16015 | (add-text-properties (match-beginning n) (match-end n) |
| 15797 | '(org-protected t)) | 16016 | '(org-protected t)))) |
| 16017 | ((or (eq processing-type 'dvipng) t) | ||
| 16018 | ;; Process to an image | ||
| 15798 | (setq txt (match-string n) | 16019 | (setq txt (match-string n) |
| 15799 | beg (match-beginning n) end (match-end n) | 16020 | beg (match-beginning n) end (match-end n) |
| 15800 | cnt (1+ cnt)) | 16021 | cnt (1+ cnt)) |
| @@ -15813,15 +16034,15 @@ Some of the options can be changed using the variable | |||
| 15813 | (goto-char beg) | 16034 | (goto-char beg) |
| 15814 | (unless checkdir ; make sure the directory exists | 16035 | (unless checkdir ; make sure the directory exists |
| 15815 | (setq checkdir t) | 16036 | (setq checkdir t) |
| 15816 | (or (file-directory-p todir) (make-directory todir))) | 16037 | (or (file-directory-p todir) (make-directory todir t))) |
| 15817 | 16038 | ||
| 15818 | (unless executables-checked | 16039 | (unless executables-checked |
| 15819 | (org-check-external-command | 16040 | (org-check-external-command |
| 15820 | "latex" "needed to convert LaTeX fragments to images") | 16041 | "latex" "needed to convert LaTeX fragments to images") |
| 15821 | (org-check-external-command | 16042 | (org-check-external-command |
| 15822 | "dvipng" "needed to convert LaTeX fragments to images") | 16043 | "dvipng" "needed to convert LaTeX fragments to images") |
| 15823 | (setq executables-checked t)) | 16044 | (setq executables-checked t)) |
| 15824 | 16045 | ||
| 15825 | (unless (file-exists-p movefile) | 16046 | (unless (file-exists-p movefile) |
| 15826 | (org-create-formula-image | 16047 | (org-create-formula-image |
| 15827 | txt movefile opt forbuffer)) | 16048 | txt movefile opt forbuffer)) |
| @@ -15848,7 +16069,8 @@ Some of the options can be changed using the variable | |||
| 15848 | (delete-region beg end) | 16069 | (delete-region beg end) |
| 15849 | (insert (org-add-props link | 16070 | (insert (org-add-props link |
| 15850 | (list 'org-latex-src | 16071 | (list 'org-latex-src |
| 15851 | (replace-regexp-in-string "\"" "" txt)))))))))))) | 16072 | (replace-regexp-in-string |
| 16073 | "\"" "" txt))))))))))))) | ||
| 15852 | 16074 | ||
| 15853 | ;; This function borrows from Ganesh Swami's latex2png.el | 16075 | ;; This function borrows from Ganesh Swami's latex2png.el |
| 15854 | (defun org-create-formula-image (string tofile options buffer) | 16076 | (defun org-create-formula-image (string tofile options buffer) |
| @@ -16019,7 +16241,7 @@ BEG and END default to the buffer boundaries." | |||
| 16019 | (widen) | 16241 | (widen) |
| 16020 | (setq beg (or beg (point-min)) end (or end (point-max))) | 16242 | (setq beg (or beg (point-min)) end (or end (point-max))) |
| 16021 | (goto-char (point-min)) | 16243 | (goto-char (point-min)) |
| 16022 | (let ((re (concat "\\[\\[\\(\\(file:\\)\\|\\([./~]\\)\\)\\([-+~.:/\\_0-9a-zA-Z ]+" | 16244 | (let ((re (concat "\\[\\[\\(\\(file:\\)\\|\\([./~]\\)\\)\\([^]\n]+?" |
| 16023 | (substring (org-image-file-name-regexp) 0 -2) | 16245 | (substring (org-image-file-name-regexp) 0 -2) |
| 16024 | "\\)\\]" (if include-linked "" "\\]"))) | 16246 | "\\)\\]" (if include-linked "" "\\]"))) |
| 16025 | old file ov img) | 16247 | old file ov img) |
| @@ -16031,7 +16253,7 @@ BEG and END default to the buffer boundaries." | |||
| 16031 | (when (file-exists-p file) | 16253 | (when (file-exists-p file) |
| 16032 | (if (and (car-safe old) refresh) | 16254 | (if (and (car-safe old) refresh) |
| 16033 | (image-refresh (overlay-get (cdr old) 'display)) | 16255 | (image-refresh (overlay-get (cdr old) 'display)) |
| 16034 | (setq img (create-image file)) | 16256 | (setq img (save-match-data (create-image file))) |
| 16035 | (when img | 16257 | (when img |
| 16036 | (setq ov (make-overlay (match-beginning 0) (match-end 0))) | 16258 | (setq ov (make-overlay (match-beginning 0) (match-end 0))) |
| 16037 | (overlay-put ov 'display img) | 16259 | (overlay-put ov 'display img) |
| @@ -16236,10 +16458,12 @@ BEG and END default to the buffer boundaries." | |||
| 16236 | (org-defkey org-mode-map "\C-c\C-xo" 'org-toggle-ordered-property) | 16458 | (org-defkey org-mode-map "\C-c\C-xo" 'org-toggle-ordered-property) |
| 16237 | (org-defkey org-mode-map "\C-c\C-xi" 'org-insert-columns-dblock) | 16459 | (org-defkey org-mode-map "\C-c\C-xi" 'org-insert-columns-dblock) |
| 16238 | (org-defkey org-mode-map [(control ?c) (control ?x) ?\;] 'org-timer-set-timer) | 16460 | (org-defkey org-mode-map [(control ?c) (control ?x) ?\;] 'org-timer-set-timer) |
| 16461 | (org-defkey org-mode-map [(control ?c) (control ?x) ?\:] 'org-timer-cancel-timer) | ||
| 16239 | 16462 | ||
| 16240 | (org-defkey org-mode-map "\C-c\C-x." 'org-timer) | 16463 | (org-defkey org-mode-map "\C-c\C-x." 'org-timer) |
| 16241 | (org-defkey org-mode-map "\C-c\C-x-" 'org-timer-item) | 16464 | (org-defkey org-mode-map "\C-c\C-x-" 'org-timer-item) |
| 16242 | (org-defkey org-mode-map "\C-c\C-x0" 'org-timer-start) | 16465 | (org-defkey org-mode-map "\C-c\C-x0" 'org-timer-start) |
| 16466 | (org-defkey org-mode-map "\C-c\C-x_" 'org-timer-stop) | ||
| 16243 | (org-defkey org-mode-map "\C-c\C-x," 'org-timer-pause-or-continue) | 16467 | (org-defkey org-mode-map "\C-c\C-x," 'org-timer-pause-or-continue) |
| 16244 | 16468 | ||
| 16245 | (define-key org-mode-map "\C-c\C-x\C-c" 'org-columns) | 16469 | (define-key org-mode-map "\C-c\C-x\C-c" 'org-columns) |
| @@ -16300,6 +16524,8 @@ BEG and END default to the buffer boundaries." | |||
| 16300 | ("Misc") | 16524 | ("Misc") |
| 16301 | ("o" . org-open-at-point) | 16525 | ("o" . org-open-at-point) |
| 16302 | ("?" . org-speed-command-help) | 16526 | ("?" . org-speed-command-help) |
| 16527 | ("<" . (org-agenda-set-restriction-lock 'subtree)) | ||
| 16528 | (">" . (org-agenda-remove-restriction-lock)) | ||
| 16303 | ) | 16529 | ) |
| 16304 | "The default speed commands.") | 16530 | "The default speed commands.") |
| 16305 | 16531 | ||
| @@ -16346,6 +16572,40 @@ If not, return to the original position and throw an error." | |||
| 16346 | 16572 | ||
| 16347 | (defvar org-table-auto-blank-field) ; defined in org-table.el | 16573 | (defvar org-table-auto-blank-field) ; defined in org-table.el |
| 16348 | (defvar org-speed-command nil) | 16574 | (defvar org-speed-command nil) |
| 16575 | |||
| 16576 | (defun org-speed-command-default-hook (keys) | ||
| 16577 | "Hook for activating single-letter speed commands. | ||
| 16578 | `org-speed-commands-default' specifies a minimal command set. Use | ||
| 16579 | `org-speed-commands-user' for further customization." | ||
| 16580 | (when (or (and (bolp) (looking-at outline-regexp)) | ||
| 16581 | (and (functionp org-use-speed-commands) | ||
| 16582 | (funcall org-use-speed-commands))) | ||
| 16583 | (cdr (assoc keys (append org-speed-commands-user | ||
| 16584 | org-speed-commands-default))))) | ||
| 16585 | |||
| 16586 | (defun org-babel-speed-command-hook (keys) | ||
| 16587 | "Hook for activating single-letter code block commands." | ||
| 16588 | (when (and (bolp) (looking-at org-babel-src-block-regexp)) | ||
| 16589 | (cdr (assoc keys org-babel-key-bindings)))) | ||
| 16590 | |||
| 16591 | (defcustom org-speed-command-hook | ||
| 16592 | '(org-speed-command-default-hook org-babel-speed-command-hook) | ||
| 16593 | "Hook for activating speed commands at strategic locations. | ||
| 16594 | Hook functions are called in sequence until a valid handler is | ||
| 16595 | found. | ||
| 16596 | |||
| 16597 | Each hook takes a single argument, a user-pressed command key | ||
| 16598 | which is also a `self-insert-command' from the global map. | ||
| 16599 | |||
| 16600 | Within the hook, examine the cursor position and the command key | ||
| 16601 | and return nil or a valid handler as appropriate. Handler could | ||
| 16602 | be one of an interactive command, a function, or a form. | ||
| 16603 | |||
| 16604 | Set `org-use-speed-commands' to non-nil value to enable this | ||
| 16605 | hook. The default setting is `org-speed-command-default-hook'." | ||
| 16606 | :group 'org-structure | ||
| 16607 | :type 'hook) | ||
| 16608 | |||
| 16349 | (defun org-self-insert-command (N) | 16609 | (defun org-self-insert-command (N) |
| 16350 | "Like `self-insert-command', use overwrite-mode for whitespace in tables. | 16610 | "Like `self-insert-command', use overwrite-mode for whitespace in tables. |
| 16351 | If the cursor is in a table looking at whitespace, the whitespace is | 16611 | If the cursor is in a table looking at whitespace, the whitespace is |
| @@ -16353,13 +16613,9 @@ overwritten, and the table is not marked as requiring realignment." | |||
| 16353 | (interactive "p") | 16613 | (interactive "p") |
| 16354 | (cond | 16614 | (cond |
| 16355 | ((and org-use-speed-commands | 16615 | ((and org-use-speed-commands |
| 16356 | (or (and (bolp) (looking-at outline-regexp)) | 16616 | (setq org-speed-command |
| 16357 | (and (functionp org-use-speed-commands) | 16617 | (run-hook-with-args-until-success |
| 16358 | (funcall org-use-speed-commands))) | 16618 | 'org-speed-command-hook (this-command-keys)))) |
| 16359 | (setq | ||
| 16360 | org-speed-command | ||
| 16361 | (or (cdr (assoc (this-command-keys) org-speed-commands-user)) | ||
| 16362 | (cdr (assoc (this-command-keys) org-speed-commands-default))))) | ||
| 16363 | (cond | 16619 | (cond |
| 16364 | ((commandp org-speed-command) | 16620 | ((commandp org-speed-command) |
| 16365 | (setq this-command org-speed-command) | 16621 | (setq this-command org-speed-command) |
| @@ -16426,9 +16682,11 @@ because, in this case the deletion might narrow the column." | |||
| 16426 | (noalign (looking-at "[^|\n\r]* |")) | 16682 | (noalign (looking-at "[^|\n\r]* |")) |
| 16427 | (c org-table-may-need-update)) | 16683 | (c org-table-may-need-update)) |
| 16428 | (backward-delete-char N) | 16684 | (backward-delete-char N) |
| 16429 | (skip-chars-forward "^|") | 16685 | (if (not overwrite-mode) |
| 16430 | (insert " ") | 16686 | (progn |
| 16431 | (goto-char (1- pos)) | 16687 | (skip-chars-forward "^|") |
| 16688 | (insert " ") | ||
| 16689 | (goto-char (1- pos)))) | ||
| 16432 | ;; noalign: if there were two spaces at the end, this field | 16690 | ;; noalign: if there were two spaces at the end, this field |
| 16433 | ;; does not determine the width of the column. | 16691 | ;; does not determine the width of the column. |
| 16434 | (if noalign (setq org-table-may-need-update c))) | 16692 | (if noalign (setq org-table-may-need-update c))) |
| @@ -17022,13 +17280,10 @@ This command does many different things, depending on context: | |||
| 17022 | 17280 | ||
| 17023 | - If the cursor is a the beginning of a dynamic block, update it. | 17281 | - If the cursor is a the beginning of a dynamic block, update it. |
| 17024 | 17282 | ||
| 17025 | - If the current buffer is a remember buffer, close note and file | 17283 | - If the current buffer is a capture buffer, close note and file it. |
| 17026 | it. A prefix argument of 1 files to the default location | ||
| 17027 | without further interaction. A prefix argument of 2 files to | ||
| 17028 | the currently clocking task. | ||
| 17029 | 17284 | ||
| 17030 | - If the cursor is on a <<<target>>>, update radio targets and corresponding | 17285 | - If the cursor is on a <<<target>>>, update radio targets and |
| 17031 | links in this buffer. | 17286 | corresponding links in this buffer. |
| 17032 | 17287 | ||
| 17033 | - If the cursor is on a numbered item in a plain list, renumber the | 17288 | - If the cursor is on a numbered item in a plain list, renumber the |
| 17034 | ordered list. | 17289 | ordered list. |
| @@ -17074,12 +17329,12 @@ This command does many different things, depending on context: | |||
| 17074 | (org-footnote-at-definition-p)) | 17329 | (org-footnote-at-definition-p)) |
| 17075 | (call-interactively 'org-footnote-action)) | 17330 | (call-interactively 'org-footnote-action)) |
| 17076 | ((org-at-item-checkbox-p) | 17331 | ((org-at-item-checkbox-p) |
| 17332 | (call-interactively 'org-list-repair) | ||
| 17077 | (call-interactively 'org-toggle-checkbox) | 17333 | (call-interactively 'org-toggle-checkbox) |
| 17078 | (org-list-send-list 'maybe)) | 17334 | (org-list-send-list 'maybe)) |
| 17079 | ((org-at-item-p) | 17335 | ((org-at-item-p) |
| 17080 | (if arg | 17336 | (call-interactively 'org-list-repair) |
| 17081 | (call-interactively 'org-toggle-checkbox) | 17337 | (when arg (call-interactively 'org-toggle-checkbox)) |
| 17082 | (call-interactively 'org-maybe-renumber-ordered-list)) | ||
| 17083 | (org-list-send-list 'maybe)) | 17338 | (org-list-send-list 'maybe)) |
| 17084 | ((save-excursion (beginning-of-line 1) (looking-at org-dblock-start-re)) | 17339 | ((save-excursion (beginning-of-line 1) (looking-at org-dblock-start-re)) |
| 17085 | ;; Dynamic block | 17340 | ;; Dynamic block |
| @@ -17136,7 +17391,7 @@ See the individual commands for more information." | |||
| 17136 | (call-interactively 'org-open-at-point)) | 17391 | (call-interactively 'org-open-at-point)) |
| 17137 | ((and (org-at-heading-p) | 17392 | ((and (org-at-heading-p) |
| 17138 | (looking-at | 17393 | (looking-at |
| 17139 | (org-re "\\([ \t]+\\(:[[:alnum:]_@:]+:\\)\\)[ \t]*$"))) | 17394 | (org-re "\\([ \t]+\\(:[[:alnum:]_@#%:]+:\\)\\)[ \t]*$"))) |
| 17140 | (org-show-entry) | 17395 | (org-show-entry) |
| 17141 | (end-of-line 1) | 17396 | (end-of-line 1) |
| 17142 | (newline)) | 17397 | (newline)) |
| @@ -17202,21 +17457,21 @@ If the first line is normal text, add an item bullet to each line." | |||
| 17202 | ;; We already have items, de-itemize | 17457 | ;; We already have items, de-itemize |
| 17203 | (while (< (setq l (1+ l)) l2) | 17458 | (while (< (setq l (1+ l)) l2) |
| 17204 | (when (org-at-item-p) | 17459 | (when (org-at-item-p) |
| 17205 | (goto-char (match-beginning 2)) | 17460 | (skip-chars-forward " \t") |
| 17206 | (delete-region (match-beginning 2) (match-end 2)) | 17461 | (delete-region (point) (match-end 0))) |
| 17207 | (and (looking-at "[ \t]+") (replace-match ""))) | ||
| 17208 | (beginning-of-line 2)) | 17462 | (beginning-of-line 2)) |
| 17209 | (if (org-on-heading-p) | 17463 | (if (org-on-heading-p) |
| 17210 | ;; Headings, convert to items | 17464 | ;; Headings, convert to items |
| 17211 | (while (< (setq l (1+ l)) l2) | 17465 | (while (< (setq l (1+ l)) l2) |
| 17212 | (if (looking-at org-outline-regexp) | 17466 | (if (looking-at org-outline-regexp) |
| 17213 | (replace-match "- " t t)) | 17467 | (replace-match (org-list-bullet-string "-") t t)) |
| 17214 | (beginning-of-line 2)) | 17468 | (beginning-of-line 2)) |
| 17215 | ;; normal lines, turn them into items | 17469 | ;; normal lines, turn them into items |
| 17216 | (while (< (setq l (1+ l)) l2) | 17470 | (while (< (setq l (1+ l)) l2) |
| 17217 | (unless (org-at-item-p) | 17471 | (unless (org-at-item-p) |
| 17218 | (if (looking-at "\\([ \t]*\\)\\(\\S-\\)") | 17472 | (if (looking-at "\\([ \t]*\\)\\(\\S-\\)") |
| 17219 | (replace-match "\\1- \\2"))) | 17473 | (replace-match |
| 17474 | (concat "\\1" (org-list-bullet-string "-") "\\2")))) | ||
| 17220 | (beginning-of-line 2))))))) | 17475 | (beginning-of-line 2))))))) |
| 17221 | 17476 | ||
| 17222 | (defun org-toggle-heading (&optional nstars) | 17477 | (defun org-toggle-heading (&optional nstars) |
| @@ -17518,14 +17773,6 @@ See the individual commands for more information." | |||
| 17518 | (org-inside-LaTeX-fragment-p)] | 17773 | (org-inside-LaTeX-fragment-p)] |
| 17519 | ["Insert citation" org-reftex-citation t] | 17774 | ["Insert citation" org-reftex-citation t] |
| 17520 | "--" | 17775 | "--" |
| 17521 | ["Export LaTeX fragments as images" | ||
| 17522 | (if (featurep 'org-exp) | ||
| 17523 | (setq org-export-with-LaTeX-fragments | ||
| 17524 | (not org-export-with-LaTeX-fragments)) | ||
| 17525 | (require 'org-exp)) | ||
| 17526 | :style toggle :selected (and (boundp 'org-export-with-LaTeX-fragments) | ||
| 17527 | org-export-with-LaTeX-fragments)] | ||
| 17528 | "--" | ||
| 17529 | ["Template for BEAMER" org-insert-beamer-options-template t]) | 17776 | ["Template for BEAMER" org-insert-beamer-options-template t]) |
| 17530 | "--" | 17777 | "--" |
| 17531 | ("MobileOrg" | 17778 | ("MobileOrg" |
| @@ -18107,16 +18354,23 @@ really on, so that the block visually is on the match." | |||
| 18107 | (throw 'exit t))) | 18354 | (throw 'exit t))) |
| 18108 | nil)))) | 18355 | nil)))) |
| 18109 | 18356 | ||
| 18110 | (defun org-in-regexps-block-p (start-re end-re) | 18357 | (defun org-in-regexps-block-p (start-re end-re &optional bound) |
| 18111 | "Return t if the current point is between matches of START-RE and END-RE. | 18358 | "Return t if the current point is between matches of START-RE and END-RE. |
| 18112 | This will also return to if point is on one of the two matches." | 18359 | This will also return t if point is on one of the two matches or |
| 18113 | (interactive) | 18360 | in an unfinished block. END-RE can be a string or a form |
| 18114 | (let ((p (point))) | 18361 | returning a string. |
| 18362 | |||
| 18363 | An optional third argument bounds the search for START-RE. It | ||
| 18364 | defaults to previous heading or `point-min'." | ||
| 18365 | (let ((pos (point)) | ||
| 18366 | (limit (or bound (save-excursion (outline-previous-heading))))) | ||
| 18115 | (save-excursion | 18367 | (save-excursion |
| 18116 | (and (or (org-at-regexp-p start-re) | 18368 | ;; we're on a block when point is on start-re... |
| 18117 | (re-search-backward start-re nil t)) | 18369 | (or (org-at-regexp-p start-re) |
| 18118 | (re-search-forward end-re nil t) | 18370 | ;; ... or start-re can be found above... |
| 18119 | (>= (point) p))))) | 18371 | (and (re-search-backward start-re limit t) |
| 18372 | ;; ... but no end-re between start-re and point. | ||
| 18373 | (not (re-search-forward (eval end-re) pos t))))))) | ||
| 18120 | 18374 | ||
| 18121 | (defun org-occur-in-agenda-files (regexp &optional nlines) | 18375 | (defun org-occur-in-agenda-files (regexp &optional nlines) |
| 18122 | "Call `multi-occur' with buffers for all agenda files." | 18376 | "Call `multi-occur' with buffers for all agenda files." |
| @@ -18392,61 +18646,90 @@ which make use of the date at the cursor." | |||
| 18392 | (itemp (org-at-item-p)) | 18646 | (itemp (org-at-item-p)) |
| 18393 | (case-fold-search t) | 18647 | (case-fold-search t) |
| 18394 | (org-drawer-regexp (or org-drawer-regexp "\000")) | 18648 | (org-drawer-regexp (or org-drawer-regexp "\000")) |
| 18649 | (inline-task-p (and (featurep 'org-inlinetask) | ||
| 18650 | (org-inlinetask-in-task-p))) | ||
| 18395 | column bpos bcol tpos tcol bullet btype bullet-type) | 18651 | column bpos bcol tpos tcol bullet btype bullet-type) |
| 18396 | ;; Find the previous relevant line | 18652 | ;; Find the previous relevant line |
| 18397 | (beginning-of-line 1) | 18653 | (beginning-of-line 1) |
| 18398 | (cond | 18654 | (cond |
| 18655 | ;; Comments | ||
| 18399 | ((looking-at "#") (setq column 0)) | 18656 | ((looking-at "#") (setq column 0)) |
| 18657 | ;; Headings | ||
| 18400 | ((looking-at "\\*+ ") (setq column 0)) | 18658 | ((looking-at "\\*+ ") (setq column 0)) |
| 18659 | ;; Drawers | ||
| 18401 | ((and (looking-at "[ \t]*:END:") | 18660 | ((and (looking-at "[ \t]*:END:") |
| 18402 | (save-excursion (re-search-backward org-drawer-regexp nil t))) | 18661 | (save-excursion (re-search-backward org-drawer-regexp nil t))) |
| 18403 | (save-excursion | 18662 | (save-excursion |
| 18404 | (goto-char (1- (match-beginning 1))) | 18663 | (goto-char (1- (match-beginning 1))) |
| 18405 | (setq column (current-column)))) | 18664 | (setq column (current-column)))) |
| 18406 | ((and (looking-at "[ \t]+#\\+end_\\([a-z]+\\)") | 18665 | ;; Special blocks |
| 18666 | ((and (looking-at "[ \t]*#\\+end_\\([a-z]+\\)") | ||
| 18407 | (save-excursion | 18667 | (save-excursion |
| 18408 | (re-search-backward | 18668 | (re-search-backward |
| 18409 | (concat "^[ \t]*#\\+begin_" (downcase (match-string 1))) nil t))) | 18669 | (concat "^[ \t]*#\\+begin_" (downcase (match-string 1))) nil t))) |
| 18410 | (setq column (org-get-indentation (match-string 0)))) | 18670 | (setq column (org-get-indentation (match-string 0)))) |
| 18671 | ((and (not (looking-at "[ \t]*#\\+begin_")) | ||
| 18672 | (org-in-regexps-block-p "^[ \t]*#\\+begin_" "[ \t]*#\\+end_")) | ||
| 18673 | (save-excursion | ||
| 18674 | (re-search-backward "^[ \t]*#\\+begin_\\([a-z]+\\)" nil t)) | ||
| 18675 | (setq column | ||
| 18676 | (if (equal (downcase (match-string 1)) "src") | ||
| 18677 | ;; src blocks: let `org-edit-src-exit' handle them | ||
| 18678 | (org-get-indentation) | ||
| 18679 | (org-get-indentation (match-string 0))))) | ||
| 18680 | ;; Lists | ||
| 18681 | ((org-in-item-p) | ||
| 18682 | (org-beginning-of-item) | ||
| 18683 | (looking-at "[ \t]*\\(\\S-+\\)[ \t]*\\(\\(:?\\[@\\(:?start:\\)?[0-9]+\\][ \t]*\\)?\\[[- X]\\][ \t]*\\|.*? :: \\)?") | ||
| 18684 | (setq bpos (match-beginning 1) tpos (match-end 0) | ||
| 18685 | bcol (progn (goto-char bpos) (current-column)) | ||
| 18686 | tcol (progn (goto-char tpos) (current-column)) | ||
| 18687 | bullet (match-string 1) | ||
| 18688 | bullet-type (if (string-match "[0-9]" bullet) "n" bullet)) | ||
| 18689 | (if (> tcol (+ bcol org-description-max-indent)) | ||
| 18690 | (setq tcol (+ bcol 5))) | ||
| 18691 | (if (not itemp) | ||
| 18692 | (setq column tcol) | ||
| 18693 | (beginning-of-line 1) | ||
| 18694 | (goto-char pos) | ||
| 18695 | (if (looking-at "\\S-") | ||
| 18696 | (progn | ||
| 18697 | (looking-at "[ \t]*\\(\\S-+\\)[ \t]*") | ||
| 18698 | (setq bullet (match-string 1) | ||
| 18699 | btype (if (string-match "[0-9]" bullet) "n" bullet)) | ||
| 18700 | (setq column (if (equal btype bullet-type) bcol tcol))) | ||
| 18701 | (setq column (org-get-indentation))))) | ||
| 18702 | ;; This line has nothing special, look upside to get a clue about | ||
| 18703 | ;; what to do. | ||
| 18411 | (t | 18704 | (t |
| 18412 | (beginning-of-line 0) | 18705 | (beginning-of-line 0) |
| 18413 | (while (and (not (bobp)) (looking-at "[ \t]*[\n:#|]") | 18706 | (while (and (not (bobp)) |
| 18414 | (not (looking-at "[ \t]*:END:")) | 18707 | ;; skip comments, verbatim, empty lines, tables, |
| 18415 | (not (looking-at org-drawer-regexp))) | 18708 | ;; inline tasks |
| 18416 | (beginning-of-line 0)) | 18709 | (or (looking-at "[ \t]*[\n:#|]") |
| 18710 | (and (org-in-item-p) (goto-char (org-list-top-point))) | ||
| 18711 | (and (not inline-task-p) | ||
| 18712 | (featurep 'org-inlinetask) | ||
| 18713 | (org-inlinetask-in-task-p))) | ||
| 18714 | (not (looking-at "[ \t]*:END:")) | ||
| 18715 | (not (looking-at org-drawer-regexp))) | ||
| 18716 | (beginning-of-line 0)) | ||
| 18417 | (cond | 18717 | (cond |
| 18718 | ;; There was an heading above. | ||
| 18418 | ((looking-at "\\*+[ \t]+") | 18719 | ((looking-at "\\*+[ \t]+") |
| 18419 | (if (not org-adapt-indentation) | 18720 | (if (not org-adapt-indentation) |
| 18420 | (setq column 0) | 18721 | (setq column 0) |
| 18421 | (goto-char (match-end 0)) | 18722 | (goto-char (match-end 0)) |
| 18422 | (setq column (current-column)))) | 18723 | (setq column (current-column)))) |
| 18724 | ;; A drawer had started and is unfinished: indent consequently. | ||
| 18423 | ((looking-at org-drawer-regexp) | 18725 | ((looking-at org-drawer-regexp) |
| 18424 | (goto-char (1- (match-beginning 1))) | 18726 | (goto-char (1- (match-beginning 1))) |
| 18425 | (setq column (current-column))) | 18727 | (setq column (current-column))) |
| 18728 | ;; The drawer had ended: indent like its :END: line. | ||
| 18426 | ((looking-at "\\([ \t]*\\):END:") | 18729 | ((looking-at "\\([ \t]*\\):END:") |
| 18427 | (goto-char (match-end 1)) | 18730 | (goto-char (match-end 1)) |
| 18428 | (setq column (current-column))) | 18731 | (setq column (current-column))) |
| 18429 | ((org-in-item-p) | 18732 | ;; Else, nothing noticeable found: get indentation and go on. |
| 18430 | (org-beginning-of-item) | ||
| 18431 | (looking-at "[ \t]*\\(\\S-+\\)[ \t]*\\(\\[[- X]\\][ \t]*\\|.*? :: \\)?") | ||
| 18432 | (setq bpos (match-beginning 1) tpos (match-end 0) | ||
| 18433 | bcol (progn (goto-char bpos) (current-column)) | ||
| 18434 | tcol (progn (goto-char tpos) (current-column)) | ||
| 18435 | bullet (match-string 1) | ||
| 18436 | bullet-type (if (string-match "[0-9]" bullet) "n" bullet)) | ||
| 18437 | (if (> tcol (+ bcol org-description-max-indent)) | ||
| 18438 | (setq tcol (+ bcol 5))) | ||
| 18439 | (if (not itemp) | ||
| 18440 | (setq column tcol) | ||
| 18441 | (goto-char pos) | ||
| 18442 | (beginning-of-line 1) | ||
| 18443 | (if (looking-at "\\S-") | ||
| 18444 | (progn | ||
| 18445 | (looking-at "[ \t]*\\(\\S-+\\)[ \t]*") | ||
| 18446 | (setq bullet (match-string 1) | ||
| 18447 | btype (if (string-match "[0-9]" bullet) "n" bullet)) | ||
| 18448 | (setq column (if (equal btype bullet-type) bcol tcol))) | ||
| 18449 | (setq column (org-get-indentation))))) | ||
| 18450 | (t (setq column (org-get-indentation)))))) | 18733 | (t (setq column (org-get-indentation)))))) |
| 18451 | (goto-char pos) | 18734 | (goto-char pos) |
| 18452 | (if (<= (current-column) (current-indentation)) | 18735 | (if (<= (current-column) (current-indentation)) |
| @@ -18705,7 +18988,7 @@ beyond the end of the headline." | |||
| 18705 | (t 'end-of-line))) | 18988 | (t 'end-of-line))) |
| 18706 | (let ((pos (point))) | 18989 | (let ((pos (point))) |
| 18707 | (beginning-of-line 1) | 18990 | (beginning-of-line 1) |
| 18708 | (if (looking-at (org-re ".*?\\(?:\\([ \t]*\\)\\(:[[:alnum:]_@:]+:\\)?[ \t]*\\)?$")) | 18991 | (if (looking-at (org-re ".*?\\(?:\\([ \t]*\\)\\(:[[:alnum:]_@#%:]+:\\)?[ \t]*\\)?$")) |
| 18709 | (if (eq special t) | 18992 | (if (eq special t) |
| 18710 | (if (or (< pos (match-beginning 1)) | 18993 | (if (or (< pos (match-beginning 1)) |
| 18711 | (= pos (match-end 0))) | 18994 | (= pos (match-end 0))) |
| @@ -18759,7 +19042,7 @@ depending on context." | |||
| 18759 | (not (y-or-n-p "Kill hidden subtree along with headline? "))) | 19042 | (not (y-or-n-p "Kill hidden subtree along with headline? "))) |
| 18760 | (error "C-k aborted - would kill hidden subtree"))) | 19043 | (error "C-k aborted - would kill hidden subtree"))) |
| 18761 | (call-interactively 'kill-line)) | 19044 | (call-interactively 'kill-line)) |
| 18762 | ((looking-at (org-re ".*?\\S-\\([ \t]+\\(:[[:alnum:]_@:]+:\\)\\)[ \t]*$")) | 19045 | ((looking-at (org-re ".*?\\S-\\([ \t]+\\(:[[:alnum:]_@#%:]+:\\)\\)[ \t]*$")) |
| 18763 | (kill-region (point) (match-beginning 1)) | 19046 | (kill-region (point) (match-beginning 1)) |
| 18764 | (org-set-tags nil t)) | 19047 | (org-set-tags nil t)) |
| 18765 | (t (kill-region (point) (point-at-eol))))) | 19048 | (t (kill-region (point) (point-at-eol))))) |
| @@ -19003,6 +19286,18 @@ move point." | |||
| 19003 | (while (org-goto-sibling 'previous) | 19286 | (while (org-goto-sibling 'previous) |
| 19004 | (org-flag-heading nil)))) | 19287 | (org-flag-heading nil)))) |
| 19005 | 19288 | ||
| 19289 | (defun org-goto-first-child () | ||
| 19290 | "Goto the first child, even if it is invisible. | ||
| 19291 | Return t when a child was found. Otherwise don't move point and | ||
| 19292 | return nil." | ||
| 19293 | (let (level (pos (point)) (re (concat "^" outline-regexp))) | ||
| 19294 | (when (condition-case nil (org-back-to-heading t) (error nil)) | ||
| 19295 | (setq level (outline-level)) | ||
| 19296 | (forward-char 1) | ||
| 19297 | (if (and (re-search-forward re nil t) (> (outline-level) level)) | ||
| 19298 | (progn (goto-char (match-beginning 0)) t) | ||
| 19299 | (goto-char pos) nil)))) | ||
| 19300 | |||
| 19006 | (defun org-show-hidden-entry () | 19301 | (defun org-show-hidden-entry () |
| 19007 | "Show an entry where even the heading is hidden." | 19302 | "Show an entry where even the heading is hidden." |
| 19008 | (save-excursion | 19303 | (save-excursion |
| @@ -19094,7 +19389,9 @@ If there is no such heading, return nil." | |||
| 19094 | 19389 | ||
| 19095 | (defun org-forward-same-level (arg &optional invisible-ok) | 19390 | (defun org-forward-same-level (arg &optional invisible-ok) |
| 19096 | "Move forward to the arg'th subheading at same level as this one. | 19391 | "Move forward to the arg'th subheading at same level as this one. |
| 19097 | Stop at the first and last subheadings of a superior heading." | 19392 | Stop at the first and last subheadings of a superior heading. |
| 19393 | Normally this only looks at visible headings, but when INVISIBLE-OK is non-nil | ||
| 19394 | it wil also look at invisible ones." | ||
| 19098 | (interactive "p") | 19395 | (interactive "p") |
| 19099 | (org-back-to-heading invisible-ok) | 19396 | (org-back-to-heading invisible-ok) |
| 19100 | (org-on-heading-p) | 19397 | (org-on-heading-p) |
| @@ -19311,8 +19608,8 @@ To get rid of the restriction, use \\[org-agenda-remove-restriction-lock]." | |||
| 19311 | ;; Make flyspell not check words in links, to not mess up our keymap | 19608 | ;; Make flyspell not check words in links, to not mess up our keymap |
| 19312 | (defun org-mode-flyspell-verify () | 19609 | (defun org-mode-flyspell-verify () |
| 19313 | "Don't let flyspell put overlays at active buttons." | 19610 | "Don't let flyspell put overlays at active buttons." |
| 19314 | (and (not (get-text-property (point) 'keymap)) | 19611 | (and (not (get-text-property (max (1- (point)) (point-min)) 'keymap)) |
| 19315 | (not (get-text-property (point) 'org-no-flyspell)))) | 19612 | (not (get-text-property (max (1- (point)) (point-min)) 'org-no-flyspell)))) |
| 19316 | 19613 | ||
| 19317 | (defun org-remove-flyspell-overlays-in (beg end) | 19614 | (defun org-remove-flyspell-overlays-in (beg end) |
| 19318 | "Remove flyspell overlays in region." | 19615 | "Remove flyspell overlays in region." |