diff options
| author | Bastien Guerry | 2014-10-03 10:13:51 +0200 |
|---|---|---|
| committer | Bastien Guerry | 2014-10-03 10:13:51 +0200 |
| commit | a81e5de3a34d27cea43d49ffdfd9755f0eddb262 (patch) | |
| tree | 94d0e2b93f054d2cc9f7f7dc5423561ea3c00a2c /lisp/org/org.el | |
| parent | e197284d4789d7caa613fc406516f58fbec02547 (diff) | |
| download | emacs-a81e5de3a34d27cea43d49ffdfd9755f0eddb262.tar.gz emacs-a81e5de3a34d27cea43d49ffdfd9755f0eddb262.zip | |
Sync with Org 8.2.8.
Diffstat (limited to 'lisp/org/org.el')
| -rw-r--r-- | lisp/org/org.el | 220 |
1 files changed, 119 insertions, 101 deletions
diff --git a/lisp/org/org.el b/lisp/org/org.el index 2a451ed5456..c42102cac37 100644 --- a/lisp/org/org.el +++ b/lisp/org/org.el | |||
| @@ -111,6 +111,8 @@ Stars are put in group 1 and the trimmed body in group 2.") | |||
| 111 | (unless (boundp 'diary-fancy-buffer) | 111 | (unless (boundp 'diary-fancy-buffer) |
| 112 | (org-defvaralias 'diary-fancy-buffer 'fancy-diary-buffer)) | 112 | (org-defvaralias 'diary-fancy-buffer 'fancy-diary-buffer)) |
| 113 | 113 | ||
| 114 | (declare-function org-add-archive-files "org-archive" (files)) | ||
| 115 | |||
| 114 | (declare-function org-inlinetask-at-task-p "org-inlinetask" ()) | 116 | (declare-function org-inlinetask-at-task-p "org-inlinetask" ()) |
| 115 | (declare-function org-inlinetask-outline-regexp "org-inlinetask" ()) | 117 | (declare-function org-inlinetask-outline-regexp "org-inlinetask" ()) |
| 116 | (declare-function org-inlinetask-toggle-visibility "org-inlinetask" ()) | 118 | (declare-function org-inlinetask-toggle-visibility "org-inlinetask" ()) |
| @@ -118,7 +120,10 @@ Stars are put in group 1 and the trimmed body in group 2.") | |||
| 118 | (declare-function org-clock-get-last-clock-out-time "org-clock" ()) | 120 | (declare-function org-clock-get-last-clock-out-time "org-clock" ()) |
| 119 | (declare-function org-clock-timestamps-up "org-clock" (&optional n)) | 121 | (declare-function org-clock-timestamps-up "org-clock" (&optional n)) |
| 120 | (declare-function org-clock-timestamps-down "org-clock" (&optional n)) | 122 | (declare-function org-clock-timestamps-down "org-clock" (&optional n)) |
| 123 | (declare-function org-clock-remove-overlays "org-clock" (&optional beg end noremove)) | ||
| 121 | (declare-function org-clock-sum-current-item "org-clock" (&optional tstart)) | 124 | (declare-function org-clock-sum-current-item "org-clock" (&optional tstart)) |
| 125 | (declare-function org-clock-update-time-maybe "org-clock" ()) | ||
| 126 | (declare-function org-clocktable-shift "org-clock" (dir n)) | ||
| 122 | 127 | ||
| 123 | (declare-function orgtbl-mode "org-table" (&optional arg)) | 128 | (declare-function orgtbl-mode "org-table" (&optional arg)) |
| 124 | (declare-function org-clock-out "org-clock" (&optional switch-to-state fail-quietly at-time)) | 129 | (declare-function org-clock-out "org-clock" (&optional switch-to-state fail-quietly at-time)) |
| @@ -133,6 +138,10 @@ Stars are put in group 1 and the trimmed body in group 2.") | |||
| 133 | (declare-function org-agenda-list "org-agenda" (&optional arg start-day span)) | 138 | (declare-function org-agenda-list "org-agenda" (&optional arg start-day span)) |
| 134 | (declare-function org-agenda-redo "org-agenda" (&optional all)) | 139 | (declare-function org-agenda-redo "org-agenda" (&optional all)) |
| 135 | (declare-function org-table-align "org-table" ()) | 140 | (declare-function org-table-align "org-table" ()) |
| 141 | (declare-function org-table-begin "org-table" (&optional table-type)) | ||
| 142 | (declare-function org-table-blank-field "org-table" ()) | ||
| 143 | (declare-function org-table-end "org-table" (&optional table-type)) | ||
| 144 | (declare-function org-table-insert-row "org-table" (&optional arg)) | ||
| 136 | (declare-function org-table-paste-rectangle "org-table" ()) | 145 | (declare-function org-table-paste-rectangle "org-table" ()) |
| 137 | (declare-function org-table-maybe-eval-formula "org-table" ()) | 146 | (declare-function org-table-maybe-eval-formula "org-table" ()) |
| 138 | (declare-function org-table-maybe-recalculate-line "org-table" ()) | 147 | (declare-function org-table-maybe-recalculate-line "org-table" ()) |
| @@ -179,6 +188,7 @@ Stars are put in group 1 and the trimmed body in group 2.") | |||
| 179 | (intern (concat "org-babel-expand-body:" lang))))))) | 188 | (intern (concat "org-babel-expand-body:" lang))))))) |
| 180 | org-babel-load-languages)) | 189 | org-babel-load-languages)) |
| 181 | 190 | ||
| 191 | (declare-function org-babel-tangle-file "ob-tangle" (file &optional target-file lang)) | ||
| 182 | ;;;###autoload | 192 | ;;;###autoload |
| 183 | (defun org-babel-load-file (file &optional compile) | 193 | (defun org-babel-load-file (file &optional compile) |
| 184 | "Load Emacs Lisp source code blocks in the Org-mode FILE. | 194 | "Load Emacs Lisp source code blocks in the Org-mode FILE. |
| @@ -5109,9 +5119,9 @@ Support for group tags is controlled by the option | |||
| 5109 | "\\(?: +\\(\\[#.\\]\\)\\)?" | 5119 | "\\(?: +\\(\\[#.\\]\\)\\)?" |
| 5110 | "\\(?: +" | 5120 | "\\(?: +" |
| 5111 | ;; Stats cookies can be stuck to body. | 5121 | ;; Stats cookies can be stuck to body. |
| 5112 | "\\(?:\\[[0-9%%/]+\\] *\\)?" | 5122 | "\\(?:\\[[0-9%%/]+\\] *\\)*" |
| 5113 | "\\(%s\\)" | 5123 | "\\(%s\\)" |
| 5114 | "\\(?: *\\[[0-9%%/]+\\]\\)?" | 5124 | "\\(?: *\\[[0-9%%/]+\\]\\)*" |
| 5115 | "\\)" | 5125 | "\\)" |
| 5116 | (org-re "\\(?:[ \t]+\\(:[[:alnum:]_@#%%:]+:\\)\\)?") | 5126 | (org-re "\\(?:[ \t]+\\(:[[:alnum:]_@#%%:]+:\\)\\)?") |
| 5117 | "[ \t]*$") | 5127 | "[ \t]*$") |
| @@ -5417,8 +5427,7 @@ The following commands are available: | |||
| 5417 | (org-add-hook 'isearch-mode-end-hook 'org-isearch-end 'append 'local) | 5427 | (org-add-hook 'isearch-mode-end-hook 'org-isearch-end 'append 'local) |
| 5418 | ;; Emacs 22 deals with this through a special variable | 5428 | ;; Emacs 22 deals with this through a special variable |
| 5419 | (org-set-local 'outline-isearch-open-invisible-function | 5429 | (org-set-local 'outline-isearch-open-invisible-function |
| 5420 | (lambda (&rest ignore) (org-show-context 'isearch))) | 5430 | (lambda (&rest ignore) (org-show-context 'isearch)))) |
| 5421 | (org-add-hook 'isearch-mode-end-hook 'org-fix-ellipsis-at-bol 'append 'local)) | ||
| 5422 | 5431 | ||
| 5423 | ;; Setup the pcomplete hooks | 5432 | ;; Setup the pcomplete hooks |
| 5424 | (set (make-local-variable 'pcomplete-command-completion-function) | 5433 | (set (make-local-variable 'pcomplete-command-completion-function) |
| @@ -5473,9 +5482,6 @@ The following commands are available: | |||
| 5473 | 5482 | ||
| 5474 | (put 'org-mode 'flyspell-mode-predicate 'org-mode-flyspell-verify) | 5483 | (put 'org-mode 'flyspell-mode-predicate 'org-mode-flyspell-verify) |
| 5475 | 5484 | ||
| 5476 | (defsubst org-fix-ellipsis-at-bol () | ||
| 5477 | (save-excursion (goto-char (window-start)) (recenter 0))) | ||
| 5478 | |||
| 5479 | (defun org-find-invisible-foreground () | 5485 | (defun org-find-invisible-foreground () |
| 5480 | (let ((candidates (remove | 5486 | (let ((candidates (remove |
| 5481 | "unspecified-bg" | 5487 | "unspecified-bg" |
| @@ -5881,7 +5887,7 @@ by a #." | |||
| 5881 | ((member dc1 '("+title:" "+author:" "+email:" "+date:")) | 5887 | ((member dc1 '("+title:" "+author:" "+email:" "+date:")) |
| 5882 | (add-text-properties | 5888 | (add-text-properties |
| 5883 | beg (match-end 3) | 5889 | beg (match-end 3) |
| 5884 | (if (member (intern (substring dc1 0 -1)) org-hidden-keywords) | 5890 | (if (member (intern (substring dc1 1 -1)) org-hidden-keywords) |
| 5885 | '(font-lock-fontified t invisible t) | 5891 | '(font-lock-fontified t invisible t) |
| 5886 | '(font-lock-fontified t face org-document-info-keyword))) | 5892 | '(font-lock-fontified t face org-document-info-keyword))) |
| 5887 | (add-text-properties | 5893 | (add-text-properties |
| @@ -6145,15 +6151,25 @@ Use `org-reduced-level' to remove the effect of `org-odd-levels'." | |||
| 6145 | 6151 | ||
| 6146 | (defvar org-font-lock-keywords nil) | 6152 | (defvar org-font-lock-keywords nil) |
| 6147 | 6153 | ||
| 6148 | (defsubst org-re-property (property &optional literal) | 6154 | (defsubst org-re-property (property &optional literal allow-null) |
| 6149 | "Return a regexp matching a PROPERTY line. | 6155 | "Return a regexp matching a PROPERTY line. |
| 6150 | Match group 3 will be set to the value if it exists." | 6156 | |
| 6151 | (concat "^\\(?4:[ \t]*\\)\\(?1::\\(?2:" | 6157 | When optional argument LITERAL is non-nil, do not quote PROPERTY. |
| 6152 | (if literal property (regexp-quote property)) | 6158 | This is useful when PROPERTY is a regexp. When ALLOW-NULL is |
| 6153 | "\\):\\)[ \t]+\\(?3:[^ \t\r\n].*?\\)\\(?5:[ \t]*\\)$")) | 6159 | non-nil, match properties even without a value. |
| 6160 | |||
| 6161 | Match group 3 is set to the value when it exists. If there is no | ||
| 6162 | value and ALLOW-NULL is non-nil, it is set to the empty string." | ||
| 6163 | (concat | ||
| 6164 | "^\\(?4:[ \t]*\\)" | ||
| 6165 | (format "\\(?1::\\(?2:%s\\):\\)" | ||
| 6166 | (if literal property (regexp-quote property))) | ||
| 6167 | (if allow-null | ||
| 6168 | "\\(?:\\(?3:$\\)\\|[ \t]+\\(?3:.*?\\)\\)\\(?5:[ \t]*\\)$" | ||
| 6169 | "[ \t]+\\(?3:[^ \r\t\n]+.*?\\)\\(?5:[ \t]*\\)$"))) | ||
| 6154 | 6170 | ||
| 6155 | (defconst org-property-re | 6171 | (defconst org-property-re |
| 6156 | (org-re-property ".*?" 'literal) | 6172 | (org-re-property ".*?" 'literal t) |
| 6157 | "Regular expression matching a property line. | 6173 | "Regular expression matching a property line. |
| 6158 | There are four matching groups: | 6174 | There are four matching groups: |
| 6159 | 1: :PROPKEY: including the leading and trailing colon, | 6175 | 1: :PROPKEY: including the leading and trailing colon, |
| @@ -6712,7 +6728,8 @@ in special contexts. | |||
| 6712 | (setq org-cycle-global-status 'overview) | 6728 | (setq org-cycle-global-status 'overview) |
| 6713 | (run-hook-with-args 'org-cycle-hook 'overview))))) | 6729 | (run-hook-with-args 'org-cycle-hook 'overview))))) |
| 6714 | 6730 | ||
| 6715 | (defvar org-called-with-limited-levels);Dyn-bound in ̀org-with-limited-levels'. | 6731 | (defvar org-called-with-limited-levels nil |
| 6732 | "Non-nil when `org-with-limited-levels' is currently active.") | ||
| 6716 | 6733 | ||
| 6717 | (defun org-cycle-internal-local () | 6734 | (defun org-cycle-internal-local () |
| 6718 | "Do the local cycling action." | 6735 | "Do the local cycling action." |
| @@ -6729,7 +6746,8 @@ in special contexts. | |||
| 6729 | (setq has-children (org-list-has-child-p (point) struct))) | 6746 | (setq has-children (org-list-has-child-p (point) struct))) |
| 6730 | (org-back-to-heading) | 6747 | (org-back-to-heading) |
| 6731 | (setq eoh (save-excursion (outline-end-of-heading) (point))) | 6748 | (setq eoh (save-excursion (outline-end-of-heading) (point))) |
| 6732 | (setq eos (save-excursion (1- (org-end-of-subtree t t)))) | 6749 | (setq eos (save-excursion (org-end-of-subtree t t) |
| 6750 | (when (bolp) (backward-char)) (point))) | ||
| 6733 | (setq has-children | 6751 | (setq has-children |
| 6734 | (or (save-excursion | 6752 | (or (save-excursion |
| 6735 | (let ((level (funcall outline-level))) | 6753 | (let ((level (funcall outline-level))) |
| @@ -6894,21 +6912,20 @@ With a numeric prefix, show all headlines up to that level." | |||
| 6894 | ;; buffers, where outline-regexp is needed. | 6912 | ;; buffers, where outline-regexp is needed. |
| 6895 | (defun org-overview () | 6913 | (defun org-overview () |
| 6896 | "Switch to overview mode, showing only top-level headlines. | 6914 | "Switch to overview mode, showing only top-level headlines. |
| 6897 | Really, this shows all headlines with level equal or greater than the level | 6915 | This shows all headlines with a level equal or greater than the level |
| 6898 | of the first headline in the buffer. This is important, because if the | 6916 | of the first headline in the buffer. This is important, because if the |
| 6899 | first headline is not level one, then (hide-sublevels 1) gives confusing | 6917 | first headline is not level one, then (hide-sublevels 1) gives confusing |
| 6900 | results." | 6918 | results." |
| 6901 | (interactive) | 6919 | (interactive) |
| 6902 | (let ((pos (point)) | 6920 | (save-excursion |
| 6903 | (level (save-excursion | 6921 | (let ((level |
| 6904 | (goto-char (point-min)) | 6922 | (save-excursion |
| 6905 | (if (re-search-forward (concat "^" outline-regexp) nil t) | 6923 | (goto-char (point-min)) |
| 6906 | (progn | 6924 | (if (re-search-forward (concat "^" outline-regexp) nil t) |
| 6907 | (goto-char (match-beginning 0)) | 6925 | (progn |
| 6908 | (funcall outline-level)))))) | 6926 | (goto-char (match-beginning 0)) |
| 6909 | (and level (hide-sublevels level)) | 6927 | (funcall outline-level)))))) |
| 6910 | (recenter '(4)) | 6928 | (and level (hide-sublevels level))))) |
| 6911 | (goto-char pos))) | ||
| 6912 | 6929 | ||
| 6913 | (defun org-content (&optional arg) | 6930 | (defun org-content (&optional arg) |
| 6914 | "Show all headlines in the buffer, like a table of contents. | 6931 | "Show all headlines in the buffer, like a table of contents. |
| @@ -7105,13 +7122,11 @@ Otherwise make it visible." | |||
| 7105 | (pos-visible-in-window-p | 7122 | (pos-visible-in-window-p |
| 7106 | (save-excursion (org-end-of-subtree t) (point)))) | 7123 | (save-excursion (org-end-of-subtree t) (point)))) |
| 7107 | 7124 | ||
| 7108 | (defun org-first-headline-recenter (&optional N) | 7125 | (defun org-first-headline-recenter () |
| 7109 | "Move cursor to the first headline and recenter the headline. | 7126 | "Move cursor to the first headline and recenter the headline." |
| 7110 | Optional argument N means put the headline into the Nth line of the window." | ||
| 7111 | (goto-char (point-min)) | 7127 | (goto-char (point-min)) |
| 7112 | (when (re-search-forward (concat "^\\(" org-outline-regexp "\\)") nil t) | 7128 | (when (re-search-forward (concat "^\\(" org-outline-regexp "\\)") nil t) |
| 7113 | (beginning-of-line) | 7129 | (set-window-start (selected-window) (point-at-bol)))) |
| 7114 | (recenter (prefix-numeric-value N)))) | ||
| 7115 | 7130 | ||
| 7116 | ;;; Saving and restoring visibility | 7131 | ;;; Saving and restoring visibility |
| 7117 | 7132 | ||
| @@ -7545,23 +7560,22 @@ When NEXT is non-nil, check the next line instead." | |||
| 7545 | (looking-at "[ \t]*$"))))) | 7560 | (looking-at "[ \t]*$"))))) |
| 7546 | 7561 | ||
| 7547 | (defun org-insert-heading (&optional arg invisible-ok) | 7562 | (defun org-insert-heading (&optional arg invisible-ok) |
| 7548 | "Insert a new heading or item with same depth at point. | 7563 | "Insert a new heading or an item with the same depth at point. |
| 7549 | 7564 | ||
| 7550 | If point is at the beginning of a heading or a list item, insert | 7565 | If point is at the beginning of a heading or a list item, insert |
| 7551 | a heading or a list item before it. | 7566 | a new heading or a new item above the current one. If point is |
| 7552 | 7567 | at the beginning of a normal line, turn the line into a heading. | |
| 7553 | If point is at the beginning of a normal line, turn this line | ||
| 7554 | into a heading. | ||
| 7555 | 7568 | ||
| 7556 | If point is in the middle of a headline or a list item, split the | 7569 | If point is in the middle of a headline or a list item, split the |
| 7557 | headline or the item and create a new headline/item with the text | 7570 | headline or the item and create a new headline/item with the text |
| 7558 | in the current line after point \(see `org-M-RET-may-split-line' | 7571 | in the current line after point \(see `org-M-RET-may-split-line' |
| 7559 | on how to modify this behavior). | 7572 | on how to modify this behavior). |
| 7560 | 7573 | ||
| 7561 | With one universal prefix argument: If point is within a list, | 7574 | With one universal prefirx argument, set the user option |
| 7562 | insert a heading instead of a list item. Otherwise, set the | 7575 | `org-insert-heading-respect-content' to t for the duration of |
| 7563 | value of `org-insert-heading-respect-content' to `t' for the | 7576 | the command. This modifies the behavior described above in this |
| 7564 | duration of the command. | 7577 | ways: on list items and at the beginning of normal lines, force |
| 7578 | the insertion of a heading after the current subtree. | ||
| 7565 | 7579 | ||
| 7566 | With two universal prefix arguments, insert the heading at the | 7580 | With two universal prefix arguments, insert the heading at the |
| 7567 | end of the grandparent subtree. For example, if point is within | 7581 | end of the grandparent subtree. For example, if point is within |
| @@ -7589,12 +7603,19 @@ command." | |||
| 7589 | (or arg (not itemp)))) | 7603 | (or arg (not itemp)))) |
| 7590 | ;; At beginning of buffer or so high up that only a heading | 7604 | ;; At beginning of buffer or so high up that only a heading |
| 7591 | ;; makes sense. | 7605 | ;; makes sense. |
| 7592 | (insert | 7606 | (cond ((and (bolp) (not respect-content)) (insert "* ")) |
| 7593 | (if (or (bobp) (org-previous-line-empty-p)) "" "\n") | 7607 | ((not respect-content) |
| 7594 | (if (org-in-src-block-p) ",* " "* ")) | 7608 | (unless may-split (end-of-line)) |
| 7609 | (insert "\n* ")) | ||
| 7610 | ((re-search-forward org-outline-regexp-bol nil t) | ||
| 7611 | (beginning-of-line) | ||
| 7612 | (insert "* \n") | ||
| 7613 | (backward-char)) | ||
| 7614 | (t (goto-char (point-max)) | ||
| 7615 | (insert "\n* "))) | ||
| 7595 | (run-hooks 'org-insert-heading-hook)) | 7616 | (run-hooks 'org-insert-heading-hook)) |
| 7596 | 7617 | ||
| 7597 | ((and itemp (not (equal arg '(4)))) | 7618 | ((and itemp (not (member arg '((4) (16))))) |
| 7598 | ;; Insert an item | 7619 | ;; Insert an item |
| 7599 | (org-insert-item)) | 7620 | (org-insert-item)) |
| 7600 | 7621 | ||
| @@ -7614,11 +7635,12 @@ command." | |||
| 7614 | nil)) | 7635 | nil)) |
| 7615 | ;; Get a level string to fall back on | 7636 | ;; Get a level string to fall back on |
| 7616 | (fix-level | 7637 | (fix-level |
| 7617 | (save-excursion | 7638 | (if (org-before-first-heading-p) "*" |
| 7618 | (org-back-to-heading t) | 7639 | (save-excursion |
| 7619 | (if (org-previous-line-empty-p) (setq empty-line-p t)) | 7640 | (org-back-to-heading t) |
| 7620 | (looking-at org-outline-regexp) | 7641 | (if (org-previous-line-empty-p) (setq empty-line-p t)) |
| 7621 | (make-string (1- (length (match-string 0))) ?*))) | 7642 | (looking-at org-outline-regexp) |
| 7643 | (make-string (1- (length (match-string 0))) ?*)))) | ||
| 7622 | (stars | 7644 | (stars |
| 7623 | (save-excursion | 7645 | (save-excursion |
| 7624 | (condition-case nil | 7646 | (condition-case nil |
| @@ -7650,8 +7672,12 @@ command." | |||
| 7650 | pos hide-previous previous-pos) | 7672 | pos hide-previous previous-pos) |
| 7651 | 7673 | ||
| 7652 | ;; If we insert after content, move there and clean up whitespace | 7674 | ;; If we insert after content, move there and clean up whitespace |
| 7653 | (when (and respect-content (not (org-on-heading-p))) | 7675 | (when (and respect-content |
| 7654 | (org-end-of-subtree nil t) | 7676 | (not (org-looking-at-p org-outline-regexp-bol))) |
| 7677 | (if (not (org-before-first-heading-p)) | ||
| 7678 | (org-end-of-subtree nil t) | ||
| 7679 | (re-search-forward org-outline-regexp-bol) | ||
| 7680 | (beginning-of-line 0)) | ||
| 7655 | (skip-chars-backward " \r\n") | 7681 | (skip-chars-backward " \r\n") |
| 7656 | (and (not (looking-back "^\*+")) | 7682 | (and (not (looking-back "^\*+")) |
| 7657 | (looking-at "[ \t]+") (replace-match "")) | 7683 | (looking-at "[ \t]+") (replace-match "")) |
| @@ -7680,10 +7706,9 @@ command." | |||
| 7680 | (setq initial-content (org-trim initial-content))) | 7706 | (setq initial-content (org-trim initial-content))) |
| 7681 | (goto-char pos)) | 7707 | (goto-char pos)) |
| 7682 | ;; a normal line | 7708 | ;; a normal line |
| 7683 | (unless (bolp) | 7709 | (setq initial-content |
| 7684 | (setq initial-content (buffer-substring (point) (point-at-eol))) | 7710 | (org-trim (buffer-substring (point) (point-at-eol)))) |
| 7685 | (delete-region (point) (point-at-eol)) | 7711 | (delete-region (point) (point-at-eol)))) |
| 7686 | (setq initial-content (org-trim initial-content))))) | ||
| 7687 | 7712 | ||
| 7688 | ;; If we are at the beginning of the line, insert before it. Else after | 7713 | ;; If we are at the beginning of the line, insert before it. Else after |
| 7689 | (cond | 7714 | (cond |
| @@ -7708,13 +7733,12 @@ command." | |||
| 7708 | "Make the number of empty lines before current exactly N. | 7733 | "Make the number of empty lines before current exactly N. |
| 7709 | So this will delete or add empty lines." | 7734 | So this will delete or add empty lines." |
| 7710 | (save-excursion | 7735 | (save-excursion |
| 7711 | (goto-char (point-at-bol)) | 7736 | (beginning-of-line) |
| 7712 | (if (looking-back "\\s-+" nil 'greedy) | 7737 | (let ((p (point))) |
| 7713 | (replace-match "")) | 7738 | (skip-chars-backward " \r\t\n") |
| 7714 | (or (bobp) (insert "\n")) | 7739 | (unless (bolp) (forward-line)) |
| 7715 | (while (> N 0) | 7740 | (delete-region (point) p)) |
| 7716 | (insert "\n") | 7741 | (when (> N 0) (insert (make-string N ?\n))))) |
| 7717 | (setq N (1- N))))) | ||
| 7718 | 7742 | ||
| 7719 | (defun org-get-heading (&optional no-tags no-todo) | 7743 | (defun org-get-heading (&optional no-tags no-todo) |
| 7720 | "Return the heading of the current entry, without the stars. | 7744 | "Return the heading of the current entry, without the stars. |
| @@ -7783,17 +7807,15 @@ This is a list with the following elements: | |||
| 7783 | (org-move-subtree-down) | 7807 | (org-move-subtree-down) |
| 7784 | (end-of-line 1)) | 7808 | (end-of-line 1)) |
| 7785 | 7809 | ||
| 7786 | (defun org-insert-heading-respect-content (&optional arg invisible-ok) | 7810 | (defun org-insert-heading-respect-content (&optional invisible-ok) |
| 7787 | "Insert heading with `org-insert-heading-respect-content' set to t." | 7811 | "Insert heading with `org-insert-heading-respect-content' set to t." |
| 7788 | (interactive "P") | 7812 | (interactive) |
| 7789 | (let ((org-insert-heading-respect-content t)) | 7813 | (org-insert-heading '(4) invisible-ok)) |
| 7790 | (org-insert-heading '(4) invisible-ok))) | ||
| 7791 | 7814 | ||
| 7792 | (defun org-insert-todo-heading-respect-content (&optional force-state) | 7815 | (defun org-insert-todo-heading-respect-content (&optional force-state) |
| 7793 | "Insert TODO heading with `org-insert-heading-respect-content' set to t." | 7816 | "Insert TODO heading with `org-insert-heading-respect-content' set to t." |
| 7794 | (interactive "P") | 7817 | (interactive) |
| 7795 | (let ((org-insert-heading-respect-content t)) | 7818 | (org-insert-todo-heading force-state '(4))) |
| 7796 | (org-insert-todo-heading force-state '(4)))) | ||
| 7797 | 7819 | ||
| 7798 | (defun org-insert-todo-heading (arg &optional force-heading) | 7820 | (defun org-insert-todo-heading (arg &optional force-heading) |
| 7799 | "Insert a new heading with the same level and TODO state as current heading. | 7821 | "Insert a new heading with the same level and TODO state as current heading. |
| @@ -8150,7 +8172,8 @@ case." | |||
| 8150 | (save-match-data | 8172 | (save-match-data |
| 8151 | (save-excursion (outline-end-of-heading) | 8173 | (save-excursion (outline-end-of-heading) |
| 8152 | (setq folded (outline-invisible-p))) | 8174 | (setq folded (outline-invisible-p))) |
| 8153 | (outline-end-of-subtree)) | 8175 | (progn (org-end-of-subtree nil t) |
| 8176 | (unless (eobp) (backward-char)))) | ||
| 8154 | (outline-next-heading) | 8177 | (outline-next-heading) |
| 8155 | (setq ne-end (org-back-over-empty-lines)) | 8178 | (setq ne-end (org-back-over-empty-lines)) |
| 8156 | (setq end (point)) | 8179 | (setq end (point)) |
| @@ -8303,7 +8326,7 @@ the inserted text when done." | |||
| 8303 | (string-match | 8326 | (string-match |
| 8304 | "^\\*+$" (buffer-substring | 8327 | "^\\*+$" (buffer-substring |
| 8305 | (point-at-bol) (point)))) | 8328 | (point-at-bol) (point)))) |
| 8306 | (- (match-end 1) (match-beginning 1))) | 8329 | (- (match-end 0) (match-beginning 0))) |
| 8307 | ((and (bolp) | 8330 | ((and (bolp) |
| 8308 | (looking-at org-outline-regexp)) | 8331 | (looking-at org-outline-regexp)) |
| 8309 | (- (match-end 0) (point) 1)))) | 8332 | (- (match-end 0) (point) 1)))) |
| @@ -10592,6 +10615,10 @@ application the system uses for this file type." | |||
| 10592 | (move-marker org-open-link-marker nil) | 10615 | (move-marker org-open-link-marker nil) |
| 10593 | (run-hook-with-args 'org-follow-link-hook))) | 10616 | (run-hook-with-args 'org-follow-link-hook))) |
| 10594 | 10617 | ||
| 10618 | (defsubst org-uniquify (list) | ||
| 10619 | "Non-destructively remove duplicate elements from LIST." | ||
| 10620 | (let ((res (copy-sequence list))) (delete-dups res))) | ||
| 10621 | |||
| 10595 | (defun org-offer-links-in-entry (buffer marker &optional nth zero) | 10622 | (defun org-offer-links-in-entry (buffer marker &optional nth zero) |
| 10596 | "Offer links in the current entry and return the selected link. | 10623 | "Offer links in the current entry and return the selected link. |
| 10597 | If there is only one link, return it. | 10624 | If there is only one link, return it. |
| @@ -13640,8 +13667,7 @@ How much context is shown depends upon the variables | |||
| 13640 | (error nil)) | 13667 | (error nil)) |
| 13641 | (not (bobp))) | 13668 | (not (bobp))) |
| 13642 | (org-flag-heading nil) | 13669 | (org-flag-heading nil) |
| 13643 | (when siblings-p (org-show-siblings))))) | 13670 | (when siblings-p (org-show-siblings))))))) |
| 13644 | (unless (eq key 'agenda) (org-fix-ellipsis-at-bol)))) | ||
| 13645 | 13671 | ||
| 13646 | (defvar org-reveal-start-hook nil | 13672 | (defvar org-reveal-start-hook nil |
| 13647 | "Hook run before revealing a location.") | 13673 | "Hook run before revealing a location.") |
| @@ -13836,7 +13862,7 @@ a file becomes an N^2 operation - but with this variable set, it scales | |||
| 13836 | as N.") | 13862 | as N.") |
| 13837 | 13863 | ||
| 13838 | (defun org-scan-tags (action matcher todo-only &optional start-level) | 13864 | (defun org-scan-tags (action matcher todo-only &optional start-level) |
| 13839 | "Sca headline tags with inheritance and produce output ACTION. | 13865 | "Scan headline tags with inheritance and produce output ACTION. |
| 13840 | 13866 | ||
| 13841 | ACTION can be `sparse-tree' to produce a sparse tree in the current buffer, | 13867 | ACTION can be `sparse-tree' to produce a sparse tree in the current buffer, |
| 13842 | or `agenda' to produce an entry list for an agenda view. It can also be | 13868 | or `agenda' to produce an entry list for an agenda view. It can also be |
| @@ -14744,8 +14770,8 @@ Returns the new tags string, or nil to not change the current settings." | |||
| 14744 | (if expert | 14770 | (if expert |
| 14745 | (set-buffer (get-buffer-create " *Org tags*")) | 14771 | (set-buffer (get-buffer-create " *Org tags*")) |
| 14746 | (delete-other-windows) | 14772 | (delete-other-windows) |
| 14747 | (split-window-vertically) | 14773 | (set-window-buffer (split-window-vertically) (get-buffer-create " *Org tags*")) |
| 14748 | (org-switch-to-buffer-other-window (get-buffer-create " *Org tags*"))) | 14774 | (org-switch-to-buffer-other-window " *Org tags*")) |
| 14749 | (erase-buffer) | 14775 | (erase-buffer) |
| 14750 | (org-set-local 'org-done-keywords done-keywords) | 14776 | (org-set-local 'org-done-keywords done-keywords) |
| 14751 | (org-fast-tag-insert "Inherited" inherited i-face "\n") | 14777 | (org-fast-tag-insert "Inherited" inherited i-face "\n") |
| @@ -15269,7 +15295,10 @@ things up because then unnecessary parsing is avoided." | |||
| 15269 | '("SCHEDULED" "DEADLINE" "CLOCK" "CLOSED" | 15295 | '("SCHEDULED" "DEADLINE" "CLOCK" "CLOSED" |
| 15270 | "TIMESTAMP" "TIMESTAMP_IA"))) | 15296 | "TIMESTAMP" "TIMESTAMP_IA"))) |
| 15271 | (catch 'match | 15297 | (catch 'match |
| 15272 | (while (re-search-forward org-maybe-keyword-time-regexp end t) | 15298 | (while (and (re-search-forward org-maybe-keyword-time-regexp end t) |
| 15299 | (not (text-property-any 0 (length (match-string 0)) | ||
| 15300 | 'face 'font-lock-comment-face | ||
| 15301 | (match-string 0)))) | ||
| 15273 | (setq key (if (match-end 1) | 15302 | (setq key (if (match-end 1) |
| 15274 | (substring (org-match-string-no-properties 1) | 15303 | (substring (org-match-string-no-properties 1) |
| 15275 | 0 -1)) | 15304 | 0 -1)) |
| @@ -15397,7 +15426,7 @@ an empty drawer to delete." | |||
| 15397 | (if (and range | 15426 | (if (and range |
| 15398 | (goto-char (car range)) | 15427 | (goto-char (car range)) |
| 15399 | (re-search-forward | 15428 | (re-search-forward |
| 15400 | (org-re-property property) | 15429 | (org-re-property property nil t) |
| 15401 | (cdr range) t)) | 15430 | (cdr range) t)) |
| 15402 | (progn | 15431 | (progn |
| 15403 | (delete-region (match-beginning 0) (1+ (point-at-eol))) | 15432 | (delete-region (match-beginning 0) (1+ (point-at-eol))) |
| @@ -15562,7 +15591,7 @@ If it is not a string, an error is raised." | |||
| 15562 | (setq range (org-get-property-block beg end 'force)) | 15591 | (setq range (org-get-property-block beg end 'force)) |
| 15563 | (goto-char (car range)) | 15592 | (goto-char (car range)) |
| 15564 | (if (re-search-forward | 15593 | (if (re-search-forward |
| 15565 | (org-re-property property) (cdr range) t) | 15594 | (org-re-property property nil t) (cdr range) t) |
| 15566 | (progn | 15595 | (progn |
| 15567 | (delete-region (match-beginning 0) (match-end 0)) | 15596 | (delete-region (match-beginning 0) (match-end 0)) |
| 15568 | (goto-char (match-beginning 0))) | 15597 | (goto-char (match-beginning 0))) |
| @@ -15773,9 +15802,7 @@ This is computed according to `org-property-set-functions-alist'." | |||
| 15773 | (funcall set-function prompt | 15802 | (funcall set-function prompt |
| 15774 | (mapcar 'list (org-property-values property)) | 15803 | (mapcar 'list (org-property-values property)) |
| 15775 | nil nil "" nil cur))))) | 15804 | nil nil "" nil cur))))) |
| 15776 | (if (equal val "") | 15805 | (org-trim val))) |
| 15777 | cur | ||
| 15778 | val))) | ||
| 15779 | 15806 | ||
| 15780 | (defvar org-last-set-property nil) | 15807 | (defvar org-last-set-property nil) |
| 15781 | (defvar org-last-set-property-value nil) | 15808 | (defvar org-last-set-property-value nil) |
| @@ -15853,8 +15880,10 @@ an empty drawer to delete." | |||
| 15853 | (org-icompleting-read "Property: " props nil t) | 15880 | (org-icompleting-read "Property: " props nil t) |
| 15854 | (caar props)))) | 15881 | (caar props)))) |
| 15855 | (list prop))) | 15882 | (list prop))) |
| 15856 | (if (org-entry-delete nil property delete-empty-drawer) | 15883 | (if (not property) |
| 15857 | (message "Property %s deleted" property))) | 15884 | (message "No property to delete in this entry") |
| 15885 | (org-entry-delete nil property delete-empty-drawer) | ||
| 15886 | (message "Property \"%s\" deleted" property))) | ||
| 15858 | 15887 | ||
| 15859 | (defun org-delete-property-globally (property) | 15888 | (defun org-delete-property-globally (property) |
| 15860 | "Remove PROPERTY globally, from all entries." | 15889 | "Remove PROPERTY globally, from all entries." |
| @@ -17743,9 +17772,9 @@ This requires Emacs >= 24.1, build with imagemagick support." | |||
| 17743 | 17772 | ||
| 17744 | (defcustom org-agenda-inhibit-startup nil | 17773 | (defcustom org-agenda-inhibit-startup nil |
| 17745 | "Inhibit startup when preparing agenda buffers. | 17774 | "Inhibit startup when preparing agenda buffers. |
| 17746 | When this variable is `t' (the default), the initialization of | 17775 | When this variable is `t', the initialization of the Org agenda |
| 17747 | the Org agenda buffers is inhibited: e.g. the visibility state | 17776 | buffers is inhibited: e.g. the visibility state is not set, the |
| 17748 | is not set, the tables are not re-aligned, etc." | 17777 | tables are not re-aligned, etc." |
| 17749 | :type 'boolean | 17778 | :type 'boolean |
| 17750 | :version "24.3" | 17779 | :version "24.3" |
| 17751 | :group 'org-agenda) | 17780 | :group 'org-agenda) |
| @@ -21819,9 +21848,7 @@ for the search purpose." | |||
| 21819 | "Return the reverse of STRING." | 21848 | "Return the reverse of STRING." |
| 21820 | (apply 'string (reverse (string-to-list string)))) | 21849 | (apply 'string (reverse (string-to-list string)))) |
| 21821 | 21850 | ||
| 21822 | (defsubst org-uniquify (list) | 21851 | ;; defsubst org-uniquify must be defined before first use |
| 21823 | "Non-destructively remove duplicate elements from LIST." | ||
| 21824 | (let ((res (copy-sequence list))) (delete-dups res))) | ||
| 21825 | 21852 | ||
| 21826 | (defun org-uniquify-alist (alist) | 21853 | (defun org-uniquify-alist (alist) |
| 21827 | "Merge elements of ALIST with the same key. | 21854 | "Merge elements of ALIST with the same key. |
| @@ -23273,14 +23300,6 @@ If there is no such heading, return nil." | |||
| 23273 | (forward-char -1)))))) | 23300 | (forward-char -1)))))) |
| 23274 | (point)) | 23301 | (point)) |
| 23275 | 23302 | ||
| 23276 | (defadvice outline-end-of-subtree (around prefer-org-version activate compile) | ||
| 23277 | "Use Org version in org-mode, for dramatic speed-up." | ||
| 23278 | (if (derived-mode-p 'org-mode) | ||
| 23279 | (progn | ||
| 23280 | (org-end-of-subtree nil t) | ||
| 23281 | (unless (eobp) (backward-char 1))) | ||
| 23282 | ad-do-it)) | ||
| 23283 | |||
| 23284 | (defun org-end-of-meta-data-and-drawers () | 23303 | (defun org-end-of-meta-data-and-drawers () |
| 23285 | "Jump to the first text after meta data and drawers in the current entry. | 23304 | "Jump to the first text after meta data and drawers in the current entry. |
| 23286 | This will move over empty lines, lines with planning time stamps, | 23305 | This will move over empty lines, lines with planning time stamps, |
| @@ -23777,8 +23796,7 @@ Show the heading too, if it is currently invisible." | |||
| 23777 | isearch-mode-end-hook-quit) | 23796 | isearch-mode-end-hook-quit) |
| 23778 | ;; Only when the isearch was not quitted. | 23797 | ;; Only when the isearch was not quitted. |
| 23779 | (org-add-hook 'post-command-hook 'org-isearch-post-command | 23798 | (org-add-hook 'post-command-hook 'org-isearch-post-command |
| 23780 | 'append 'local))) | 23799 | 'append 'local))))) |
| 23781 | (org-fix-ellipsis-at-bol))) | ||
| 23782 | 23800 | ||
| 23783 | (defun org-isearch-post-command () | 23801 | (defun org-isearch-post-command () |
| 23784 | "Remove self from hook, and show context." | 23802 | "Remove self from hook, and show context." |