diff options
| author | Joakim Verona | 2013-01-10 00:04:21 +0100 |
|---|---|---|
| committer | Joakim Verona | 2013-01-10 00:04:21 +0100 |
| commit | 09708f70bd02e7a2edec79e1bcfd04fb9b7f48d3 (patch) | |
| tree | 9376433d772aa4a302b231af1c601bcb4440c9f1 /lisp/org/org.el | |
| parent | 0f9ee7aa0e6b57e28b31699a912356c24b959b01 (diff) | |
| parent | 51fb5578777d1041feaab31651b65e09e1731d33 (diff) | |
| download | emacs-09708f70bd02e7a2edec79e1bcfd04fb9b7f48d3.tar.gz emacs-09708f70bd02e7a2edec79e1bcfd04fb9b7f48d3.zip | |
auto upstream
Diffstat (limited to 'lisp/org/org.el')
| -rw-r--r-- | lisp/org/org.el | 787 |
1 files changed, 427 insertions, 360 deletions
diff --git a/lisp/org/org.el b/lisp/org/org.el index d4120b4224e..32ed13fc1a3 100644 --- a/lisp/org/org.el +++ b/lisp/org/org.el | |||
| @@ -1219,7 +1219,15 @@ See also the QUOTE keyword." | |||
| 1219 | :type 'boolean) | 1219 | :type 'boolean) |
| 1220 | 1220 | ||
| 1221 | (defcustom org-goto-auto-isearch t | 1221 | (defcustom org-goto-auto-isearch t |
| 1222 | "Non-nil means typing characters in `org-goto' starts incremental search." | 1222 | "Non-nil means typing characters in `org-goto' starts incremental search. |
| 1223 | When nil, you can use these keybindings to navigate the buffer: | ||
| 1224 | |||
| 1225 | q Quit the org-goto interface | ||
| 1226 | n Go to the next visible heading | ||
| 1227 | p Go to the previous visible heading | ||
| 1228 | f Go one heading forward on same level | ||
| 1229 | b Go one heading backward on same level | ||
| 1230 | u Go one heading up" | ||
| 1223 | :group 'org-edit-structure | 1231 | :group 'org-edit-structure |
| 1224 | :type 'boolean) | 1232 | :type 'boolean) |
| 1225 | 1233 | ||
| @@ -2236,8 +2244,9 @@ Lisp variable `org-state'." | |||
| 2236 | (defvar org-blocker-hook nil | 2244 | (defvar org-blocker-hook nil |
| 2237 | "Hook for functions that are allowed to block a state change. | 2245 | "Hook for functions that are allowed to block a state change. |
| 2238 | 2246 | ||
| 2239 | Each function gets as its single argument a property list, see | 2247 | Functions in this hook should not modify the buffer. |
| 2240 | `org-trigger-hook' for more information about this list. | 2248 | Each function gets as its single argument a property list, |
| 2249 | see `org-trigger-hook' for more information about this list. | ||
| 2241 | 2250 | ||
| 2242 | If any of the functions in this hook returns nil, the state change | 2251 | If any of the functions in this hook returns nil, the state change |
| 2243 | is blocked.") | 2252 | is blocked.") |
| @@ -2245,8 +2254,8 @@ is blocked.") | |||
| 2245 | (defvar org-trigger-hook nil | 2254 | (defvar org-trigger-hook nil |
| 2246 | "Hook for functions that are triggered by a state change. | 2255 | "Hook for functions that are triggered by a state change. |
| 2247 | 2256 | ||
| 2248 | Each function gets as its single argument a property list with at least | 2257 | Each function gets as its single argument a property list with at |
| 2249 | the following elements: | 2258 | least the following elements: |
| 2250 | 2259 | ||
| 2251 | (:type type-of-change :position pos-at-entry-start | 2260 | (:type type-of-change :position pos-at-entry-start |
| 2252 | :from old-state :to new-state) | 2261 | :from old-state :to new-state) |
| @@ -2979,7 +2988,7 @@ When nil, only the tags directly given in a specific line apply there. | |||
| 2979 | This may also be a list of tags that should be inherited, or a regexp that | 2988 | This may also be a list of tags that should be inherited, or a regexp that |
| 2980 | matches tags that should be inherited. Additional control is possible | 2989 | matches tags that should be inherited. Additional control is possible |
| 2981 | with the variable `org-tags-exclude-from-inheritance' which gives an | 2990 | with the variable `org-tags-exclude-from-inheritance' which gives an |
| 2982 | explicit list of tags to be excluded from inheritance., even if the value of | 2991 | explicit list of tags to be excluded from inheritance, even if the value of |
| 2983 | `org-use-tag-inheritance' would select it for inheritance. | 2992 | `org-use-tag-inheritance' would select it for inheritance. |
| 2984 | 2993 | ||
| 2985 | If this option is t, a match early-on in a tree can lead to a large | 2994 | If this option is t, a match early-on in a tree can lead to a large |
| @@ -3952,7 +3961,7 @@ If TABLE-TYPE is non-nil, also check for table.el-type tables." | |||
| 3952 | (beginning-of-line 1) | 3961 | (beginning-of-line 1) |
| 3953 | (when (and (looking-at org-table-line-regexp) | 3962 | (when (and (looking-at org-table-line-regexp) |
| 3954 | ;; Exclude tables in src/example/verbatim/clocktable blocks | 3963 | ;; Exclude tables in src/example/verbatim/clocktable blocks |
| 3955 | (not (org-in-block-p '("src" "example")))) | 3964 | (not (org-in-block-p '("src" "example" "verbatim" "clocktable")))) |
| 3956 | (save-excursion (funcall function)) | 3965 | (save-excursion (funcall function)) |
| 3957 | (or (looking-at org-table-line-regexp) | 3966 | (or (looking-at org-table-line-regexp) |
| 3958 | (forward-char 1))) | 3967 | (forward-char 1))) |
| @@ -5007,13 +5016,15 @@ The following commands are available: | |||
| 5007 | (defun org-find-invisible-foreground () | 5016 | (defun org-find-invisible-foreground () |
| 5008 | (let ((candidates (remove | 5017 | (let ((candidates (remove |
| 5009 | "unspecified-bg" | 5018 | "unspecified-bg" |
| 5010 | (list | 5019 | (nconc |
| 5011 | (face-background 'default) | 5020 | (list (face-background 'default) |
| 5012 | (face-background 'org-default) | 5021 | (face-background 'org-default)) |
| 5013 | (cdr (assoc 'background-color default-frame-alist)) | 5022 | (mapcar |
| 5014 | (cdr (assoc 'background-color initial-frame-alist)) | 5023 | (lambda (alist) |
| 5015 | (cdr (assoc 'background-color window-system-default-frame-alist)) | 5024 | (when (boundp alist) |
| 5016 | (face-foreground 'org-hide))))) | 5025 | (cdr (assoc 'background-color (symbol-value alist))))) |
| 5026 | '(default-frame-alist initial-frame-alist window-system-default-frame-alist)) | ||
| 5027 | (list (face-foreground 'org-hide)))))) | ||
| 5017 | (car (remove nil candidates)))) | 5028 | (car (remove nil candidates)))) |
| 5018 | 5029 | ||
| 5019 | (defun org-current-time () | 5030 | (defun org-current-time () |
| @@ -5284,7 +5295,7 @@ will be prompted for." | |||
| 5284 | (and move (backward-char 1)))) | 5295 | (and move (backward-char 1)))) |
| 5285 | 5296 | ||
| 5286 | (defconst org-nonsticky-props | 5297 | (defconst org-nonsticky-props |
| 5287 | '(mouse-face highlight keymap invisible intangible help-echo org-linked-text)) | 5298 | '(mouse-face highlight keymap invisible intangible help-echo org-linked-text htmlize-link)) |
| 5288 | 5299 | ||
| 5289 | (defsubst org-rear-nonsticky-at (pos) | 5300 | (defsubst org-rear-nonsticky-at (pos) |
| 5290 | (add-text-properties (1- pos) pos (list 'rear-nonsticky org-nonsticky-props))) | 5301 | (add-text-properties (1- pos) pos (list 'rear-nonsticky org-nonsticky-props))) |
| @@ -5293,12 +5304,13 @@ will be prompted for." | |||
| 5293 | "Run through the buffer and add overlays to links." | 5304 | "Run through the buffer and add overlays to links." |
| 5294 | (catch 'exit | 5305 | (catch 'exit |
| 5295 | (let (f) | 5306 | (let (f) |
| 5296 | (when (re-search-forward (concat org-plain-link-re) limit t) | 5307 | (when (and (re-search-forward (concat org-plain-link-re) limit t) |
| 5308 | (not (org-in-src-block-p))) | ||
| 5297 | (org-remove-flyspell-overlays-in (match-beginning 0) (match-end 0)) | 5309 | (org-remove-flyspell-overlays-in (match-beginning 0) (match-end 0)) |
| 5298 | (setq f (get-text-property (match-beginning 0) 'face)) | 5310 | (setq f (get-text-property (match-beginning 0) 'face)) |
| 5299 | (if (or (eq f 'org-tag) | 5311 | (unless (or (org-in-src-block-p) |
| 5300 | (and (listp f) (memq 'org-tag f))) | 5312 | (eq f 'org-tag) |
| 5301 | nil | 5313 | (and (listp f) (memq 'org-tag f))) |
| 5302 | (add-text-properties (match-beginning 0) (match-end 0) | 5314 | (add-text-properties (match-beginning 0) (match-end 0) |
| 5303 | (list 'mouse-face 'highlight | 5315 | (list 'mouse-face 'highlight |
| 5304 | 'face 'org-link | 5316 | 'face 'org-link |
| @@ -5410,9 +5422,9 @@ by a #." | |||
| 5410 | '(font-lock-fontified t invisible t) | 5422 | '(font-lock-fontified t invisible t) |
| 5411 | '(font-lock-fontified t face org-document-info-keyword))) | 5423 | '(font-lock-fontified t face org-document-info-keyword))) |
| 5412 | (add-text-properties | 5424 | (add-text-properties |
| 5413 | (match-beginning 6) (match-end 6) | 5425 | (match-beginning 6) (1+ (match-end 6)) |
| 5414 | (if (string-equal dc1 "+title:") | 5426 | (if (string-equal dc1 "+title:") |
| 5415 | '(font-lock-fontified t face org-document-title) | 5427 | '(font-lock-fontified t face org-document-title) |
| 5416 | '(font-lock-fontified t face org-document-info)))) | 5428 | '(font-lock-fontified t face org-document-info)))) |
| 5417 | ((or (equal dc1 "+results") | 5429 | ((or (equal dc1 "+results") |
| 5418 | (member dc1 '("+begin:" "+end:" "+caption:" "+label:" | 5430 | (member dc1 '("+begin:" "+end:" "+caption:" "+label:" |
| @@ -5437,7 +5449,8 @@ by a #." | |||
| 5437 | 5449 | ||
| 5438 | (defun org-activate-angle-links (limit) | 5450 | (defun org-activate-angle-links (limit) |
| 5439 | "Run through the buffer and add overlays to links." | 5451 | "Run through the buffer and add overlays to links." |
| 5440 | (if (re-search-forward org-angle-link-re limit t) | 5452 | (if (and (re-search-forward org-angle-link-re limit t) |
| 5453 | (not (org-in-src-block-p))) | ||
| 5441 | (progn | 5454 | (progn |
| 5442 | (org-remove-flyspell-overlays-in (match-beginning 0) (match-end 0)) | 5455 | (org-remove-flyspell-overlays-in (match-beginning 0) (match-end 0)) |
| 5443 | (add-text-properties (match-beginning 0) (match-end 0) | 5456 | (add-text-properties (match-beginning 0) (match-end 0) |
| @@ -5465,7 +5478,8 @@ by a #." | |||
| 5465 | 5478 | ||
| 5466 | (defun org-activate-bracket-links (limit) | 5479 | (defun org-activate-bracket-links (limit) |
| 5467 | "Run through the buffer and add overlays to bracketed links." | 5480 | "Run through the buffer and add overlays to bracketed links." |
| 5468 | (if (re-search-forward org-bracket-link-regexp limit t) | 5481 | (if (and (re-search-forward org-bracket-link-regexp limit t) |
| 5482 | (not (org-in-src-block-p))) | ||
| 5469 | (let* ((help (concat "LINK: " | 5483 | (let* ((help (concat "LINK: " |
| 5470 | (org-match-string-no-properties 1))) | 5484 | (org-match-string-no-properties 1))) |
| 5471 | ;; FIXME: above we should remove the escapes. | 5485 | ;; FIXME: above we should remove the escapes. |
| @@ -6254,11 +6268,7 @@ in special contexts. | |||
| 6254 | (setq has-children (org-list-has-child-p (point) struct))) | 6268 | (setq has-children (org-list-has-child-p (point) struct))) |
| 6255 | (org-back-to-heading) | 6269 | (org-back-to-heading) |
| 6256 | (setq eoh (save-excursion (outline-end-of-heading) (point))) | 6270 | (setq eoh (save-excursion (outline-end-of-heading) (point))) |
| 6257 | (setq eos (save-excursion | 6271 | (setq eos (save-excursion (1- (org-end-of-subtree t t)))) |
| 6258 | (org-end-of-subtree t) | ||
| 6259 | (unless (eobp) | ||
| 6260 | (skip-chars-forward " \t\n")) | ||
| 6261 | (if (eobp) (point) (1- (point))))) | ||
| 6262 | (setq has-children | 6272 | (setq has-children |
| 6263 | (or (save-excursion | 6273 | (or (save-excursion |
| 6264 | (let ((level (funcall outline-level))) | 6274 | (let ((level (funcall outline-level))) |
| @@ -6283,7 +6293,8 @@ in special contexts. | |||
| 6283 | (cond | 6293 | (cond |
| 6284 | ((= eos eoh) | 6294 | ((= eos eoh) |
| 6285 | ;; Nothing is hidden behind this heading | 6295 | ;; Nothing is hidden behind this heading |
| 6286 | (run-hook-with-args 'org-pre-cycle-hook 'empty) | 6296 | (unless (org-before-first-heading-p) |
| 6297 | (run-hook-with-args 'org-pre-cycle-hook 'empty)) | ||
| 6287 | (message "EMPTY ENTRY") | 6298 | (message "EMPTY ENTRY") |
| 6288 | (setq org-cycle-subtree-status nil) | 6299 | (setq org-cycle-subtree-status nil) |
| 6289 | (save-excursion | 6300 | (save-excursion |
| @@ -6296,7 +6307,8 @@ in special contexts. | |||
| 6296 | (not (setq children-skipped | 6307 | (not (setq children-skipped |
| 6297 | org-cycle-skip-children-state-if-no-children)))) | 6308 | org-cycle-skip-children-state-if-no-children)))) |
| 6298 | ;; Entire subtree is hidden in one line: children view | 6309 | ;; Entire subtree is hidden in one line: children view |
| 6299 | (run-hook-with-args 'org-pre-cycle-hook 'children) | 6310 | (unless (org-before-first-heading-p) |
| 6311 | (run-hook-with-args 'org-pre-cycle-hook 'children)) | ||
| 6300 | (if (org-at-item-p) | 6312 | (if (org-at-item-p) |
| 6301 | (org-list-set-item-visibility (point-at-bol) struct 'children) | 6313 | (org-list-set-item-visibility (point-at-bol) struct 'children) |
| 6302 | (org-show-entry) | 6314 | (org-show-entry) |
| @@ -6324,24 +6336,28 @@ in special contexts. | |||
| 6324 | (outline-next-heading) | 6336 | (outline-next-heading) |
| 6325 | (if (outline-invisible-p) (org-flag-heading nil))) | 6337 | (if (outline-invisible-p) (org-flag-heading nil))) |
| 6326 | (setq org-cycle-subtree-status 'children) | 6338 | (setq org-cycle-subtree-status 'children) |
| 6327 | (run-hook-with-args 'org-cycle-hook 'children)) | 6339 | (unless (org-before-first-heading-p) |
| 6340 | (run-hook-with-args 'org-cycle-hook 'children))) | ||
| 6328 | ((or children-skipped | 6341 | ((or children-skipped |
| 6329 | (and (eq last-command this-command) | 6342 | (and (eq last-command this-command) |
| 6330 | (eq org-cycle-subtree-status 'children))) | 6343 | (eq org-cycle-subtree-status 'children))) |
| 6331 | ;; We just showed the children, or no children are there, | 6344 | ;; We just showed the children, or no children are there, |
| 6332 | ;; now show everything. | 6345 | ;; now show everything. |
| 6333 | (run-hook-with-args 'org-pre-cycle-hook 'subtree) | 6346 | (unless (org-before-first-heading-p) |
| 6347 | (run-hook-with-args 'org-pre-cycle-hook 'subtree)) | ||
| 6334 | (outline-flag-region eoh eos nil) | 6348 | (outline-flag-region eoh eos nil) |
| 6335 | (message (if children-skipped "SUBTREE (NO CHILDREN)" "SUBTREE")) | 6349 | (message (if children-skipped "SUBTREE (NO CHILDREN)" "SUBTREE")) |
| 6336 | (setq org-cycle-subtree-status 'subtree) | 6350 | (setq org-cycle-subtree-status 'subtree) |
| 6337 | (run-hook-with-args 'org-cycle-hook 'subtree)) | 6351 | (unless (org-before-first-heading-p) |
| 6352 | (run-hook-with-args 'org-cycle-hook 'subtree))) | ||
| 6338 | (t | 6353 | (t |
| 6339 | ;; Default action: hide the subtree. | 6354 | ;; Default action: hide the subtree. |
| 6340 | (run-hook-with-args 'org-pre-cycle-hook 'folded) | 6355 | (run-hook-with-args 'org-pre-cycle-hook 'folded) |
| 6341 | (outline-flag-region eoh eos t) | 6356 | (outline-flag-region eoh eos t) |
| 6342 | (message "FOLDED") | 6357 | (message "FOLDED") |
| 6343 | (setq org-cycle-subtree-status 'folded) | 6358 | (setq org-cycle-subtree-status 'folded) |
| 6344 | (run-hook-with-args 'org-cycle-hook 'folded))))) | 6359 | (unless (org-before-first-heading-p) |
| 6360 | (run-hook-with-args 'org-cycle-hook 'folded)))))) | ||
| 6345 | 6361 | ||
| 6346 | ;;;###autoload | 6362 | ;;;###autoload |
| 6347 | (defun org-global-cycle (&optional arg) | 6363 | (defun org-global-cycle (&optional arg) |
| @@ -6745,42 +6761,47 @@ Optional arguments START and END can be used to limit the range." | |||
| 6745 | 6761 | ||
| 6746 | (defvar org-goto-window-configuration nil) | 6762 | (defvar org-goto-window-configuration nil) |
| 6747 | (defvar org-goto-marker nil) | 6763 | (defvar org-goto-marker nil) |
| 6748 | (defvar org-goto-map | 6764 | (defvar org-goto-map) |
| 6749 | (let ((map (make-sparse-keymap))) | 6765 | (defun org-goto-map () |
| 6750 | (let ((cmds '(isearch-forward isearch-backward kill-ring-save set-mark-command mouse-drag-region universal-argument org-occur)) cmd) | 6766 | "Set the keymap `org-goto'." |
| 6751 | (while (setq cmd (pop cmds)) | 6767 | (setq org-goto-map |
| 6752 | (substitute-key-definition cmd cmd map global-map))) | 6768 | (let ((map (make-sparse-keymap))) |
| 6753 | (suppress-keymap map) | 6769 | (let ((cmds '(isearch-forward isearch-backward kill-ring-save set-mark-command |
| 6754 | (org-defkey map "\C-m" 'org-goto-ret) | 6770 | mouse-drag-region universal-argument org-occur)) |
| 6755 | (org-defkey map [(return)] 'org-goto-ret) | 6771 | cmd) |
| 6756 | (org-defkey map [(left)] 'org-goto-left) | 6772 | (while (setq cmd (pop cmds)) |
| 6757 | (org-defkey map [(right)] 'org-goto-right) | 6773 | (substitute-key-definition cmd cmd map global-map))) |
| 6758 | (org-defkey map [(control ?g)] 'org-goto-quit) | 6774 | (suppress-keymap map) |
| 6759 | (org-defkey map "\C-i" 'org-cycle) | 6775 | (org-defkey map "\C-m" 'org-goto-ret) |
| 6760 | (org-defkey map [(tab)] 'org-cycle) | 6776 | (org-defkey map [(return)] 'org-goto-ret) |
| 6761 | (org-defkey map [(down)] 'outline-next-visible-heading) | 6777 | (org-defkey map [(left)] 'org-goto-left) |
| 6762 | (org-defkey map [(up)] 'outline-previous-visible-heading) | 6778 | (org-defkey map [(right)] 'org-goto-right) |
| 6763 | (if org-goto-auto-isearch | 6779 | (org-defkey map [(control ?g)] 'org-goto-quit) |
| 6764 | (if (fboundp 'define-key-after) | 6780 | (org-defkey map "\C-i" 'org-cycle) |
| 6765 | (define-key-after map [t] 'org-goto-local-auto-isearch) | 6781 | (org-defkey map [(tab)] 'org-cycle) |
| 6766 | nil) | 6782 | (org-defkey map [(down)] 'outline-next-visible-heading) |
| 6767 | (org-defkey map "q" 'org-goto-quit) | 6783 | (org-defkey map [(up)] 'outline-previous-visible-heading) |
| 6768 | (org-defkey map "n" 'outline-next-visible-heading) | 6784 | (if org-goto-auto-isearch |
| 6769 | (org-defkey map "p" 'outline-previous-visible-heading) | 6785 | (if (fboundp 'define-key-after) |
| 6770 | (org-defkey map "f" 'outline-forward-same-level) | 6786 | (define-key-after map [t] 'org-goto-local-auto-isearch) |
| 6771 | (org-defkey map "b" 'outline-backward-same-level) | 6787 | nil) |
| 6772 | (org-defkey map "u" 'outline-up-heading)) | 6788 | (org-defkey map "q" 'org-goto-quit) |
| 6773 | (org-defkey map "/" 'org-occur) | 6789 | (org-defkey map "n" 'outline-next-visible-heading) |
| 6774 | (org-defkey map "\C-c\C-n" 'outline-next-visible-heading) | 6790 | (org-defkey map "p" 'outline-previous-visible-heading) |
| 6775 | (org-defkey map "\C-c\C-p" 'outline-previous-visible-heading) | 6791 | (org-defkey map "f" 'outline-forward-same-level) |
| 6776 | (org-defkey map "\C-c\C-f" 'outline-forward-same-level) | 6792 | (org-defkey map "b" 'outline-backward-same-level) |
| 6777 | (org-defkey map "\C-c\C-b" 'outline-backward-same-level) | 6793 | (org-defkey map "u" 'outline-up-heading)) |
| 6778 | (org-defkey map "\C-c\C-u" 'outline-up-heading) | 6794 | (org-defkey map "/" 'org-occur) |
| 6779 | map)) | 6795 | (org-defkey map "\C-c\C-n" 'outline-next-visible-heading) |
| 6796 | (org-defkey map "\C-c\C-p" 'outline-previous-visible-heading) | ||
| 6797 | (org-defkey map "\C-c\C-f" 'outline-forward-same-level) | ||
| 6798 | (org-defkey map "\C-c\C-b" 'outline-backward-same-level) | ||
| 6799 | (org-defkey map "\C-c\C-u" 'outline-up-heading) | ||
| 6800 | map))) | ||
| 6780 | 6801 | ||
| 6781 | (defconst org-goto-help | 6802 | (defconst org-goto-help |
| 6782 | "Browse buffer copy, to find location or copy text. Just type for auto-isearch. | 6803 | "Browse buffer copy, to find location or copy text.%s |
| 6783 | RET=jump to location [Q]uit and return to previous location | 6804 | RET=jump to location C-g=quit and return to previous location |
| 6784 | \[Up]/[Down]=next/prev headline TAB=cycle visibility [/] org-occur") | 6805 | \[Up]/[Down]=next/prev headline TAB=cycle visibility [/] org-occur") |
| 6785 | 6806 | ||
| 6786 | (defvar org-goto-start-pos) ; dynamically scoped parameter | 6807 | (defvar org-goto-start-pos) ; dynamically scoped parameter |
| @@ -6806,6 +6827,7 @@ in the indirect buffer and expose the headline hierarchy above. | |||
| 6806 | With a prefix argument, use the alternative interface: e.g. if | 6827 | With a prefix argument, use the alternative interface: e.g. if |
| 6807 | `org-goto-interface' is 'outline use 'outline-path-completion." | 6828 | `org-goto-interface' is 'outline use 'outline-path-completion." |
| 6808 | (interactive "P") | 6829 | (interactive "P") |
| 6830 | (org-goto-map) | ||
| 6809 | (let* ((org-refile-targets `((nil . (:maxlevel . ,org-goto-max-level)))) | 6831 | (let* ((org-refile-targets `((nil . (:maxlevel . ,org-goto-max-level)))) |
| 6810 | (org-refile-use-outline-path t) | 6832 | (org-refile-use-outline-path t) |
| 6811 | (org-refile-target-verify-function nil) | 6833 | (org-refile-target-verify-function nil) |
| @@ -6838,48 +6860,46 @@ With a prefix argument, use the alternative interface: e.g. if | |||
| 6838 | "Let the user select a location in the Org-mode buffer BUF. | 6860 | "Let the user select a location in the Org-mode buffer BUF. |
| 6839 | This function uses a recursive edit. It returns the selected position | 6861 | This function uses a recursive edit. It returns the selected position |
| 6840 | or nil." | 6862 | or nil." |
| 6841 | (let ((isearch-mode-map org-goto-local-auto-isearch-map) | 6863 | (org-no-popups |
| 6842 | (isearch-hide-immediately nil) | 6864 | (let ((isearch-mode-map org-goto-local-auto-isearch-map) |
| 6843 | (isearch-search-fun-function | 6865 | (isearch-hide-immediately nil) |
| 6844 | (lambda () 'org-goto-local-search-headings)) | 6866 | (isearch-search-fun-function |
| 6845 | (org-goto-selected-point org-goto-exit-command) | 6867 | (lambda () 'org-goto-local-search-headings)) |
| 6846 | (pop-up-frames nil) | 6868 | (org-goto-selected-point org-goto-exit-command)) |
| 6847 | (special-display-buffer-names nil) | 6869 | (save-excursion |
| 6848 | (special-display-regexps nil) | 6870 | (save-window-excursion |
| 6849 | (special-display-function nil)) | 6871 | (delete-other-windows) |
| 6850 | (save-excursion | 6872 | (and (get-buffer "*org-goto*") (kill-buffer "*org-goto*")) |
| 6851 | (save-window-excursion | 6873 | (org-pop-to-buffer-same-window |
| 6852 | (delete-other-windows) | 6874 | (condition-case nil |
| 6853 | (and (get-buffer "*org-goto*") (kill-buffer "*org-goto*")) | 6875 | (make-indirect-buffer (current-buffer) "*org-goto*") |
| 6854 | (org-pop-to-buffer-same-window | 6876 | (error (make-indirect-buffer (current-buffer) "*org-goto*")))) |
| 6855 | (condition-case nil | 6877 | (with-output-to-temp-buffer "*Org Help*" |
| 6856 | (make-indirect-buffer (current-buffer) "*org-goto*") | 6878 | (princ (format help (if org-goto-auto-isearch |
| 6857 | (error (make-indirect-buffer (current-buffer) "*org-goto*")))) | 6879 | " Just type for auto-isearch." |
| 6858 | (with-output-to-temp-buffer "*Help*" | 6880 | " n/p/f/b/u to navigate, q to quit.")))) |
| 6859 | (princ help)) | 6881 | (org-fit-window-to-buffer (get-buffer-window "*Org Help*")) |
| 6860 | (org-fit-window-to-buffer (get-buffer-window "*Help*")) | 6882 | (setq buffer-read-only nil) |
| 6861 | (setq buffer-read-only nil) | 6883 | (let ((org-startup-truncated t) |
| 6862 | (let ((org-startup-truncated t) | 6884 | (org-startup-folded nil) |
| 6863 | (org-startup-folded nil) | 6885 | (org-startup-align-all-tables nil)) |
| 6864 | (org-startup-align-all-tables nil)) | 6886 | (org-mode) |
| 6865 | (org-mode) | 6887 | (org-overview)) |
| 6866 | (org-overview)) | 6888 | (setq buffer-read-only t) |
| 6867 | (setq buffer-read-only t) | 6889 | (if (and (boundp 'org-goto-start-pos) |
| 6868 | (if (and (boundp 'org-goto-start-pos) | 6890 | (integer-or-marker-p org-goto-start-pos)) |
| 6869 | (integer-or-marker-p org-goto-start-pos)) | 6891 | (let ((org-show-hierarchy-above t) |
| 6870 | (let ((org-show-hierarchy-above t) | 6892 | (org-show-siblings t) |
| 6871 | (org-show-siblings t) | 6893 | (org-show-following-heading t)) |
| 6872 | (org-show-following-heading t)) | 6894 | (goto-char org-goto-start-pos) |
| 6873 | (goto-char org-goto-start-pos) | 6895 | (and (outline-invisible-p) (org-show-context))) |
| 6874 | (and (outline-invisible-p) (org-show-context))) | 6896 | (goto-char (point-min))) |
| 6875 | (goto-char (point-min))) | 6897 | (let (org-special-ctrl-a/e) (org-beginning-of-line)) |
| 6876 | (let (org-special-ctrl-a/e) (org-beginning-of-line)) | 6898 | (message "Select location and press RET") |
| 6877 | (message "Select location and press RET") | 6899 | (use-local-map org-goto-map) |
| 6878 | (use-local-map org-goto-map) | 6900 | (recursive-edit))) |
| 6879 | (recursive-edit) | 6901 | (kill-buffer "*org-goto*") |
| 6880 | )) | 6902 | (cons org-goto-selected-point org-goto-exit-command)))) |
| 6881 | (kill-buffer "*org-goto*") | ||
| 6882 | (cons org-goto-selected-point org-goto-exit-command))) | ||
| 6883 | 6903 | ||
| 6884 | (defvar org-goto-local-auto-isearch-map (make-sparse-keymap)) | 6904 | (defvar org-goto-local-auto-isearch-map (make-sparse-keymap)) |
| 6885 | (set-keymap-parent org-goto-local-auto-isearch-map isearch-mode-map) | 6905 | (set-keymap-parent org-goto-local-auto-isearch-map isearch-mode-map) |
| @@ -7382,12 +7402,7 @@ even level numbers will become the next higher odd number." | |||
| 7382 | ((< change 0) (max 1 (1+ (* 2 (/ (+ level (* 2 change)) 2)))))) | 7402 | ((< change 0) (max 1 (1+ (* 2 (/ (+ level (* 2 change)) 2)))))) |
| 7383 | (max 1 (+ level (or change 0))))) | 7403 | (max 1 (+ level (or change 0))))) |
| 7384 | 7404 | ||
| 7385 | (if (boundp 'define-obsolete-function-alias) | 7405 | (org-define-obsolete-function-alias 'org-get-legal-level 'org-get-valid-level "23.1") |
| 7386 | (if (or (featurep 'xemacs) (< emacs-major-version 23)) | ||
| 7387 | (define-obsolete-function-alias 'org-get-legal-level | ||
| 7388 | 'org-get-valid-level) | ||
| 7389 | (define-obsolete-function-alias 'org-get-legal-level | ||
| 7390 | 'org-get-valid-level "23.1"))) | ||
| 7391 | 7406 | ||
| 7392 | (defvar org-called-with-limited-levels nil) ;; Dynamically bound in | 7407 | (defvar org-called-with-limited-levels nil) ;; Dynamically bound in |
| 7393 | ;; ̀org-with-limited-levels' | 7408 | ;; ̀org-with-limited-levels' |
| @@ -7672,7 +7687,6 @@ useful if the caller implements cut-and-paste as copy-then-paste-then-cut." | |||
| 7672 | (if (org-called-interactively-p 'any) | 7687 | (if (org-called-interactively-p 'any) |
| 7673 | (org-back-to-heading nil) ; take what looks like a subtree | 7688 | (org-back-to-heading nil) ; take what looks like a subtree |
| 7674 | (org-back-to-heading t)) ; take what is really there | 7689 | (org-back-to-heading t)) ; take what is really there |
| 7675 | (org-back-over-empty-lines) | ||
| 7676 | (setq beg (point)) | 7690 | (setq beg (point)) |
| 7677 | (skip-chars-forward " \t\r\n") | 7691 | (skip-chars-forward " \t\r\n") |
| 7678 | (save-match-data | 7692 | (save-match-data |
| @@ -7682,7 +7696,6 @@ useful if the caller implements cut-and-paste as copy-then-paste-then-cut." | |||
| 7682 | (org-forward-heading-same-level (1- n) t) | 7696 | (org-forward-heading-same-level (1- n) t) |
| 7683 | (error nil)) | 7697 | (error nil)) |
| 7684 | (org-end-of-subtree t t)) | 7698 | (org-end-of-subtree t t)) |
| 7685 | (org-back-over-empty-lines) | ||
| 7686 | (setq end (point)) | 7699 | (setq end (point)) |
| 7687 | (goto-char beg0) | 7700 | (goto-char beg0) |
| 7688 | (when (> end beg) | 7701 | (when (> end beg) |
| @@ -7773,7 +7786,6 @@ the inserted text when done." | |||
| 7773 | (delete-region (point-at-bol) (point))) | 7786 | (delete-region (point-at-bol) (point))) |
| 7774 | ;; Paste | 7787 | ;; Paste |
| 7775 | (beginning-of-line (if (bolp) 1 2)) | 7788 | (beginning-of-line (if (bolp) 1 2)) |
| 7776 | (unless for-yank (org-back-over-empty-lines)) | ||
| 7777 | (setq beg (point)) | 7789 | (setq beg (point)) |
| 7778 | (and (fboundp 'org-id-paste-tracker) (org-id-paste-tracker txt)) | 7790 | (and (fboundp 'org-id-paste-tracker) (org-id-paste-tracker txt)) |
| 7779 | (insert-before-markers txt) | 7791 | (insert-before-markers txt) |
| @@ -8630,6 +8642,24 @@ call CMD." | |||
| 8630 | (put-text-property beg end 'org-category-position beg) | 8642 | (put-text-property beg end 'org-category-position beg) |
| 8631 | (goto-char pos))))))) | 8643 | (goto-char pos))))))) |
| 8632 | 8644 | ||
| 8645 | (defun org-refresh-properties (dprop tprop) | ||
| 8646 | "Refresh buffer text properties. | ||
| 8647 | DPROP is the drawer property and TPROP is the corresponding text | ||
| 8648 | property to set." | ||
| 8649 | (let ((case-fold-search t) | ||
| 8650 | (inhibit-read-only t) p) | ||
| 8651 | (org-unmodified | ||
| 8652 | (save-excursion | ||
| 8653 | (save-restriction | ||
| 8654 | (widen) | ||
| 8655 | (goto-char (point-min)) | ||
| 8656 | (while (re-search-forward (concat "^[ \t]*:" dprop ": +\\(.*\\)[ \t]*$") nil t) | ||
| 8657 | (setq p (org-match-string-no-properties 1)) | ||
| 8658 | (save-excursion | ||
| 8659 | (org-back-to-heading t) | ||
| 8660 | (put-text-property | ||
| 8661 | (point-at-bol) (point-at-eol) tprop p)))))))) | ||
| 8662 | |||
| 8633 | 8663 | ||
| 8634 | ;;;; Link Stuff | 8664 | ;;;; Link Stuff |
| 8635 | 8665 | ||
| @@ -8723,7 +8753,7 @@ type. For a simple example of an export function, see `org-bbdb.el'." | |||
| 8723 | (push (list type follow export) org-link-protocols))) | 8753 | (push (list type follow export) org-link-protocols))) |
| 8724 | 8754 | ||
| 8725 | (defvar org-agenda-buffer-name) ; Defined in org-agenda.el | 8755 | (defvar org-agenda-buffer-name) ; Defined in org-agenda.el |
| 8726 | (defvar org-link-to-org-use-id) ; Defined in org-id.el | 8756 | (defvar org-id-link-to-org-use-id) ; Defined in org-id.el |
| 8727 | 8757 | ||
| 8728 | ;;;###autoload | 8758 | ;;;###autoload |
| 8729 | (defun org-store-link (arg) | 8759 | (defun org-store-link (arg) |
| @@ -8839,13 +8869,13 @@ For file links, arg negates `org-context-in-file-links'." | |||
| 8839 | "::" (match-string 1)) | 8869 | "::" (match-string 1)) |
| 8840 | link cpltxt)) | 8870 | link cpltxt)) |
| 8841 | ((and (featurep 'org-id) | 8871 | ((and (featurep 'org-id) |
| 8842 | (or (eq org-link-to-org-use-id t) | 8872 | (or (eq org-id-link-to-org-use-id t) |
| 8843 | (and (org-called-interactively-p 'any) | 8873 | (and (org-called-interactively-p 'any) |
| 8844 | (or (eq org-link-to-org-use-id 'create-if-interactive) | 8874 | (or (eq org-id-link-to-org-use-id 'create-if-interactive) |
| 8845 | (and (eq org-link-to-org-use-id | 8875 | (and (eq org-id-link-to-org-use-id |
| 8846 | 'create-if-interactive-and-no-custom-id) | 8876 | 'create-if-interactive-and-no-custom-id) |
| 8847 | (not custom-id)))) | 8877 | (not custom-id)))) |
| 8848 | (and org-link-to-org-use-id (org-entry-get nil "ID")))) | 8878 | (and org-id-link-to-org-use-id (org-entry-get nil "ID")))) |
| 8849 | ;; We can make a link using the ID. | 8879 | ;; We can make a link using the ID. |
| 8850 | (setq link (condition-case nil | 8880 | (setq link (condition-case nil |
| 8851 | (prog1 (org-id-store-link) | 8881 | (prog1 (org-id-store-link) |
| @@ -9318,10 +9348,11 @@ Use TAB to complete link prefixes, then RET for type-specific completion support | |||
| 9318 | ;; URL-like link, normalize the use of angular brackets. | 9348 | ;; URL-like link, normalize the use of angular brackets. |
| 9319 | (setq link (org-remove-angle-brackets link))) | 9349 | (setq link (org-remove-angle-brackets link))) |
| 9320 | 9350 | ||
| 9321 | ;; Check if we are linking to the current file with a search option | 9351 | ;; Check if we are linking to the current file with a search |
| 9322 | ;; If yes, simplify the link by using only the search option. | 9352 | ;; option If yes, simplify the link by using only the search |
| 9353 | ;; option. | ||
| 9323 | (when (and buffer-file-name | 9354 | (when (and buffer-file-name |
| 9324 | (string-match "^file:\\(.+?\\)::\\([^>]+\\)" link)) | 9355 | (string-match "^file:\\(.+?\\)::\\(.+\\)" link)) |
| 9325 | (let* ((path (match-string 1 link)) | 9356 | (let* ((path (match-string 1 link)) |
| 9326 | (case-fold-search nil) | 9357 | (case-fold-search nil) |
| 9327 | (search (match-string 2 link))) | 9358 | (search (match-string 2 link))) |
| @@ -9652,7 +9683,13 @@ application the system uses for this file type." | |||
| 9652 | org-angle-link-re "\\|" | 9683 | org-angle-link-re "\\|" |
| 9653 | "[ \t]:[^ \t\n]+:[ \t]*$"))) | 9684 | "[ \t]:[^ \t\n]+:[ \t]*$"))) |
| 9654 | (not (get-text-property (point) 'org-linked-text))) | 9685 | (not (get-text-property (point) 'org-linked-text))) |
| 9655 | (or (org-offer-links-in-entry arg) | 9686 | (or (let* ((lkall (org-offer-links-in-entry (current-buffer) (point) arg)) |
| 9687 | (lk (car lkall)) | ||
| 9688 | (lkend (cdr lkall))) | ||
| 9689 | (when lk | ||
| 9690 | (prog1 (search-forward lk nil lkend) | ||
| 9691 | (goto-char (match-beginning 0)) | ||
| 9692 | (org-open-at-point)))) | ||
| 9656 | (progn (require 'org-attach) (org-attach-reveal 'if-exists)))) | 9693 | (progn (require 'org-attach) (org-attach-reveal 'if-exists)))) |
| 9657 | ((run-hook-with-args-until-success 'org-open-at-point-functions)) | 9694 | ((run-hook-with-args-until-success 'org-open-at-point-functions)) |
| 9658 | ((and (org-at-timestamp-p t) | 9695 | ((and (org-at-timestamp-p t) |
| @@ -9695,12 +9732,13 @@ application the system uses for this file type." | |||
| 9695 | (throw 'match t)) | 9732 | (throw 'match t)) |
| 9696 | 9733 | ||
| 9697 | (save-excursion | 9734 | (save-excursion |
| 9698 | (when (or (org-in-regexp org-angle-link-re) | 9735 | (let ((plinkpos (org-in-regexp org-plain-link-re))) |
| 9699 | (and (goto-char (car (org-in-regexp org-plain-link-re))) | 9736 | (when (or (org-in-regexp org-angle-link-re) |
| 9700 | (save-match-data (not (looking-back "\\[\\["))))) | 9737 | (and plinkpos (goto-char (car plinkpos)) |
| 9701 | (setq type (match-string 1) | 9738 | (save-match-data (not (looking-back "\\[\\["))))) |
| 9702 | path (org-link-unescape (match-string 2))) | 9739 | (setq type (match-string 1) |
| 9703 | (throw 'match t))) | 9740 | path (org-link-unescape (match-string 2))) |
| 9741 | (throw 'match t)))) | ||
| 9704 | (save-excursion | 9742 | (save-excursion |
| 9705 | (when (org-in-regexp (org-re "\\(:[[:alnum:]_@#%:]+\\):[ \t]*$")) | 9743 | (when (org-in-regexp (org-re "\\(:[[:alnum:]_@#%:]+\\):[ \t]*$")) |
| 9706 | (setq type "tags" | 9744 | (setq type "tags" |
| @@ -9713,7 +9751,7 @@ application the system uses for this file type." | |||
| 9713 | path (match-string 1)) | 9751 | path (match-string 1)) |
| 9714 | (throw 'match t))) | 9752 | (throw 'match t))) |
| 9715 | (unless path | 9753 | (unless path |
| 9716 | (error "No link found")) | 9754 | (user-error "No link found")) |
| 9717 | 9755 | ||
| 9718 | ;; switch back to reference buffer | 9756 | ;; switch back to reference buffer |
| 9719 | ;; needed when if called in a temporary buffer through | 9757 | ;; needed when if called in a temporary buffer through |
| @@ -9847,68 +9885,67 @@ application the system uses for this file type." | |||
| 9847 | (move-marker org-open-link-marker nil) | 9885 | (move-marker org-open-link-marker nil) |
| 9848 | (run-hook-with-args 'org-follow-link-hook))) | 9886 | (run-hook-with-args 'org-follow-link-hook))) |
| 9849 | 9887 | ||
| 9850 | (defun org-offer-links-in-entry (&optional nth zero) | 9888 | (defun org-offer-links-in-entry (buffer marker &optional nth zero) |
| 9851 | "Offer links in the current entry and follow the selected link. | 9889 | "Offer links in the current entry and return the selected link. |
| 9852 | If there is only one link, follow it immediately as well. | 9890 | If there is only one link, return it. |
| 9853 | If NTH is an integer, immediately pick the NTH link found. | 9891 | If NTH is an integer, return the NTH link found. |
| 9854 | If ZERO is a string, check also this string for a link, and if | 9892 | If ZERO is a string, check also this string for a link, and if |
| 9855 | there is one, offer it as link number zero." | 9893 | there is one, return it." |
| 9856 | (let ((re (concat "\\(" org-bracket-link-regexp "\\)\\|" | 9894 | (with-current-buffer buffer |
| 9857 | "\\(" org-angle-link-re "\\)\\|" | ||
| 9858 | "\\(" org-plain-link-re "\\)")) | ||
| 9859 | (cnt ?0) | ||
| 9860 | (in-emacs (if (integerp nth) nil nth)) | ||
| 9861 | have-zero end links link c) | ||
| 9862 | (when (and (stringp zero) (string-match org-bracket-link-regexp zero)) | ||
| 9863 | (push (match-string 0 zero) links) | ||
| 9864 | (setq cnt (1- cnt) have-zero t)) | ||
| 9865 | (save-excursion | 9895 | (save-excursion |
| 9866 | (org-back-to-heading t) | 9896 | (save-restriction |
| 9867 | (setq end (save-excursion (outline-next-heading) (point))) | 9897 | (widen) |
| 9868 | (while (re-search-forward re end t) | 9898 | (goto-char marker) |
| 9869 | (push (match-string 0) links)) | 9899 | (let ((re (concat "\\(" org-bracket-link-regexp "\\)\\|" |
| 9870 | (setq links (org-uniquify (reverse links)))) | 9900 | "\\(" org-angle-link-re "\\)\\|" |
| 9871 | 9901 | "\\(" org-plain-link-re "\\)")) | |
| 9872 | (cond | 9902 | (cnt ?0) |
| 9873 | ((null links) | 9903 | (in-emacs (if (integerp nth) nil nth)) |
| 9874 | (message "No links")) | 9904 | have-zero end links link c) |
| 9875 | ((equal (length links) 1) | 9905 | (when (and (stringp zero) (string-match org-bracket-link-regexp zero)) |
| 9876 | (setq link (list (car links)))) | 9906 | (push (match-string 0 zero) links) |
| 9877 | ((and (integerp nth) (>= (length links) (if have-zero (1+ nth) nth))) | 9907 | (setq cnt (1- cnt) have-zero t)) |
| 9878 | (setq link (list (nth (if have-zero nth (1- nth)) links)))) | 9908 | (save-excursion |
| 9879 | (t ; we have to select a link | 9909 | (org-back-to-heading t) |
| 9880 | (save-excursion | 9910 | (setq end (save-excursion (outline-next-heading) (point))) |
| 9881 | (save-window-excursion | 9911 | (while (re-search-forward re end t) |
| 9882 | (delete-other-windows) | 9912 | (push (match-string 0) links)) |
| 9883 | (with-output-to-temp-buffer "*Select Link*" | 9913 | (setq links (org-uniquify (reverse links)))) |
| 9884 | (mapc (lambda (l) | 9914 | (cond |
| 9885 | (if (not (string-match org-bracket-link-regexp l)) | 9915 | ((null links) |
| 9886 | (princ (format "[%c] %s\n" (incf cnt) | 9916 | (message "No links")) |
| 9887 | (org-remove-angle-brackets l))) | 9917 | ((equal (length links) 1) |
| 9888 | (if (match-end 3) | 9918 | (setq link (car links))) |
| 9889 | (princ (format "[%c] %s (%s)\n" (incf cnt) | 9919 | ((and (integerp nth) (>= (length links) (if have-zero (1+ nth) nth))) |
| 9890 | (match-string 3 l) (match-string 1 l))) | 9920 | (setq link (nth (if have-zero nth (1- nth)) links))) |
| 9891 | (princ (format "[%c] %s\n" (incf cnt) | 9921 | (t ; we have to select a link |
| 9892 | (match-string 1 l)))))) | 9922 | (save-excursion |
| 9893 | links)) | 9923 | (save-window-excursion |
| 9894 | (org-fit-window-to-buffer (get-buffer-window "*Select Link*")) | 9924 | (delete-other-windows) |
| 9895 | (message "Select link to open, RET to open all:") | 9925 | (with-output-to-temp-buffer "*Select Link*" |
| 9896 | (setq c (read-char-exclusive)) | 9926 | (mapc (lambda (l) |
| 9897 | (and (get-buffer "*Select Link*") (kill-buffer "*Select Link*")))) | 9927 | (if (not (string-match org-bracket-link-regexp l)) |
| 9898 | (when (equal c ?q) (error "Abort")) | 9928 | (princ (format "[%c] %s\n" (incf cnt) |
| 9899 | (if (equal c ?\C-m) | 9929 | (org-remove-angle-brackets l))) |
| 9900 | (setq link links) | 9930 | (if (match-end 3) |
| 9901 | (setq nth (- c ?0)) | 9931 | (princ (format "[%c] %s (%s)\n" (incf cnt) |
| 9902 | (if have-zero (setq nth (1+ nth))) | 9932 | (match-string 3 l) (match-string 1 l))) |
| 9903 | (unless (and (integerp nth) (>= (length links) nth)) | 9933 | (princ (format "[%c] %s\n" (incf cnt) |
| 9904 | (error "Invalid link selection")) | 9934 | (match-string 1 l)))))) |
| 9905 | (setq link (list (nth (1- nth) links)))))) | 9935 | links)) |
| 9906 | (if link | 9936 | (org-fit-window-to-buffer (get-buffer-window "*Select Link*")) |
| 9907 | (let ((buf (current-buffer))) | 9937 | (message "Select link to open, RET to open all:") |
| 9908 | (dolist (l link) | 9938 | (setq c (read-char-exclusive)) |
| 9909 | (org-open-link-from-string l in-emacs buf)) | 9939 | (and (get-buffer "*Select Link*") (kill-buffer "*Select Link*")))) |
| 9910 | t) | 9940 | (when (equal c ?q) (error "Abort")) |
| 9911 | nil))) | 9941 | (if (equal c ?\C-m) |
| 9942 | (setq link links) | ||
| 9943 | (setq nth (- c ?0)) | ||
| 9944 | (if have-zero (setq nth (1+ nth))) | ||
| 9945 | (unless (and (integerp nth) (>= (length links) nth)) | ||
| 9946 | (error "Invalid link selection")) | ||
| 9947 | (setq link (nth (1- nth) links))))) | ||
| 9948 | (cons link end)))))) | ||
| 9912 | 9949 | ||
| 9913 | ;; Add special file links that specify the way of opening | 9950 | ;; Add special file links that specify the way of opening |
| 9914 | 9951 | ||
| @@ -9930,12 +9967,6 @@ there is one, offer it as link number zero." | |||
| 9930 | '(add-hook 'org-export-preprocess-before-normalizing-links-hook | 9967 | '(add-hook 'org-export-preprocess-before-normalizing-links-hook |
| 9931 | 'org-remove-file-link-modifiers)) | 9968 | 'org-remove-file-link-modifiers)) |
| 9932 | 9969 | ||
| 9933 | ;;;; Time estimates | ||
| 9934 | |||
| 9935 | (defun org-get-effort (&optional pom) | ||
| 9936 | "Get the effort estimate for the current entry." | ||
| 9937 | (org-entry-get pom org-effort-property)) | ||
| 9938 | |||
| 9939 | ;;; File search | 9970 | ;;; File search |
| 9940 | 9971 | ||
| 9941 | (defvar org-create-file-search-functions nil | 9972 | (defvar org-create-file-search-functions nil |
| @@ -11259,8 +11290,7 @@ This function can be used in a hook." | |||
| 11259 | " +" t))) | 11290 | " +" t))) |
| 11260 | 11291 | ||
| 11261 | (defcustom org-structure-template-alist | 11292 | (defcustom org-structure-template-alist |
| 11262 | '( | 11293 | '(("s" "#+BEGIN_SRC ?\n\n#+END_SRC" |
| 11263 | ("s" "#+BEGIN_SRC ?\n\n#+END_SRC" | ||
| 11264 | "<src lang=\"?\">\n\n</src>") | 11294 | "<src lang=\"?\">\n\n</src>") |
| 11265 | ("e" "#+BEGIN_EXAMPLE\n?\n#+END_EXAMPLE" | 11295 | ("e" "#+BEGIN_EXAMPLE\n?\n#+END_EXAMPLE" |
| 11266 | "<example>\n?\n</example>") | 11296 | "<example>\n?\n</example>") |
| @@ -11268,6 +11298,8 @@ This function can be used in a hook." | |||
| 11268 | "<quote>\n?\n</quote>") | 11298 | "<quote>\n?\n</quote>") |
| 11269 | ("v" "#+BEGIN_VERSE\n?\n#+END_VERSE" | 11299 | ("v" "#+BEGIN_VERSE\n?\n#+END_VERSE" |
| 11270 | "<verse>\n?\n</verse>") | 11300 | "<verse>\n?\n</verse>") |
| 11301 | ("V" "#+BEGIN_VERBATIM\n?\n#+END_VERBATIM" | ||
| 11302 | "<verbatim>\n?\n</verbatim>") | ||
| 11271 | ("c" "#+BEGIN_CENTER\n?\n#+END_CENTER" | 11303 | ("c" "#+BEGIN_CENTER\n?\n#+END_CENTER" |
| 11272 | "<center>\n?\n</center>") | 11304 | "<center>\n?\n</center>") |
| 11273 | ("l" "#+BEGIN_LaTeX\n?\n#+END_LaTeX" | 11305 | ("l" "#+BEGIN_LaTeX\n?\n#+END_LaTeX" |
| @@ -11283,8 +11315,7 @@ This function can be used in a hook." | |||
| 11283 | ("i" "#+INDEX: ?" | 11315 | ("i" "#+INDEX: ?" |
| 11284 | "#+INDEX: ?") | 11316 | "#+INDEX: ?") |
| 11285 | ("I" "#+INCLUDE: %file ?" | 11317 | ("I" "#+INCLUDE: %file ?" |
| 11286 | "<include file=%file markup=\"?\">") | 11318 | "<include file=%file markup=\"?\">")) |
| 11287 | ) | ||
| 11288 | "Structure completion elements. | 11319 | "Structure completion elements. |
| 11289 | This is a list of abbreviation keys and values. The value gets inserted | 11320 | This is a list of abbreviation keys and values. The value gets inserted |
| 11290 | if you type `<' followed by the key and then press the completion key, | 11321 | if you type `<' followed by the key and then press the completion key, |
| @@ -11439,7 +11470,8 @@ For calling through lisp, arg is also interpreted in the following way: | |||
| 11439 | cl (if (outline-invisible-p) (org-end-of-subtree nil t)))) | 11470 | cl (if (outline-invisible-p) (org-end-of-subtree nil t)))) |
| 11440 | (if (equal arg '(16)) (setq arg 'nextset)) | 11471 | (if (equal arg '(16)) (setq arg 'nextset)) |
| 11441 | (let ((org-blocker-hook org-blocker-hook) | 11472 | (let ((org-blocker-hook org-blocker-hook) |
| 11442 | (case-fold-search nil)) | 11473 | commentp |
| 11474 | case-fold-search) | ||
| 11443 | (when (equal arg '(64)) | 11475 | (when (equal arg '(64)) |
| 11444 | (setq arg nil org-blocker-hook nil)) | 11476 | (setq arg nil org-blocker-hook nil)) |
| 11445 | (when (and org-blocker-hook | 11477 | (when (and org-blocker-hook |
| @@ -11449,6 +11481,9 @@ For calling through lisp, arg is also interpreted in the following way: | |||
| 11449 | (save-excursion | 11481 | (save-excursion |
| 11450 | (catch 'exit | 11482 | (catch 'exit |
| 11451 | (org-back-to-heading t) | 11483 | (org-back-to-heading t) |
| 11484 | (when (looking-at (concat "^\\*+ " org-comment-string)) | ||
| 11485 | (org-toggle-comment) | ||
| 11486 | (setq commentp t)) | ||
| 11452 | (if (looking-at org-outline-regexp) (goto-char (1- (match-end 0)))) | 11487 | (if (looking-at org-outline-regexp) (goto-char (1- (match-end 0)))) |
| 11453 | (or (looking-at (concat " +" org-todo-regexp "\\( +\\|[ \t]*$\\)")) | 11488 | (or (looking-at (concat " +" org-todo-regexp "\\( +\\|[ \t]*$\\)")) |
| 11454 | (looking-at "\\(?: *\\|[ \t]*$\\)")) | 11489 | (looking-at "\\(?: *\\|[ \t]*$\\)")) |
| @@ -11624,7 +11659,8 @@ For calling through lisp, arg is also interpreted in the following way: | |||
| 11624 | (and (looking-at " ") (just-one-space)))) | 11659 | (and (looking-at " ") (just-one-space)))) |
| 11625 | (when org-trigger-hook | 11660 | (when org-trigger-hook |
| 11626 | (save-excursion | 11661 | (save-excursion |
| 11627 | (run-hook-with-args 'org-trigger-hook change-plist))))))))) | 11662 | (run-hook-with-args 'org-trigger-hook change-plist))) |
| 11663 | (when commentp (org-toggle-comment)))))))) | ||
| 11628 | 11664 | ||
| 11629 | (defun org-block-todo-from-children-or-siblings-or-parent (change-plist) | 11665 | (defun org-block-todo-from-children-or-siblings-or-parent (change-plist) |
| 11630 | "Block turning an entry into a TODO, using the hierarchy. | 11666 | "Block turning an entry into a TODO, using the hierarchy. |
| @@ -11765,15 +11801,16 @@ changes because there are unchecked boxes in this entry." | |||
| 11765 | 11801 | ||
| 11766 | (defun org-entry-blocked-p () | 11802 | (defun org-entry-blocked-p () |
| 11767 | "Is the current entry blocked?" | 11803 | "Is the current entry blocked?" |
| 11768 | (if (org-entry-get nil "NOBLOCKING") | 11804 | (org-with-buffer-modified-unmodified |
| 11769 | nil ;; Never block this entry | 11805 | (if (org-entry-get nil "NOBLOCKING") |
| 11770 | (not | 11806 | nil ;; Never block this entry |
| 11771 | (run-hook-with-args-until-failure | 11807 | (not |
| 11772 | 'org-blocker-hook | 11808 | (run-hook-with-args-until-failure |
| 11773 | (list :type 'todo-state-change | 11809 | 'org-blocker-hook |
| 11774 | :position (point) | 11810 | (list :type 'todo-state-change |
| 11775 | :from 'todo | 11811 | :position (point) |
| 11776 | :to 'done))))) | 11812 | :from 'todo |
| 11813 | :to 'done)))))) | ||
| 11777 | 11814 | ||
| 11778 | (defun org-update-statistics-cookies (all) | 11815 | (defun org-update-statistics-cookies (all) |
| 11779 | "Update the statistics cookie, either from TODO or from checkboxes. | 11816 | "Update the statistics cookie, either from TODO or from checkboxes. |
| @@ -11785,7 +11822,7 @@ This should be called with the cursor in a line with a statistics cookie." | |||
| 11785 | (org-map-entries 'org-update-parent-todo-statistics)) | 11822 | (org-map-entries 'org-update-parent-todo-statistics)) |
| 11786 | (if (not (org-at-heading-p)) | 11823 | (if (not (org-at-heading-p)) |
| 11787 | (org-update-checkbox-count) | 11824 | (org-update-checkbox-count) |
| 11788 | (let ((pos (move-marker (make-marker) (point))) | 11825 | (let ((pos (point-marker)) |
| 11789 | end l1 l2) | 11826 | end l1 l2) |
| 11790 | (ignore-errors (org-back-to-heading t)) | 11827 | (ignore-errors (org-back-to-heading t)) |
| 11791 | (if (not (org-at-heading-p)) | 11828 | (if (not (org-at-heading-p)) |
| @@ -12666,7 +12703,7 @@ D Show deadlines and scheduled items between a date range." | |||
| 12666 | (let (ans kwd value ts-type) | 12703 | (let (ans kwd value ts-type) |
| 12667 | (setq type (or type org-sparse-tree-default-date-type)) | 12704 | (setq type (or type org-sparse-tree-default-date-type)) |
| 12668 | (setq org-ts-type type) | 12705 | (setq org-ts-type type) |
| 12669 | (message "Sparse tree: [r]egexp [/]regexp [t]odo [T]odo-kwd [m]atch [p]roperty\n [d]eadlines [b]efore-date [a]fter-date [D]ates range\n [c]ycle through date types: %s" | 12706 | (message "Sparse tree: [/]regexp [t]odo [T]odo-kwd [m]atch [p]roperty\n [d]eadlines [b]efore-date [a]fter-date [D]ates range\n [c]ycle through date types: %s" |
| 12670 | (cond ((eq type 'all) "all timestamps") | 12707 | (cond ((eq type 'all) "all timestamps") |
| 12671 | ((eq type 'scheduled) "only scheduled") | 12708 | ((eq type 'scheduled) "only scheduled") |
| 12672 | ((eq type 'deadline) "only deadline") | 12709 | ((eq type 'deadline) "only deadline") |
| @@ -12981,9 +13018,9 @@ and by additional input from the age of a schedules or deadline entry." | |||
| 12981 | 13018 | ||
| 12982 | (defun org-get-priority (s) | 13019 | (defun org-get-priority (s) |
| 12983 | "Find priority cookie and return priority." | 13020 | "Find priority cookie and return priority." |
| 12984 | (if (functionp org-get-priority-function) | 13021 | (save-match-data |
| 12985 | (funcall org-get-priority-function) | 13022 | (if (functionp org-get-priority-function) |
| 12986 | (save-match-data | 13023 | (funcall org-get-priority-function) |
| 12987 | (if (not (string-match org-priority-regexp s)) | 13024 | (if (not (string-match org-priority-regexp s)) |
| 12988 | (* 1000 (- org-lowest-priority org-default-priority)) | 13025 | (* 1000 (- org-lowest-priority org-default-priority)) |
| 12989 | (* 1000 (- org-lowest-priority | 13026 | (* 1000 (- org-lowest-priority |
| @@ -13113,18 +13150,9 @@ headlines matching this string." | |||
| 13113 | (or (not todo-only) | 13150 | (or (not todo-only) |
| 13114 | (and (member todo org-not-done-keywords) | 13151 | (and (member todo org-not-done-keywords) |
| 13115 | (or (not org-agenda-tags-todo-honor-ignore-options) | 13152 | (or (not org-agenda-tags-todo-honor-ignore-options) |
| 13116 | (not (org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item))))) | 13153 | (not (org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item)))))) |
| 13117 | |||
| 13118 | ;; Extra check for the archive tag | ||
| 13119 | ;; FIXME: Does the skipper already do this???? | ||
| 13120 | (or | ||
| 13121 | (not (member org-archive-tag tags-list)) | ||
| 13122 | ;; we have an archive tag, should we use this anyway? | ||
| 13123 | (or (not org-agenda-skip-archived-trees) | ||
| 13124 | (and (eq action 'agenda) org-agenda-archives-mode)))) | ||
| 13125 | 13154 | ||
| 13126 | ;; select this headline | 13155 | ;; select this headline |
| 13127 | |||
| 13128 | (cond | 13156 | (cond |
| 13129 | ((eq action 'sparse-tree) | 13157 | ((eq action 'sparse-tree) |
| 13130 | (and org-highlight-sparse-tree-matches | 13158 | (and org-highlight-sparse-tree-matches |
| @@ -14276,6 +14304,9 @@ When INCREMENT is non-nil, set the property to the next allowed value." | |||
| 14276 | existing nil nil "" nil cur)))))) | 14304 | existing nil nil "" nil cur)))))) |
| 14277 | (unless (equal (org-entry-get nil prop) val) | 14305 | (unless (equal (org-entry-get nil prop) val) |
| 14278 | (org-entry-put nil prop val)) | 14306 | (org-entry-put nil prop val)) |
| 14307 | (save-excursion | ||
| 14308 | (org-back-to-heading t) | ||
| 14309 | (put-text-property (point-at-bol) (point-at-eol) 'org-effort val)) | ||
| 14279 | (message "%s is now %s" prop val))) | 14310 | (message "%s is now %s" prop val))) |
| 14280 | 14311 | ||
| 14281 | (defun org-at-property-p () | 14312 | (defun org-at-property-p () |
| @@ -14454,26 +14485,27 @@ when a \"nil\" value can supersede a non-nil value higher up the hierarchy." | |||
| 14454 | ;; We need a special property. Use `org-entry-properties' to | 14485 | ;; We need a special property. Use `org-entry-properties' to |
| 14455 | ;; retrieve it, but specify the wanted property | 14486 | ;; retrieve it, but specify the wanted property |
| 14456 | (cdr (assoc property (org-entry-properties nil 'special property))) | 14487 | (cdr (assoc property (org-entry-properties nil 'special property))) |
| 14457 | (let* ((range (org-get-property-block)) | 14488 | (let ((range (org-get-property-block))) |
| 14458 | (props (list (or (assoc property org-file-properties) | 14489 | (when (and range (not (eq (car range) (cdr range)))) |
| 14459 | (assoc property org-global-properties) | 14490 | (let* ((props (list (or (assoc property org-file-properties) |
| 14460 | (assoc property org-global-properties-fixed)))) | 14491 | (assoc property org-global-properties) |
| 14461 | (ap (lambda (key) | 14492 | (assoc property org-global-properties-fixed)))) |
| 14462 | (when (re-search-forward | 14493 | (ap (lambda (key) |
| 14463 | (org-re-property key) (cdr range) t) | 14494 | (when (re-search-forward |
| 14464 | (setq props | 14495 | (org-re-property key) (cdr range) t) |
| 14465 | (org-update-property-plist | 14496 | (setq props |
| 14466 | key | 14497 | (org-update-property-plist |
| 14467 | (if (match-end 1) | 14498 | key |
| 14468 | (org-match-string-no-properties 1) "") | 14499 | (if (match-end 1) |
| 14469 | props))))) | 14500 | (org-match-string-no-properties 1) "") |
| 14470 | val) | 14501 | props))))) |
| 14471 | (when (and range (goto-char (car range))) | 14502 | val) |
| 14472 | (funcall ap property) | 14503 | (goto-char (car range)) |
| 14473 | (goto-char (car range)) | 14504 | (funcall ap property) |
| 14474 | (while (funcall ap (concat property "+"))) | 14505 | (goto-char (car range)) |
| 14475 | (setq val (cdr (assoc property props))) | 14506 | (while (funcall ap (concat property "+"))) |
| 14476 | (when val (if literal-nil val (org-not-nil val))))))))) | 14507 | (setq val (cdr (assoc property props))) |
| 14508 | (when val (if literal-nil val (org-not-nil val)))))))))) | ||
| 14477 | 14509 | ||
| 14478 | (defun org-property-or-variable-value (var &optional inherit) | 14510 | (defun org-property-or-variable-value (var &optional inherit) |
| 14479 | "Check if there is a property fixing the value of VAR. | 14511 | "Check if there is a property fixing the value of VAR. |
| @@ -14996,7 +15028,8 @@ completion." | |||
| 14996 | (interactive) | 15028 | (interactive) |
| 14997 | (unless (org-at-property-p) | 15029 | (unless (org-at-property-p) |
| 14998 | (error "Not at a property")) | 15030 | (error "Not at a property")) |
| 14999 | (let* ((key (match-string 2)) | 15031 | (let* ((prop (car (save-match-data (org-split-string (match-string 1) ":")))) |
| 15032 | (key (match-string 2)) | ||
| 15000 | (value (match-string 3)) | 15033 | (value (match-string 3)) |
| 15001 | (allowed (or (org-property-get-allowed-values (point) key) | 15034 | (allowed (or (org-property-get-allowed-values (point) key) |
| 15002 | (and (member value '("[ ]" "[-]" "[X]")) | 15035 | (and (member value '("[ ]" "[-]" "[X]")) |
| @@ -15015,6 +15048,10 @@ completion." | |||
| 15015 | (org-indent-line) | 15048 | (org-indent-line) |
| 15016 | (beginning-of-line 1) | 15049 | (beginning-of-line 1) |
| 15017 | (skip-chars-forward " \t") | 15050 | (skip-chars-forward " \t") |
| 15051 | (when (equal prop org-effort-property) | ||
| 15052 | (save-excursion | ||
| 15053 | (org-back-to-heading t) | ||
| 15054 | (put-text-property (point-at-bol) (point-at-eol) 'org-effort nval))) | ||
| 15018 | (run-hook-with-args 'org-property-changed-functions key nval))) | 15055 | (run-hook-with-args 'org-property-changed-functions key nval))) |
| 15019 | 15056 | ||
| 15020 | (defun org-find-olp (path &optional this-buffer) | 15057 | (defun org-find-olp (path &optional this-buffer) |
| @@ -15060,7 +15097,7 @@ only headings." | |||
| 15060 | (setq lmin (1+ flevel) lmax (+ lmin (if org-odd-levels-only 1 0))) | 15097 | (setq lmin (1+ flevel) lmax (+ lmin (if org-odd-levels-only 1 0))) |
| 15061 | (setq end (save-excursion (org-end-of-subtree t t)))) | 15098 | (setq end (save-excursion (org-end-of-subtree t t)))) |
| 15062 | (when (org-at-heading-p) | 15099 | (when (org-at-heading-p) |
| 15063 | (move-marker (make-marker) (point)))))))) | 15100 | (point-marker))))))) |
| 15064 | 15101 | ||
| 15065 | (defun org-find-exact-headline-in-buffer (heading &optional buffer pos-only) | 15102 | (defun org-find-exact-headline-in-buffer (heading &optional buffer pos-only) |
| 15066 | "Find node HEADING in BUFFER. | 15103 | "Find node HEADING in BUFFER. |
| @@ -15307,6 +15344,7 @@ user." | |||
| 15307 | (setcar (nthcdr 1 org-defdecode) 59) | 15344 | (setcar (nthcdr 1 org-defdecode) 59) |
| 15308 | (setq org-def (apply 'encode-time org-defdecode) | 15345 | (setq org-def (apply 'encode-time org-defdecode) |
| 15309 | org-defdecode (decode-time org-def))))) | 15346 | org-defdecode (decode-time org-def))))) |
| 15347 | (mouse-autoselect-window nil) ; Don't let the mouse jump | ||
| 15310 | (calendar-frame-setup nil) | 15348 | (calendar-frame-setup nil) |
| 15311 | (calendar-setup nil) | 15349 | (calendar-setup nil) |
| 15312 | (calendar-move-hook nil) | 15350 | (calendar-move-hook nil) |
| @@ -16966,6 +17004,8 @@ When a buffer is unmodified, it is just killed. When modified, it is saved | |||
| 16966 | (widen) | 17004 | (widen) |
| 16967 | (setq bmp (buffer-modified-p)) | 17005 | (setq bmp (buffer-modified-p)) |
| 16968 | (org-refresh-category-properties) | 17006 | (org-refresh-category-properties) |
| 17007 | (org-refresh-properties org-effort-property 'org-effort) | ||
| 17008 | (org-refresh-properties "APPT_WARNTIME" 'org-appt-warntime) | ||
| 16969 | (setq org-todo-keywords-for-agenda | 17009 | (setq org-todo-keywords-for-agenda |
| 16970 | (append org-todo-keywords-for-agenda org-todo-keywords-1)) | 17010 | (append org-todo-keywords-for-agenda org-todo-keywords-1)) |
| 16971 | (setq org-done-keywords-for-agenda | 17011 | (setq org-done-keywords-for-agenda |
| @@ -17758,7 +17798,7 @@ BEG and END default to the buffer boundaries." | |||
| 17758 | (list 'org-display-inline-remove-overlay)) | 17798 | (list 'org-display-inline-remove-overlay)) |
| 17759 | (push ov org-inline-image-overlays))))))))) | 17799 | (push ov org-inline-image-overlays))))))))) |
| 17760 | 17800 | ||
| 17761 | (define-obsolete-function-alias | 17801 | (org-define-obsolete-function-alias |
| 17762 | 'org-display-inline-modification-hook 'org-display-inline-remove-overlay "24.3") | 17802 | 'org-display-inline-modification-hook 'org-display-inline-remove-overlay "24.3") |
| 17763 | 17803 | ||
| 17764 | (defun org-display-inline-remove-overlay (ov after beg end &optional len) | 17804 | (defun org-display-inline-remove-overlay (ov after beg end &optional len) |
| @@ -18053,7 +18093,7 @@ BEG and END default to the buffer boundaries." | |||
| 18053 | ("c" . org-cycle) | 18093 | ("c" . org-cycle) |
| 18054 | ("C" . org-shifttab) | 18094 | ("C" . org-shifttab) |
| 18055 | (" " . org-display-outline-path) | 18095 | (" " . org-display-outline-path) |
| 18056 | (":" . org-columns) | 18096 | ("=" . org-columns) |
| 18057 | ("Outline Structure Editing") | 18097 | ("Outline Structure Editing") |
| 18058 | ("U" . org-shiftmetaup) | 18098 | ("U" . org-shiftmetaup) |
| 18059 | ("D" . org-shiftmetadown) | 18099 | ("D" . org-shiftmetadown) |
| @@ -18078,7 +18118,7 @@ BEG and END default to the buffer boundaries." | |||
| 18078 | ("1" . (org-priority ?A)) | 18118 | ("1" . (org-priority ?A)) |
| 18079 | ("2" . (org-priority ?B)) | 18119 | ("2" . (org-priority ?B)) |
| 18080 | ("3" . (org-priority ?C)) | 18120 | ("3" . (org-priority ?C)) |
| 18081 | (";" . org-set-tags-command) | 18121 | (":" . org-set-tags-command) |
| 18082 | ("e" . org-set-effort) | 18122 | ("e" . org-set-effort) |
| 18083 | ("E" . org-inc-effort) | 18123 | ("E" . org-inc-effort) |
| 18084 | ("W" . (lambda(m) (interactive "sMinutes before warning: ") | 18124 | ("W" . (lambda(m) (interactive "sMinutes before warning: ") |
| @@ -18138,7 +18178,7 @@ If not, return to the original position and throw an error." | |||
| 18138 | (defvar org-table-auto-blank-field) ; defined in org-table.el | 18178 | (defvar org-table-auto-blank-field) ; defined in org-table.el |
| 18139 | (defvar org-speed-command nil) | 18179 | (defvar org-speed-command nil) |
| 18140 | 18180 | ||
| 18141 | (define-obsolete-function-alias | 18181 | (org-define-obsolete-function-alias |
| 18142 | 'org-speed-command-default-hook 'org-speed-command-activate "24.3") | 18182 | 'org-speed-command-default-hook 'org-speed-command-activate "24.3") |
| 18143 | 18183 | ||
| 18144 | (defun org-speed-command-activate (keys) | 18184 | (defun org-speed-command-activate (keys) |
| @@ -18151,7 +18191,7 @@ Use `org-speed-commands-user' for further customization." | |||
| 18151 | (cdr (assoc keys (append org-speed-commands-user | 18191 | (cdr (assoc keys (append org-speed-commands-user |
| 18152 | org-speed-commands-default))))) | 18192 | org-speed-commands-default))))) |
| 18153 | 18193 | ||
| 18154 | (define-obsolete-function-alias | 18194 | (org-define-obsolete-function-alias |
| 18155 | 'org-babel-speed-command-hook 'org-babel-speed-command-activate "24.3") | 18195 | 'org-babel-speed-command-hook 'org-babel-speed-command-activate "24.3") |
| 18156 | 18196 | ||
| 18157 | (defun org-babel-speed-command-activate (keys) | 18197 | (defun org-babel-speed-command-activate (keys) |
| @@ -18296,25 +18336,26 @@ front of the next \"|\" separator, to keep the table aligned. The table will | |||
| 18296 | still be marked for re-alignment if the field did fill the entire column, | 18336 | still be marked for re-alignment if the field did fill the entire column, |
| 18297 | because, in this case the deletion might narrow the column." | 18337 | because, in this case the deletion might narrow the column." |
| 18298 | (interactive "p") | 18338 | (interactive "p") |
| 18299 | (org-check-before-invisible-edit 'delete-backward) | 18339 | (save-match-data |
| 18300 | (if (and (org-table-p) | 18340 | (org-check-before-invisible-edit 'delete-backward) |
| 18301 | (eq N 1) | 18341 | (if (and (org-table-p) |
| 18302 | (string-match "|" (buffer-substring (point-at-bol) (point))) | 18342 | (eq N 1) |
| 18303 | (looking-at ".*?|")) | 18343 | (string-match "|" (buffer-substring (point-at-bol) (point))) |
| 18304 | (let ((pos (point)) | 18344 | (looking-at ".*?|")) |
| 18305 | (noalign (looking-at "[^|\n\r]* |")) | 18345 | (let ((pos (point)) |
| 18306 | (c org-table-may-need-update)) | 18346 | (noalign (looking-at "[^|\n\r]* |")) |
| 18307 | (backward-delete-char N) | 18347 | (c org-table-may-need-update)) |
| 18308 | (if (not overwrite-mode) | 18348 | (backward-delete-char N) |
| 18309 | (progn | 18349 | (if (not overwrite-mode) |
| 18310 | (skip-chars-forward "^|") | 18350 | (progn |
| 18311 | (insert " ") | 18351 | (skip-chars-forward "^|") |
| 18312 | (goto-char (1- pos)))) | 18352 | (insert " ") |
| 18313 | ;; noalign: if there were two spaces at the end, this field | 18353 | (goto-char (1- pos)))) |
| 18314 | ;; does not determine the width of the column. | 18354 | ;; noalign: if there were two spaces at the end, this field |
| 18315 | (if noalign (setq org-table-may-need-update c))) | 18355 | ;; does not determine the width of the column. |
| 18316 | (backward-delete-char N) | 18356 | (if noalign (setq org-table-may-need-update c))) |
| 18317 | (org-fix-tags-on-the-fly))) | 18357 | (backward-delete-char N) |
| 18358 | (org-fix-tags-on-the-fly)))) | ||
| 18318 | 18359 | ||
| 18319 | (defun org-delete-char (N) | 18360 | (defun org-delete-char (N) |
| 18320 | "Like `delete-char', but insert whitespace at field end in tables. | 18361 | "Like `delete-char', but insert whitespace at field end in tables. |
| @@ -18323,25 +18364,26 @@ front of the next \"|\" separator, to keep the table aligned. The table will | |||
| 18323 | still be marked for re-alignment if the field did fill the entire column, | 18364 | still be marked for re-alignment if the field did fill the entire column, |
| 18324 | because, in this case the deletion might narrow the column." | 18365 | because, in this case the deletion might narrow the column." |
| 18325 | (interactive "p") | 18366 | (interactive "p") |
| 18326 | (org-check-before-invisible-edit 'delete) | 18367 | (save-match-data |
| 18327 | (if (and (org-table-p) | 18368 | (org-check-before-invisible-edit 'delete) |
| 18328 | (not (bolp)) | 18369 | (if (and (org-table-p) |
| 18329 | (not (= (char-after) ?|)) | 18370 | (not (bolp)) |
| 18330 | (eq N 1)) | 18371 | (not (= (char-after) ?|)) |
| 18331 | (if (looking-at ".*?|") | 18372 | (eq N 1)) |
| 18332 | (let ((pos (point)) | 18373 | (if (looking-at ".*?|") |
| 18333 | (noalign (looking-at "[^|\n\r]* |")) | 18374 | (let ((pos (point)) |
| 18334 | (c org-table-may-need-update)) | 18375 | (noalign (looking-at "[^|\n\r]* |")) |
| 18335 | (replace-match (concat | 18376 | (c org-table-may-need-update)) |
| 18336 | (substring (match-string 0) 1 -1) | 18377 | (replace-match (concat |
| 18337 | " |")) | 18378 | (substring (match-string 0) 1 -1) |
| 18338 | (goto-char pos) | 18379 | " |")) |
| 18339 | ;; noalign: if there were two spaces at the end, this field | 18380 | (goto-char pos) |
| 18340 | ;; does not determine the width of the column. | 18381 | ;; noalign: if there were two spaces at the end, this field |
| 18341 | (if noalign (setq org-table-may-need-update c))) | 18382 | ;; does not determine the width of the column. |
| 18342 | (delete-char N)) | 18383 | (if noalign (setq org-table-may-need-update c))) |
| 18343 | (delete-char N) | 18384 | (delete-char N)) |
| 18344 | (org-fix-tags-on-the-fly))) | 18385 | (delete-char N) |
| 18386 | (org-fix-tags-on-the-fly)))) | ||
| 18345 | 18387 | ||
| 18346 | ;; Make `delete-selection-mode' work with org-mode and orgtbl-mode | 18388 | ;; Make `delete-selection-mode' work with org-mode and orgtbl-mode |
| 18347 | (put 'org-self-insert-command 'delete-selection t) | 18389 | (put 'org-self-insert-command 'delete-selection t) |
| @@ -18956,15 +18998,22 @@ See the individual commands for more information." | |||
| 18956 | (org-table-paste-rectangle) | 18998 | (org-table-paste-rectangle) |
| 18957 | (org-paste-subtree arg))) | 18999 | (org-paste-subtree arg))) |
| 18958 | 19000 | ||
| 19001 | (defsubst org-in-fixed-width-region-p () | ||
| 19002 | "Is point in a fixed-width region?" | ||
| 19003 | (save-match-data | ||
| 19004 | (eq 'fixed-width (org-element-type (org-element-at-point))))) | ||
| 19005 | |||
| 18959 | (defun org-edit-special (&optional arg) | 19006 | (defun org-edit-special (&optional arg) |
| 18960 | "Call a special editor for the stuff at point. | 19007 | "Call a special editor for the stuff at point. |
| 18961 | When at a table, call the formula editor with `org-table-edit-formulas'. | 19008 | When at a table, call the formula editor with `org-table-edit-formulas'. |
| 18962 | When at the first line of an src example, call `org-edit-src-code'. | 19009 | When in a source code block, call `org-edit-src-code'. |
| 18963 | When in an #+include line, visit the include file. Otherwise call | 19010 | When in a fixed-width region, call `org-edit-fixed-width-region'. |
| 18964 | `ffap' to visit the file at point." | 19011 | When in an #+include line, visit the included file. |
| 19012 | On a link, call `ffap' to visit the link at point. | ||
| 19013 | Otherwise, return a user error." | ||
| 18965 | (interactive) | 19014 | (interactive) |
| 18966 | ;; possibly prep session before editing source | 19015 | ;; possibly prep session before editing source |
| 18967 | (when arg | 19016 | (when (and (org-in-src-block-p) arg) |
| 18968 | (let* ((info (org-babel-get-src-block-info)) | 19017 | (let* ((info (org-babel-get-src-block-info)) |
| 18969 | (lang (nth 0 info)) | 19018 | (lang (nth 0 info)) |
| 18970 | (params (nth 2 info)) | 19019 | (params (nth 2 info)) |
| @@ -18977,16 +19026,17 @@ When in an #+include line, visit the include file. Otherwise call | |||
| 18977 | (beginning-of-line 1) | 19026 | (beginning-of-line 1) |
| 18978 | (looking-at "\\(?:#\\+\\(?:setupfile\\|include\\):?[ \t]+\"?\\|[ \t]*<include\\>.*?file=\"\\)\\([^\"\n>]+\\)")) | 19027 | (looking-at "\\(?:#\\+\\(?:setupfile\\|include\\):?[ \t]+\"?\\|[ \t]*<include\\>.*?file=\"\\)\\([^\"\n>]+\\)")) |
| 18979 | (find-file (org-trim (match-string 1)))) | 19028 | (find-file (org-trim (match-string 1)))) |
| 18980 | ((org-edit-src-code)) | ||
| 18981 | ((org-edit-fixed-width-region)) | ||
| 18982 | ((org-at-table.el-p) | ||
| 18983 | (org-edit-src-code)) | ||
| 18984 | ((or (org-at-table-p) | 19029 | ((or (org-at-table-p) |
| 18985 | (save-excursion | 19030 | (save-excursion |
| 18986 | (beginning-of-line 1) | 19031 | (beginning-of-line 1) |
| 18987 | (let ((case-fold-search )) (looking-at "[ \t]*#\\+tblfm:")))) | 19032 | (let ((case-fold-search )) (looking-at "[ \t]*#\\+tblfm:")))) |
| 18988 | (call-interactively 'org-table-edit-formulas)) | 19033 | (call-interactively 'org-table-edit-formulas)) |
| 18989 | (t (call-interactively 'ffap)))) | 19034 | ((or (org-in-block-p '("src" "example" "latex" "html")) |
| 19035 | (org-at-table.el-p)) | ||
| 19036 | (org-edit-src-code)) | ||
| 19037 | ((org-in-fixed-width-region-p) (org-edit-fixed-width-region)) | ||
| 19038 | ((org-at-regexp-p org-any-link-re) (call-interactively 'ffap)) | ||
| 19039 | (t (user-error "No special environment to edit here")))) | ||
| 18990 | 19040 | ||
| 18991 | (defvar org-table-coordinate-overlays) ; defined in org-table.el | 19041 | (defvar org-table-coordinate-overlays) ; defined in org-table.el |
| 18992 | (defun org-ctrl-c-ctrl-c (&optional arg) | 19042 | (defun org-ctrl-c-ctrl-c (&optional arg) |
| @@ -19103,8 +19153,10 @@ This command does many different things, depending on context: | |||
| 19103 | (org-list-struct-fix-ind struct parents) | 19153 | (org-list-struct-fix-ind struct parents) |
| 19104 | (setq block-item | 19154 | (setq block-item |
| 19105 | (org-list-struct-fix-box struct parents prevs orderedp))) | 19155 | (org-list-struct-fix-box struct parents prevs orderedp))) |
| 19106 | (org-list-struct-apply-struct struct old-struct) | 19156 | (if (equal struct old-struct) |
| 19107 | (org-update-checkbox-count-maybe) | 19157 | (user-error "Cannot toggle this checkbox (unchecked subitems?)") |
| 19158 | (org-list-struct-apply-struct struct old-struct) | ||
| 19159 | (org-update-checkbox-count-maybe)) | ||
| 19108 | (when block-item | 19160 | (when block-item |
| 19109 | (message | 19161 | (message |
| 19110 | "Checkboxes were removed due to unchecked box at line %d" | 19162 | "Checkboxes were removed due to unchecked box at line %d" |
| @@ -20238,13 +20290,19 @@ and end of string." | |||
| 20238 | "Is S an ID created by UUIDGEN?" | 20290 | "Is S an ID created by UUIDGEN?" |
| 20239 | (string-match "\\`[0-9a-f]\\{8\\}-[0-9a-f]\\{4\\}-[0-9a-f]\\{4\\}-[0-9a-f]\\{4\\}-[0-9a-f]\\{12\\}\\'" (downcase s))) | 20291 | (string-match "\\`[0-9a-f]\\{8\\}-[0-9a-f]\\{4\\}-[0-9a-f]\\{4\\}-[0-9a-f]\\{4\\}-[0-9a-f]\\{12\\}\\'" (downcase s))) |
| 20240 | 20292 | ||
| 20241 | (defun org-in-src-block-p nil | 20293 | (defun org-in-src-block-p (&optional inside) |
| 20242 | "Whether point is in a code source block." | 20294 | "Whether point is in a code source block. |
| 20243 | (let (ov) | 20295 | When INSIDE is non-nil, don't consider we are within a src block |
| 20244 | (when (setq ov (overlays-at (point))) | 20296 | when point is at #+BEGIN_SRC or #+END_SRC." |
| 20245 | (memq 'org-block-background | 20297 | (let ((case-fold-search t) ov) |
| 20246 | (overlay-properties | 20298 | (or (and (setq ov (overlays-at (point))) |
| 20247 | (car ov)))))) | 20299 | (memq 'org-block-background |
| 20300 | (overlay-properties (car ov)))) | ||
| 20301 | (and (not inside) | ||
| 20302 | (save-match-data | ||
| 20303 | (save-excursion | ||
| 20304 | (beginning-of-line) | ||
| 20305 | (looking-at ".*#\\+\\(begin\\|end\\)_src"))))))) | ||
| 20248 | 20306 | ||
| 20249 | (defun org-context () | 20307 | (defun org-context () |
| 20250 | "Return a list of contexts of the current cursor position. | 20308 | "Return a list of contexts of the current cursor position. |
| @@ -20587,9 +20645,8 @@ return nil." | |||
| 20587 | "Switch to buffer in a second window on the current frame. | 20645 | "Switch to buffer in a second window on the current frame. |
| 20588 | In particular, do not allow pop-up frames. | 20646 | In particular, do not allow pop-up frames. |
| 20589 | Returns the newly created buffer." | 20647 | Returns the newly created buffer." |
| 20590 | (let (pop-up-frames special-display-buffer-names special-display-regexps | 20648 | (org-no-popups |
| 20591 | special-display-function) | 20649 | (apply 'switch-to-buffer-other-window args))) |
| 20592 | (apply 'switch-to-buffer-other-window args))) | ||
| 20593 | 20650 | ||
| 20594 | (defun org-combine-plists (&rest plists) | 20651 | (defun org-combine-plists (&rest plists) |
| 20595 | "Create a single property list from all plists in PLISTS. | 20652 | "Create a single property list from all plists in PLISTS. |
| @@ -20768,6 +20825,7 @@ hierarchy of headlines by UP levels before marking the subtree." | |||
| 20768 | (t | 20825 | (t |
| 20769 | (beginning-of-line 0) | 20826 | (beginning-of-line 0) |
| 20770 | (while (and (not (bobp)) | 20827 | (while (and (not (bobp)) |
| 20828 | (not (looking-at org-table-line-regexp)) | ||
| 20771 | (not (looking-at org-drawer-regexp)) | 20829 | (not (looking-at org-drawer-regexp)) |
| 20772 | ;; When point started in an inline task, do not move | 20830 | ;; When point started in an inline task, do not move |
| 20773 | ;; above task starting line. | 20831 | ;; above task starting line. |
| @@ -20898,6 +20956,7 @@ hierarchy of headlines by UP levels before marking the subtree." | |||
| 20898 | '(org-fill-paragraph-separate-nobreak-p | 20956 | '(org-fill-paragraph-separate-nobreak-p |
| 20899 | org-fill-line-break-nobreak-p))))) | 20957 | org-fill-line-break-nobreak-p))))) |
| 20900 | (org-set-local 'fill-paragraph-function 'org-fill-paragraph) | 20958 | (org-set-local 'fill-paragraph-function 'org-fill-paragraph) |
| 20959 | (org-set-local 'auto-fill-inhibit-regexp nil) | ||
| 20901 | (org-set-local 'adaptive-fill-function 'org-adaptive-fill-function) | 20960 | (org-set-local 'adaptive-fill-function 'org-adaptive-fill-function) |
| 20902 | (org-set-local 'normal-auto-fill-function 'org-auto-fill-function) | 20961 | (org-set-local 'normal-auto-fill-function 'org-auto-fill-function) |
| 20903 | (org-set-local 'comment-line-break-function 'org-comment-line-break-function)) | 20962 | (org-set-local 'comment-line-break-function 'org-comment-line-break-function)) |
| @@ -20920,48 +20979,54 @@ hierarchy of headlines by UP levels before marking the subtree." | |||
| 20920 | "Compute a fill prefix for the current line. | 20979 | "Compute a fill prefix for the current line. |
| 20921 | Return fill prefix, as a string, or nil if current line isn't | 20980 | Return fill prefix, as a string, or nil if current line isn't |
| 20922 | meant to be filled." | 20981 | meant to be filled." |
| 20923 | (org-with-wide-buffer | 20982 | (let (prefix) |
| 20924 | (unless (and (derived-mode-p 'message-mode) (not (message-in-body-p))) | 20983 | (when (and (derived-mode-p 'message-mode) (message-in-body-p)) |
| 20925 | ;; FIXME: This is really the job of orgstruct++-mode | 20984 | (save-excursion |
| 20926 | (let* ((p (line-beginning-position)) | 20985 | (beginning-of-line) |
| 20927 | (element (save-excursion (beginning-of-line) | 20986 | (cond ((looking-at message-cite-prefix-regexp) |
| 20928 | (org-element-at-point))) | 20987 | (setq prefix (match-string-no-properties 0))) |
| 20929 | (type (org-element-type element)) | 20988 | ((looking-at org-outline-regexp) |
| 20930 | (post-affiliated | 20989 | (setq prefix ""))))) |
| 20931 | (save-excursion | 20990 | (or prefix |
| 20932 | (goto-char (org-element-property :begin element)) | 20991 | (org-with-wide-buffer |
| 20933 | (while (looking-at org-element--affiliated-re) (forward-line)) | 20992 | (let* ((p (line-beginning-position)) |
| 20934 | (point)))) | 20993 | (element (save-excursion (beginning-of-line) (org-element-at-point))) |
| 20935 | (unless (< p post-affiliated) | 20994 | (type (org-element-type element)) |
| 20936 | (case type | 20995 | (post-affiliated |
| 20937 | (comment (looking-at "[ \t]*# ?") (match-string 0)) | 20996 | (save-excursion |
| 20938 | (footnote-definition "") | 20997 | (goto-char (org-element-property :begin element)) |
| 20939 | ((item plain-list) | 20998 | (while (looking-at org-element--affiliated-re) (forward-line)) |
| 20940 | (make-string (org-list-item-body-column post-affiliated) ? )) | 20999 | (point)))) |
| 20941 | (paragraph | 21000 | (unless (< p post-affiliated) |
| 20942 | ;; Fill prefix is usually the same as the current line, | 21001 | (case type |
| 20943 | ;; except if the paragraph is at the beginning of an item. | 21002 | (comment (looking-at "[ \t]*# ?") (match-string 0)) |
| 20944 | (let ((parent (org-element-property :parent element))) | 21003 | (footnote-definition "") |
| 20945 | (cond ((eq (org-element-type parent) 'item) | 21004 | ((item plain-list) |
| 20946 | (make-string (org-list-item-body-column | 21005 | (make-string (org-list-item-body-column post-affiliated) ? )) |
| 20947 | (org-element-property :begin parent)) | 21006 | (paragraph |
| 20948 | ? )) | 21007 | ;; Fill prefix is usually the same as the current line, |
| 20949 | ((save-excursion (beginning-of-line) (looking-at "[ \t]+")) | 21008 | ;; except if the paragraph is at the beginning of an item. |
| 20950 | (match-string 0)) | 21009 | (let ((parent (org-element-property :parent element))) |
| 20951 | (t "")))) | 21010 | (cond ((eq (org-element-type parent) 'item) |
| 20952 | (comment-block | 21011 | (make-string (org-list-item-body-column |
| 20953 | ;; Only fill contents if P is within block boundaries. | 21012 | (org-element-property :begin parent)) |
| 20954 | (let* ((cbeg (save-excursion (goto-char post-affiliated) | 21013 | ? )) |
| 20955 | (forward-line) | 21014 | ((save-excursion (beginning-of-line) (looking-at "[ \t]+")) |
| 20956 | (point))) | 21015 | (match-string 0)) |
| 20957 | (cend (save-excursion | 21016 | (t "")))) |
| 20958 | (goto-char (org-element-property :end element)) | 21017 | (comment-block |
| 20959 | (skip-chars-backward " \r\t\n") | 21018 | ;; Only fill contents if P is within block boundaries. |
| 20960 | (line-beginning-position)))) | 21019 | (let* ((cbeg (save-excursion (goto-char post-affiliated) |
| 20961 | (when (and (>= p cbeg) (< p cend)) | 21020 | (forward-line) |
| 20962 | (if (save-excursion (beginning-of-line) (looking-at "[ \t]+")) | 21021 | (point))) |
| 20963 | (match-string 0) | 21022 | (cend (save-excursion |
| 20964 | "")))))))))) | 21023 | (goto-char (org-element-property :end element)) |
| 21024 | (skip-chars-backward " \r\t\n") | ||
| 21025 | (line-beginning-position)))) | ||
| 21026 | (when (and (>= p cbeg) (< p cend)) | ||
| 21027 | (if (save-excursion (beginning-of-line) (looking-at "[ \t]+")) | ||
| 21028 | (match-string 0) | ||
| 21029 | ""))))))))))) | ||
| 20965 | 21030 | ||
| 20966 | (declare-function message-goto-body "message" ()) | 21031 | (declare-function message-goto-body "message" ()) |
| 20967 | (defvar message-cite-prefix-regexp) ; From message.el | 21032 | (defvar message-cite-prefix-regexp) ; From message.el |
| @@ -20981,12 +21046,12 @@ width for filling. | |||
| 20981 | 21046 | ||
| 20982 | For convenience, when point is at a plain list, an item or | 21047 | For convenience, when point is at a plain list, an item or |
| 20983 | a footnote definition, try to fill the first paragraph within." | 21048 | a footnote definition, try to fill the first paragraph within." |
| 20984 | ;; Falls back on message-fill-paragraph when necessary | ||
| 20985 | (interactive) | 21049 | (interactive) |
| 20986 | (if (and (derived-mode-p 'message-mode) | 21050 | (if (and (derived-mode-p 'message-mode) |
| 20987 | (or (not (message-in-body-p)) | 21051 | (or (not (message-in-body-p)) |
| 20988 | (save-excursion (move-beginning-of-line 1) | 21052 | (save-excursion (move-beginning-of-line 1) |
| 20989 | (looking-at message-cite-prefix-regexp)))) | 21053 | (looking-at message-cite-prefix-regexp)))) |
| 21054 | ;; First ensure filling is correct in message-mode. | ||
| 20990 | (let ((fill-paragraph-function | 21055 | (let ((fill-paragraph-function |
| 20991 | (cadadr (assoc 'fill-paragraph-function org-fb-vars))) | 21056 | (cadadr (assoc 'fill-paragraph-function org-fb-vars))) |
| 20992 | (fill-prefix (cadadr (assoc 'fill-prefix org-fb-vars))) | 21057 | (fill-prefix (cadadr (assoc 'fill-prefix org-fb-vars))) |
| @@ -21003,6 +21068,8 @@ a footnote definition, try to fill the first paragraph within." | |||
| 21003 | ;; the buffer. In that case, ignore filling. | 21068 | ;; the buffer. In that case, ignore filling. |
| 21004 | (if (< (point) (org-element-property :begin element)) t | 21069 | (if (< (point) (org-element-property :begin element)) t |
| 21005 | (case (org-element-type element) | 21070 | (case (org-element-type element) |
| 21071 | ;; Use major mode filling function is src blocks. | ||
| 21072 | (src-block (org-babel-do-key-sequence-in-edit-buffer (kbd "M-q"))) | ||
| 21006 | ;; Align Org tables, leave table.el tables as-is. | 21073 | ;; Align Org tables, leave table.el tables as-is. |
| 21007 | (table-row (org-table-align) t) | 21074 | (table-row (org-table-align) t) |
| 21008 | (table | 21075 | (table |