|
@@ -403,6 +403,25 @@ XEmacs user should have this variable set to nil, because
|
|
|
(const :tag "When outside special context" t)
|
|
|
(const :tag "Everywhere except timestamps" always)))
|
|
|
|
|
|
+(defcustom org-loop-over-headlines-in-active-region nil
|
|
|
+ "Shall some commands act upon headlines in the active region?
|
|
|
+
|
|
|
+When set to `t', some commands will be performed in all headlines
|
|
|
+within the active region.
|
|
|
+
|
|
|
+When set to a string, those commands will be performed on the
|
|
|
+matching headlines within the active region. Such string must be
|
|
|
+a tags/property/todo match as it is used in the agenda tags view.
|
|
|
+
|
|
|
+The list of commands is:
|
|
|
+- `org-schedule'
|
|
|
+- `org-deadline'"
|
|
|
+ :type '(choice (const :tag "Don't loop" nil)
|
|
|
+ (const :tag "All headlines in active region" t)
|
|
|
+ (string :tag "Tags/Property/Todo matcher"))
|
|
|
+ :group 'org-todo
|
|
|
+ :group 'org-archive)
|
|
|
+
|
|
|
(defgroup org-startup nil
|
|
|
"Options concerning startup of Org-mode."
|
|
|
:tag "Org Startup"
|
|
@@ -1493,9 +1512,9 @@ When nil, the link search tries to match a phrase with all words
|
|
|
in the search text."
|
|
|
:group 'org-link-follow
|
|
|
:type '(choice
|
|
|
- (const :tag "Use fuzy text search" nil)
|
|
|
+ (const :tag "Use fuzzy text search" nil)
|
|
|
(const :tag "Match only exact headline" t)
|
|
|
- (const :tag "Match extact headline or query to create it"
|
|
|
+ (const :tag "Match exact headline or query to create it"
|
|
|
query-to-create)))
|
|
|
|
|
|
(defcustom org-link-frame-setup
|
|
@@ -3710,6 +3729,7 @@ Normal means, no org-mode-specific context."
|
|
|
(defvar calc-embedded-close-formula)
|
|
|
(defvar calc-embedded-open-formula)
|
|
|
(declare-function cdlatex-tab "ext:cdlatex" ())
|
|
|
+(declare-function cdlatex-compute-tables "ext:cdlatex" ())
|
|
|
(declare-function dired-get-filename "dired" (&optional localp no-error-if-not-filep))
|
|
|
(defvar font-lock-unfontify-region-function)
|
|
|
(declare-function iswitchb-read-buffer "iswitchb"
|
|
@@ -3719,7 +3739,7 @@ Normal means, no org-mode-specific context."
|
|
|
(defvar org-agenda-tags-todo-honor-ignore-options)
|
|
|
(declare-function org-agenda-skip "org-agenda" ())
|
|
|
(declare-function
|
|
|
- org-format-agenda-item "org-agenda"
|
|
|
+ org-agenda-format-item "org-agenda"
|
|
|
(extra txt &optional category tags dotime noprefix remove-re habitp))
|
|
|
(declare-function org-agenda-new-marker "org-agenda" (&optional pos))
|
|
|
(declare-function org-agenda-change-all-lines "org-agenda"
|
|
@@ -4226,6 +4246,10 @@ collapsed state."
|
|
|
|
|
|
;;; Variables for pre-computed regular expressions, all buffer local
|
|
|
|
|
|
+(defvar org-heading-regexp nil
|
|
|
+ "Matches an headline.
|
|
|
+Stars are put in group 1 and the trimmed body in group 2.")
|
|
|
+(make-variable-buffer-local 'org-heading-regexp)
|
|
|
(defvar org-drawer-regexp nil
|
|
|
"Matches first line of a hidden block.")
|
|
|
(make-variable-buffer-local 'org-drawer-regexp)
|
|
@@ -4249,22 +4273,28 @@ group 3: Priority cookie
|
|
|
group 4: True headline
|
|
|
group 5: Tags")
|
|
|
(make-variable-buffer-local 'org-complex-heading-regexp)
|
|
|
+(defvar org-heading-keyword-regexp-format nil
|
|
|
+ "Printf format to make regexp to match an headline with some keyword.
|
|
|
+This regexp will match the headline of any node which has the
|
|
|
+exact keyword that is put into the format. The keyword isn't in
|
|
|
+any group by default, but the stars and the body are.")
|
|
|
+(make-variable-buffer-local 'org-heading-keyword-regexp-format)
|
|
|
+(defvar org-heading-keyword-maybe-regexp-format nil
|
|
|
+ "Printf format to make regexp to match an headline with some keyword.
|
|
|
+This regexp can match any headline with the specified keyword, or
|
|
|
+a without a keyword. The keyword isn't in any group by default,
|
|
|
+but the stars and the body are.")
|
|
|
+(make-variable-buffer-local 'org-heading-keyword-maybe-regexp-format)
|
|
|
(defvar org-complex-heading-regexp-format nil
|
|
|
"Printf format to make regexp to match an exact headline.
|
|
|
-This regexp will match the headline of any node which hase the exact
|
|
|
-headline text that is put into the format, but may have any TODO state,
|
|
|
-priority and tags.")
|
|
|
+This regexp will match the headline of any node which has the
|
|
|
+exact headline text that is put into the format, but may have any
|
|
|
+TODO state, priority and tags.")
|
|
|
(make-variable-buffer-local 'org-complex-heading-regexp-format)
|
|
|
(defvar org-todo-line-tags-regexp nil
|
|
|
"Matches a headline and puts TODO state into group 2 if present.
|
|
|
Also put tags into group 4 if tags are present.")
|
|
|
(make-variable-buffer-local 'org-todo-line-tags-regexp)
|
|
|
-(defvar org-nl-done-regexp nil
|
|
|
- "Matches newline followed by a headline with the DONE keyword.")
|
|
|
-(make-variable-buffer-local 'org-nl-done-regexp)
|
|
|
-(defvar org-looking-at-done-regexp nil
|
|
|
- "Matches the DONE keyword a point.")
|
|
|
-(make-variable-buffer-local 'org-looking-at-done-regexp)
|
|
|
(defvar org-ds-keyword-length 12
|
|
|
"Maximum length of the Deadline and SCHEDULED keywords.")
|
|
|
(make-variable-buffer-local 'org-ds-keyword-length)
|
|
@@ -4403,7 +4433,7 @@ means to push this value onto the list in the variable.")
|
|
|
|
|
|
(defun org-set-regexps-and-options ()
|
|
|
"Precompute regular expressions for current buffer."
|
|
|
- (when (org-mode-p)
|
|
|
+ (when (eq major-mode 'org-mode)
|
|
|
(org-set-local 'org-todo-kwd-alist nil)
|
|
|
(org-set-local 'org-todo-key-alist nil)
|
|
|
(org-set-local 'org-todo-key-trigger nil)
|
|
@@ -4599,7 +4629,9 @@ means to push this value onto the list in the variable.")
|
|
|
(assoc (car e) org-tag-alist))
|
|
|
(push e org-tag-alist)))))
|
|
|
|
|
|
- ;; Compute the regular expressions and other local variables
|
|
|
+ ;; Compute the regular expressions and other local variables.
|
|
|
+ ;; Using `org-outline-regexp-bol' would complicate them much,
|
|
|
+ ;; because of the fixed white space at the end of that string.
|
|
|
(if (not org-done-keywords)
|
|
|
(setq org-done-keywords (and org-todo-keywords-1
|
|
|
(list (org-last org-todo-keywords-1)))))
|
|
@@ -4614,49 +4646,48 @@ means to push this value onto the list in the variable.")
|
|
|
org-not-done-keywords
|
|
|
(org-delete-all org-done-keywords (copy-sequence org-todo-keywords-1))
|
|
|
org-todo-regexp
|
|
|
- (concat "\\<\\(" (mapconcat 'regexp-quote org-todo-keywords-1
|
|
|
- "\\|") "\\)\\>")
|
|
|
+ (concat "\\("
|
|
|
+ (mapconcat 'regexp-quote org-todo-keywords-1 "\\|")
|
|
|
+ "\\)")
|
|
|
org-not-done-regexp
|
|
|
- (concat "\\<\\("
|
|
|
+ (concat "\\("
|
|
|
(mapconcat 'regexp-quote org-not-done-keywords "\\|")
|
|
|
- "\\)\\>")
|
|
|
+ "\\)")
|
|
|
+ org-heading-regexp
|
|
|
+ "^\\(\\*+\\)\\(?: +\\(.*?\\)\\)?[ \t]*$"
|
|
|
+ org-heading-keyword-regexp-format
|
|
|
+ "^\\(\\*+\\)\\(?: +%s\\)\\(?: +\\(.*?\\)\\)?[ \t]*$"
|
|
|
+ org-heading-keyword-maybe-regexp-format
|
|
|
+ "^\\(\\*+\\)\\(?: +%s\\)?\\(?: +\\(.*?\\)\\)?[ \t]*$"
|
|
|
org-not-done-heading-regexp
|
|
|
- (concat "^\\(\\*+\\)[ \t]+\\("
|
|
|
- (mapconcat 'regexp-quote org-not-done-keywords "\\|")
|
|
|
- "\\)[ \t]+")
|
|
|
+ (format org-heading-keyword-regexp-format org-not-done-regexp)
|
|
|
org-todo-line-regexp
|
|
|
- (concat "^\\(\\*+\\)[ \t]+\\(?:\\("
|
|
|
- (mapconcat 'regexp-quote org-todo-keywords-1 "\\|")
|
|
|
- "\\)[ \t]+\\)?\\(.*\\)")
|
|
|
+ (format org-heading-keyword-maybe-regexp-format org-todo-regexp)
|
|
|
org-complex-heading-regexp
|
|
|
- (concat "^\\(\\*+\\)[ \t]+\\(?:\\("
|
|
|
- (mapconcat 'regexp-quote org-todo-keywords-1 "\\|")
|
|
|
- "\\)[ \t]+\\)?"
|
|
|
- "\\(?:\\(\\[#.\\]\\)[ \t]+\\)?"
|
|
|
- "\\(.*?\\)"
|
|
|
- "\\(?:[ \t]+\\(:[[:alnum:]_@#%:]+:\\)\\)?[ \t]*$")
|
|
|
+ (concat "^\\(\\*+\\)"
|
|
|
+ "\\(?: +" org-todo-regexp "\\)?"
|
|
|
+ "\\(?: +\\(\\[#.\\]\\)\\)?"
|
|
|
+ "\\(?: +\\(.*?\\)\\)?"
|
|
|
+ (org-re "\\(?:[ \t]+\\(:[[:alnum:]_@#%:]+:\\)\\)?")
|
|
|
+ "[ \t]*$")
|
|
|
org-complex-heading-regexp-format
|
|
|
- (concat "^\\(\\*+\\)[ \t]+\\(?:\\("
|
|
|
- (mapconcat 'regexp-quote org-todo-keywords-1 "\\|")
|
|
|
- "\\)[ \t]+\\)?"
|
|
|
- "\\(?:\\(\\[#.\\]\\)[ \t]+\\)?"
|
|
|
- "\\(?:\\(?:\\[[0-9%%/]+\\]\\)[ \t]+\\)?" ; stats cookie
|
|
|
- "\\(%s\\)[ \t]*"
|
|
|
- "\\(?:\\[[0-9%%/]+\\]\\)?" ; stats cookie
|
|
|
- (org-re "\\(?:[ \t]+\\(:[[:alnum:]_@#%%:]+:\\)\\)?[ \t]*$"))
|
|
|
- org-nl-done-regexp
|
|
|
- (concat "\n\\*+[ \t]+"
|
|
|
- "\\(?:" (mapconcat 'regexp-quote org-done-keywords "\\|")
|
|
|
- "\\)" "[ \t]+")
|
|
|
+ (concat "^\\(\\*+\\)"
|
|
|
+ "\\(?: +" org-todo-regexp "\\)?"
|
|
|
+ "\\(?: +\\(\\[#.\\]\\)\\)?"
|
|
|
+ "\\(?: +"
|
|
|
+ ;; Stats cookies can be sticked to body.
|
|
|
+ "\\(?:\\[[0-9%%/]+\\] *\\)?"
|
|
|
+ "\\(%s\\)"
|
|
|
+ "\\(?: *\\[[0-9%%/]+\\]\\)?"
|
|
|
+ "\\)"
|
|
|
+ (org-re "\\(?:[ \t]+\\(:[[:alnum:]_@#%%:]+:\\)\\)?")
|
|
|
+ "[ \t]*$")
|
|
|
org-todo-line-tags-regexp
|
|
|
- (concat "^\\(\\*+\\)[ \t]+\\(?:\\("
|
|
|
- (mapconcat 'regexp-quote org-todo-keywords-1 "\\|")
|
|
|
- "\\)[ \t]+\\)"
|
|
|
- (org-re "\\(.*?\\([ \t]:[[:alnum:]:_@#%]+:[ \t]*\\)?$\\)"))
|
|
|
- org-looking-at-done-regexp
|
|
|
- (concat "^" "\\(?:"
|
|
|
- (mapconcat 'regexp-quote org-done-keywords "\\|") "\\)"
|
|
|
- "[ \t]+")
|
|
|
+ (concat "^\\(\\*+\\)"
|
|
|
+ "\\(?: +" org-todo-regexp "\\)?"
|
|
|
+ "\\(?: +\\(.*?\\)\\)?"
|
|
|
+ (org-re "\\(?:[ \t]+\\(:[[:alnum:]:_@#%]+:\\)\\)?")
|
|
|
+ "[ \t]*$")
|
|
|
org-deadline-regexp (concat "\\<" org-deadline-string)
|
|
|
org-deadline-time-regexp
|
|
|
(concat "\\<" org-deadline-string " *<\\([^>]+\\)>")
|
|
@@ -5707,14 +5738,17 @@ needs to be inserted at a specific position in the font-lock sequence.")
|
|
|
(if (memq 'footnote lk) '(org-activate-footnote-links))
|
|
|
'("^&?%%(.*\\|<%%([^>\n]*?>" (0 'org-sexp-date t))
|
|
|
'(org-hide-wide-columns (0 nil append))
|
|
|
- ;; TODO lines
|
|
|
- (list (concat "^\\*+[ \t]+" org-todo-regexp "\\([ \t]\\|$\\)")
|
|
|
- '(1 (org-get-todo-face 1) t))
|
|
|
+ ;; TODO keyword
|
|
|
+ (list (format org-heading-keyword-regexp-format
|
|
|
+ org-todo-regexp)
|
|
|
+ '(2 (org-get-todo-face 2) t))
|
|
|
;; DONE
|
|
|
(if org-fontify-done-headline
|
|
|
- (list (concat "^[*]+ +\\<\\("
|
|
|
- (mapconcat 'regexp-quote org-done-keywords "\\|")
|
|
|
- "\\)\\(.*\\)")
|
|
|
+ (list (format org-heading-keyword-regexp-format
|
|
|
+ (concat
|
|
|
+ "\\("
|
|
|
+ (mapconcat 'regexp-quote org-done-keywords "\\|")
|
|
|
+ "\\)"))
|
|
|
'(2 'org-headline-done t))
|
|
|
nil)
|
|
|
;; Priorities
|
|
@@ -5752,8 +5786,10 @@ needs to be inserted at a specific position in the font-lock sequence.")
|
|
|
;; Code
|
|
|
'(org-activate-code (1 'org-code t))
|
|
|
;; COMMENT
|
|
|
- (list (concat "^\\*+[ \t]+\\<\\(" org-comment-string
|
|
|
- "\\|" org-quote-string "\\)\\>")
|
|
|
+ (list (format org-heading-keyword-regexp-format
|
|
|
+ (concat "\\("
|
|
|
+ org-comment-string "\\|" org-quote-string
|
|
|
+ "\\)"))
|
|
|
'(1 'org-special-keyword t))
|
|
|
'("^#.*" (0 'font-lock-comment-face t))
|
|
|
;; Blocks and meta lines
|
|
@@ -6020,7 +6056,7 @@ in special contexts.
|
|
|
(and limit-level (1- (* limit-level 2)))
|
|
|
limit-level)))
|
|
|
(org-outline-regexp
|
|
|
- (if (not (org-mode-p))
|
|
|
+ (if (not (eq major-mode 'org-mode))
|
|
|
outline-regexp
|
|
|
(concat "\\*" (if nstars (format "\\{1,%d\\} " nstars) "+ "))))
|
|
|
(bob-special (and org-cycle-global-at-bob (not arg) (bobp)
|
|
@@ -6259,7 +6295,7 @@ With \\[universal-argument] prefix arg, switch to startup visibility.
|
|
|
With a numeric prefix, show all headlines up to that level."
|
|
|
(interactive "P")
|
|
|
(let ((org-cycle-include-plain-lists
|
|
|
- (if (org-mode-p) org-cycle-include-plain-lists nil)))
|
|
|
+ (if (eq major-mode 'org-mode) org-cycle-include-plain-lists nil)))
|
|
|
(cond
|
|
|
((integerp arg)
|
|
|
(show-all)
|
|
@@ -6469,7 +6505,7 @@ open and agenda-wise Org files."
|
|
|
(let ((files (mapcar 'expand-file-name (org-agenda-files))))
|
|
|
(dolist (buf (buffer-list))
|
|
|
(with-current-buffer buf
|
|
|
- (if (and (org-mode-p) (buffer-file-name))
|
|
|
+ (if (and (eq major-mode 'org-mode) (buffer-file-name))
|
|
|
(let ((file (expand-file-name (buffer-file-name))))
|
|
|
(unless (member file files)
|
|
|
(push file files))))))
|
|
@@ -6485,7 +6521,7 @@ open and agenda-wise Org files."
|
|
|
|
|
|
(defun org-cycle-hide-drawers (state)
|
|
|
"Re-hide all drawers after a visibility state change."
|
|
|
- (when (and (org-mode-p)
|
|
|
+ (when (and (eq major-mode 'org-mode)
|
|
|
(not (memq state '(overview folded contents))))
|
|
|
(save-excursion
|
|
|
(let* ((globalp (memq state '(contents all)))
|
|
@@ -7018,6 +7054,7 @@ This is important for non-interactive uses of the command."
|
|
|
(let ((p (point)))
|
|
|
(goto-char (point-at-bol))
|
|
|
(and (looking-at org-complex-heading-regexp)
|
|
|
+ (match-beginning 4)
|
|
|
(> p (match-beginning 4)))))))
|
|
|
tags pos)
|
|
|
(cond
|
|
@@ -7078,14 +7115,15 @@ When NO-TODO is non-nil, don't include TODO keywords."
|
|
|
(looking-at org-complex-heading-regexp)
|
|
|
(match-string 4))
|
|
|
(no-tags
|
|
|
- (looking-at "\\*+[ \t]+\\([^\n\r]*?\\)\\([ \t]+:[[:alnum:]:_@#%]+:[ \t]*\\)?$")
|
|
|
+ (looking-at (concat org-outline-regexp
|
|
|
+ "\\(.*?\\)"
|
|
|
+ "\\(?:[ \t]+:[[:alnum:]:_@#%]+:\\)?[ \t]*$"))
|
|
|
(match-string 1))
|
|
|
(no-todo
|
|
|
- (looking-at (concat "\\*+[ \t]+" org-todo-regexp " +"
|
|
|
- "\\([^\n\r]*?[ \t]+:[[:alnum:]:_@#%]+:[ \t]*\\)?$"))
|
|
|
- (match-string 2))
|
|
|
- (t (looking-at "\\*+[ \t]+\\([^\r\n]*\\)")
|
|
|
- (match-string 1)))))
|
|
|
+ (looking-at org-todo-line-regexp)
|
|
|
+ (match-string 3))
|
|
|
+ (t (looking-at org-heading-regexp)
|
|
|
+ (match-string 2)))))
|
|
|
|
|
|
(defun org-heading-components ()
|
|
|
"Return the components of the current heading.
|
|
@@ -7246,9 +7284,8 @@ in the region."
|
|
|
The level is the number of stars at the beginning of the headline."
|
|
|
(save-excursion
|
|
|
(org-with-limited-levels
|
|
|
- (ignore-errors
|
|
|
- (org-back-to-heading t)
|
|
|
- (funcall outline-level)))))
|
|
|
+ (if (ignore-errors (org-back-to-heading t))
|
|
|
+ (funcall outline-level)))))
|
|
|
|
|
|
(defun org-get-previous-line-level ()
|
|
|
"Return the outline depth of the last headline before the current line.
|
|
@@ -8630,7 +8667,7 @@ For file links, arg negates `org-context-in-file-links'."
|
|
|
(setq cpltxt (concat "file:" file)
|
|
|
link (org-make-link cpltxt))))
|
|
|
|
|
|
- ((and (buffer-file-name (buffer-base-buffer)) (org-mode-p))
|
|
|
+ ((and (buffer-file-name (buffer-base-buffer)) (eq major-mode 'org-mode))
|
|
|
(setq custom-id (org-entry-get nil "CUSTOM_ID"))
|
|
|
(cond
|
|
|
((org-in-regexp "<<\\(.*?\\)>>")
|
|
@@ -8958,7 +8995,7 @@ This command can be called in any mode to insert a link in Org-mode syntax."
|
|
|
(org-load-modules-maybe)
|
|
|
(org-run-like-in-org-mode 'org-insert-link))
|
|
|
|
|
|
-(defun org-insert-link (&optional complete-file link-location)
|
|
|
+(defun org-insert-link (&optional complete-file link-location default-description)
|
|
|
"Insert a link. At the prompt, enter the link.
|
|
|
|
|
|
Completion can be used to insert any of the link protocol prefixes like
|
|
@@ -8994,7 +9031,10 @@ called with the link target, and the result will be the default
|
|
|
link description.
|
|
|
|
|
|
If the LINK-LOCATION parameter is non-nil, this value will be
|
|
|
-used as the link location instead of reading one interactively."
|
|
|
+used as the link location instead of reading one interactively.
|
|
|
+
|
|
|
+If the DEFAULT-DESCRIPTION parameter is non-nil, this value will
|
|
|
+be used as the default description."
|
|
|
(interactive "P")
|
|
|
(let* ((wcf (current-window-configuration))
|
|
|
(region (if (org-region-active-p)
|
|
@@ -9124,6 +9164,7 @@ Use TAB to complete link prefixes, then RET for type-specific completion support
|
|
|
(if org-make-link-description-function
|
|
|
(setq desc (funcall org-make-link-description-function link desc)))
|
|
|
|
|
|
+ (if default-description (setq desc default-description))
|
|
|
(setq desc (read-string "Description: " desc))
|
|
|
(unless (string-match "\\S-" desc) (setq desc nil))
|
|
|
(if remove (apply 'delete-region remove))
|
|
@@ -9774,12 +9815,12 @@ in all files. If AVOID-POS is given, ignore matches near that position."
|
|
|
((string-match "^/\\(.*\\)/$" s)
|
|
|
;; A regular expression
|
|
|
(cond
|
|
|
- ((org-mode-p)
|
|
|
+ ((eq major-mode 'org-mode)
|
|
|
(org-occur (match-string 1 s)))
|
|
|
;;((eq major-mode 'dired-mode)
|
|
|
;; (grep (concat "grep -n -e '" (match-string 1 s) "' *")))
|
|
|
(t (org-do-occur (match-string 1 s)))))
|
|
|
- ((and (org-mode-p) org-link-search-must-match-exact-headline)
|
|
|
+ ((and (eq major-mode 'org-mode) org-link-search-must-match-exact-headline)
|
|
|
(and (equal (string-to-char s) ?*) (setq s (substring s 1)))
|
|
|
(goto-char (point-min))
|
|
|
(cond
|
|
@@ -9847,7 +9888,7 @@ in all files. If AVOID-POS is given, ignore matches near that position."
|
|
|
(goto-char (match-beginning 1))
|
|
|
(goto-char pos)
|
|
|
(error "No match"))))))
|
|
|
- (and (org-mode-p) (org-show-context 'link-search))
|
|
|
+ (and (eq major-mode 'org-mode) (org-show-context 'link-search))
|
|
|
type))
|
|
|
|
|
|
(defun org-search-not-self (group &rest args)
|
|
@@ -10116,7 +10157,7 @@ If the file does not exist, an error is thrown."
|
|
|
(set-match-data link-match-data)
|
|
|
(eval cmd))))
|
|
|
(t (funcall (cdr (assq 'file org-link-frame-setup)) file)))
|
|
|
- (and (org-mode-p) (eq old-mode 'org-mode)
|
|
|
+ (and (eq major-mode 'org-mode) (eq old-mode 'org-mode)
|
|
|
(or (not (equal old-buffer (current-buffer)))
|
|
|
(not (equal old-pos (point))))
|
|
|
(org-mark-ring-push old-pos old-buffer))))
|
|
@@ -10439,7 +10480,7 @@ such as the file name."
|
|
|
(interactive "P")
|
|
|
(let* ((bfn (buffer-file-name (buffer-base-buffer)))
|
|
|
(case-fold-search nil)
|
|
|
- (path (and (org-mode-p) (org-get-outline-path))))
|
|
|
+ (path (and (eq major-mode 'org-mode) (org-get-outline-path))))
|
|
|
(if current (setq path (append path
|
|
|
(save-excursion
|
|
|
(org-back-to-heading t)
|
|
@@ -10906,7 +10947,7 @@ Error if there is no such block at point."
|
|
|
"Update all dynamic blocks in the buffer.
|
|
|
This function can be used in a hook."
|
|
|
(interactive)
|
|
|
- (when (org-mode-p)
|
|
|
+ (when (eq major-mode 'org-mode)
|
|
|
(org-map-dblocks 'org-update-dblock)))
|
|
|
|
|
|
|
|
@@ -11027,13 +11068,16 @@ expands them."
|
|
|
(save-excursion
|
|
|
(org-back-to-heading)
|
|
|
(let (case-fold-search)
|
|
|
- (if (looking-at (concat org-outline-regexp
|
|
|
- "\\( *\\<" org-comment-string "\\>[ \t]*\\)"))
|
|
|
- (replace-match "" t t nil 1)
|
|
|
- (if (looking-at org-outline-regexp)
|
|
|
- (progn
|
|
|
- (goto-char (match-end 0))
|
|
|
- (insert org-comment-string " ")))))))
|
|
|
+ (cond
|
|
|
+ ((looking-at (format org-heading-keyword-regexp-format
|
|
|
+ org-comment-string))
|
|
|
+ (goto-char (match-end 1))
|
|
|
+ (looking-at (concat " +" org-comment-string))
|
|
|
+ (replace-match "" t t)
|
|
|
+ (when (eolp) (insert " ")))
|
|
|
+ ((looking-at org-outline-regexp)
|
|
|
+ (goto-char (match-end 0))
|
|
|
+ (insert org-comment-string " "))))))
|
|
|
|
|
|
(defvar org-last-todo-state-is-todo nil
|
|
|
"This is non-nil when the last TODO state change led to a TODO state.
|
|
@@ -11115,8 +11159,8 @@ For calling through lisp, arg is also interpreted in the following way:
|
|
|
(catch 'exit
|
|
|
(org-back-to-heading t)
|
|
|
(if (looking-at org-outline-regexp) (goto-char (1- (match-end 0))))
|
|
|
- (or (looking-at (concat " +" org-todo-regexp "\\( +\\|$\\)"))
|
|
|
- (looking-at " *"))
|
|
|
+ (or (looking-at (concat " +" org-todo-regexp "\\( +\\|[ \t]*$\\)"))
|
|
|
+ (looking-at "\\(?: *\\|[ \t]*$\\)"))
|
|
|
(let* ((match-data (match-data))
|
|
|
(startpos (point-at-bol))
|
|
|
(logging (save-match-data (org-entry-get nil "LOGGING" t t)))
|
|
@@ -11850,39 +11894,43 @@ With argument REMOVE, remove any deadline from the item.
|
|
|
With argument TIME, set the deadline at the corresponding date. TIME
|
|
|
can either be an Org date like \"2011-07-24\" or a delta like \"+2d\"."
|
|
|
(interactive "P")
|
|
|
- (let* ((old-date (org-entry-get nil "DEADLINE"))
|
|
|
- (repeater (and old-date
|
|
|
- (string-match
|
|
|
- "\\([.+-]+[0-9]+[dwmy]\\(?:[/ ][-+]?[0-9]+[dwmy]\\)?\\) ?"
|
|
|
- old-date)
|
|
|
- (match-string 1 old-date))))
|
|
|
- (if remove
|
|
|
- (progn
|
|
|
- (when (and old-date org-log-redeadline)
|
|
|
- (org-add-log-setup 'deldeadline nil old-date 'findpos
|
|
|
- org-log-redeadline))
|
|
|
- (org-remove-timestamp-with-keyword org-deadline-string)
|
|
|
- (message "Item no longer has a deadline."))
|
|
|
- (org-add-planning-info 'deadline time 'closed)
|
|
|
- (when (and old-date org-log-redeadline
|
|
|
- (not (equal old-date
|
|
|
- (substring org-last-inserted-timestamp 1 -1))))
|
|
|
- (org-add-log-setup 'redeadline nil old-date 'findpos
|
|
|
- org-log-redeadline))
|
|
|
- (when repeater
|
|
|
- (save-excursion
|
|
|
- (org-back-to-heading t)
|
|
|
- (when (re-search-forward (concat org-deadline-string " "
|
|
|
- org-last-inserted-timestamp)
|
|
|
- (save-excursion
|
|
|
- (outline-next-heading) (point)) t)
|
|
|
- (goto-char (1- (match-end 0)))
|
|
|
- (insert " " repeater)
|
|
|
- (setq org-last-inserted-timestamp
|
|
|
- (concat (substring org-last-inserted-timestamp 0 -1)
|
|
|
- " " repeater
|
|
|
- (substring org-last-inserted-timestamp -1))))))
|
|
|
- (message "Deadline on %s" org-last-inserted-timestamp))))
|
|
|
+ (if (and (org-region-active-p) org-loop-over-headlines-in-active-region)
|
|
|
+ (let (org-loop-over-headlines-in-active-region)
|
|
|
+ (org-map-entries
|
|
|
+ `(org-deadline ',remove ,time) org-loop-over-headlines-in-active-region 'region (if (outline-invisible-p) (org-end-of-subtree nil t))))
|
|
|
+ (let* ((old-date (org-entry-get nil "DEADLINE"))
|
|
|
+ (repeater (and old-date
|
|
|
+ (string-match
|
|
|
+ "\\([.+-]+[0-9]+[dwmy]\\(?:[/ ][-+]?[0-9]+[dwmy]\\)?\\) ?"
|
|
|
+ old-date)
|
|
|
+ (match-string 1 old-date))))
|
|
|
+ (if remove
|
|
|
+ (progn
|
|
|
+ (when (and old-date org-log-redeadline)
|
|
|
+ (org-add-log-setup 'deldeadline nil old-date 'findpos
|
|
|
+ org-log-redeadline))
|
|
|
+ (org-remove-timestamp-with-keyword org-deadline-string)
|
|
|
+ (message "Item no longer has a deadline."))
|
|
|
+ (org-add-planning-info 'deadline time 'closed)
|
|
|
+ (when (and old-date org-log-redeadline
|
|
|
+ (not (equal old-date
|
|
|
+ (substring org-last-inserted-timestamp 1 -1))))
|
|
|
+ (org-add-log-setup 'redeadline nil old-date 'findpos
|
|
|
+ org-log-redeadline))
|
|
|
+ (when repeater
|
|
|
+ (save-excursion
|
|
|
+ (org-back-to-heading t)
|
|
|
+ (when (re-search-forward (concat org-deadline-string " "
|
|
|
+ org-last-inserted-timestamp)
|
|
|
+ (save-excursion
|
|
|
+ (outline-next-heading) (point)) t)
|
|
|
+ (goto-char (1- (match-end 0)))
|
|
|
+ (insert " " repeater)
|
|
|
+ (setq org-last-inserted-timestamp
|
|
|
+ (concat (substring org-last-inserted-timestamp 0 -1)
|
|
|
+ " " repeater
|
|
|
+ (substring org-last-inserted-timestamp -1))))))
|
|
|
+ (message "Deadline on %s" org-last-inserted-timestamp)))))
|
|
|
|
|
|
(defun org-schedule (&optional remove time)
|
|
|
"Insert the SCHEDULED: string with a timestamp to schedule a TODO item.
|
|
@@ -11890,39 +11938,43 @@ With argument REMOVE, remove any scheduling date from the item.
|
|
|
With argument TIME, scheduled at the corresponding date. TIME can
|
|
|
either be an Org date like \"2011-07-24\" or a delta like \"+2d\"."
|
|
|
(interactive "P")
|
|
|
- (let* ((old-date (org-entry-get nil "SCHEDULED"))
|
|
|
- (repeater (and old-date
|
|
|
- (string-match
|
|
|
- "\\([.+-]+[0-9]+[dwmy]\\(?:[/ ][-+]?[0-9]+[dwmy]\\)?\\) ?"
|
|
|
- old-date)
|
|
|
- (match-string 1 old-date))))
|
|
|
- (if remove
|
|
|
- (progn
|
|
|
- (when (and old-date org-log-reschedule)
|
|
|
- (org-add-log-setup 'delschedule nil old-date 'findpos
|
|
|
- org-log-reschedule))
|
|
|
- (org-remove-timestamp-with-keyword org-scheduled-string)
|
|
|
- (message "Item is no longer scheduled."))
|
|
|
- (org-add-planning-info 'scheduled time 'closed)
|
|
|
- (when (and old-date org-log-reschedule
|
|
|
- (not (equal old-date
|
|
|
- (substring org-last-inserted-timestamp 1 -1))))
|
|
|
- (org-add-log-setup 'reschedule nil old-date 'findpos
|
|
|
- org-log-reschedule))
|
|
|
- (when repeater
|
|
|
- (save-excursion
|
|
|
- (org-back-to-heading t)
|
|
|
- (when (re-search-forward (concat org-scheduled-string " "
|
|
|
- org-last-inserted-timestamp)
|
|
|
- (save-excursion
|
|
|
- (outline-next-heading) (point)) t)
|
|
|
- (goto-char (1- (match-end 0)))
|
|
|
- (insert " " repeater)
|
|
|
- (setq org-last-inserted-timestamp
|
|
|
- (concat (substring org-last-inserted-timestamp 0 -1)
|
|
|
- " " repeater
|
|
|
- (substring org-last-inserted-timestamp -1))))))
|
|
|
- (message "Scheduled to %s" org-last-inserted-timestamp))))
|
|
|
+ (if (and (org-region-active-p) org-loop-over-headlines-in-active-region)
|
|
|
+ (let (org-loop-over-headlines-in-active-region)
|
|
|
+ (org-map-entries
|
|
|
+ `(org-schedule ',remove ,time) org-loop-over-headlines-in-active-region 'region (if (outline-invisible-p) (org-end-of-subtree nil t))))
|
|
|
+ (let* ((old-date (org-entry-get nil "SCHEDULED"))
|
|
|
+ (repeater (and old-date
|
|
|
+ (string-match
|
|
|
+ "\\([.+-]+[0-9]+[dwmy]\\(?:[/ ][-+]?[0-9]+[dwmy]\\)?\\) ?"
|
|
|
+ old-date)
|
|
|
+ (match-string 1 old-date))))
|
|
|
+ (if remove
|
|
|
+ (progn
|
|
|
+ (when (and old-date org-log-reschedule)
|
|
|
+ (org-add-log-setup 'delschedule nil old-date 'findpos
|
|
|
+ org-log-reschedule))
|
|
|
+ (org-remove-timestamp-with-keyword org-scheduled-string)
|
|
|
+ (message "Item is no longer scheduled."))
|
|
|
+ (org-add-planning-info 'scheduled time 'closed)
|
|
|
+ (when (and old-date org-log-reschedule
|
|
|
+ (not (equal old-date
|
|
|
+ (substring org-last-inserted-timestamp 1 -1))))
|
|
|
+ (org-add-log-setup 'reschedule nil old-date 'findpos
|
|
|
+ org-log-reschedule))
|
|
|
+ (when repeater
|
|
|
+ (save-excursion
|
|
|
+ (org-back-to-heading t)
|
|
|
+ (when (re-search-forward (concat org-scheduled-string " "
|
|
|
+ org-last-inserted-timestamp)
|
|
|
+ (save-excursion
|
|
|
+ (outline-next-heading) (point)) t)
|
|
|
+ (goto-char (1- (match-end 0)))
|
|
|
+ (insert " " repeater)
|
|
|
+ (setq org-last-inserted-timestamp
|
|
|
+ (concat (substring org-last-inserted-timestamp 0 -1)
|
|
|
+ " " repeater
|
|
|
+ (substring org-last-inserted-timestamp -1))))))
|
|
|
+ (message "Scheduled to %s" org-last-inserted-timestamp)))))
|
|
|
|
|
|
(defun org-get-scheduled-time (pom &optional inherit)
|
|
|
"Get the scheduled time as a time tuple, of a format suitable
|
|
@@ -12736,7 +12788,7 @@ only lines with a TODO keyword are included in the output."
|
|
|
(match-beginning 0) (match-beginning 1)))
|
|
|
(org-show-context 'tags-tree))
|
|
|
((eq action 'agenda)
|
|
|
- (setq txt (org-format-agenda-item
|
|
|
+ (setq txt (org-agenda-format-item
|
|
|
""
|
|
|
(concat
|
|
|
(if (eq org-tags-match-list-sublevels 'indented)
|
|
@@ -13292,7 +13344,7 @@ This works in the agenda, and also in an org-mode buffer."
|
|
|
(interactive
|
|
|
(list (region-beginning) (region-end)
|
|
|
(let ((org-last-tags-completion-table
|
|
|
- (if (org-mode-p)
|
|
|
+ (if (eq major-mode 'org-mode)
|
|
|
(org-get-buffer-tags)
|
|
|
(org-global-tags-completion-table))))
|
|
|
(org-icompleting-read
|
|
@@ -13311,7 +13363,7 @@ This works in the agenda, and also in an org-mode buffer."
|
|
|
(loop for l from l1 to l2 do
|
|
|
(org-goto-line l)
|
|
|
(setq m (get-text-property (point) 'org-hd-marker))
|
|
|
- (when (or (and (org-mode-p) (org-on-heading-p))
|
|
|
+ (when (or (and (eq major-mode 'org-mode) (org-on-heading-p))
|
|
|
(and agendap m))
|
|
|
(setq buf (if agendap (marker-buffer m) (current-buffer))
|
|
|
pos (if agendap m (point)))
|
|
@@ -13657,61 +13709,67 @@ with `org-get-tags-at'. If your function gets properties with
|
|
|
to t around the call to `org-entry-properties' to get the same speedup.
|
|
|
Note that if your function moves around to retrieve tags and properties at
|
|
|
a *different* entry, you cannot use these techniques."
|
|
|
- (let* ((org-agenda-archives-mode nil) ; just to make sure
|
|
|
- (org-agenda-skip-archived-trees (memq 'archive skip))
|
|
|
- (org-agenda-skip-comment-trees (memq 'comment skip))
|
|
|
- (org-agenda-skip-function
|
|
|
- (car (org-delete-all '(comment archive) skip)))
|
|
|
- (org-tags-match-list-sublevels t)
|
|
|
- matcher file res
|
|
|
- org-todo-keywords-for-agenda
|
|
|
- org-done-keywords-for-agenda
|
|
|
- org-todo-keyword-alist-for-agenda
|
|
|
- org-drawers-for-agenda
|
|
|
- org-tag-alist-for-agenda)
|
|
|
+ (unless (and (eq scope 'region) (not (org-region-active-p)))
|
|
|
+ (let* ((org-agenda-archives-mode nil) ; just to make sure
|
|
|
+ (org-agenda-skip-archived-trees (memq 'archive skip))
|
|
|
+ (org-agenda-skip-comment-trees (memq 'comment skip))
|
|
|
+ (org-agenda-skip-function
|
|
|
+ (car (org-delete-all '(comment archive) skip)))
|
|
|
+ (org-tags-match-list-sublevels t)
|
|
|
+ matcher file res
|
|
|
+ org-todo-keywords-for-agenda
|
|
|
+ org-done-keywords-for-agenda
|
|
|
+ org-todo-keyword-alist-for-agenda
|
|
|
+ org-drawers-for-agenda
|
|
|
+ org-tag-alist-for-agenda)
|
|
|
|
|
|
- (cond
|
|
|
- ((eq match t) (setq matcher t))
|
|
|
- ((eq match nil) (setq matcher t))
|
|
|
- (t (setq matcher (if match (cdr (org-make-tags-matcher match)) t))))
|
|
|
+ (cond
|
|
|
+ ((eq match t) (setq matcher t))
|
|
|
+ ((eq match nil) (setq matcher t))
|
|
|
+ (t (setq matcher (if match (cdr (org-make-tags-matcher match)) t))))
|
|
|
|
|
|
- (save-excursion
|
|
|
- (save-restriction
|
|
|
- (cond ((eq scope 'tree)
|
|
|
- (org-back-to-heading t)
|
|
|
- (org-narrow-to-subtree)
|
|
|
- (setq scope nil))
|
|
|
- ((and (eq scope 'region) (org-region-active-p))
|
|
|
- (narrow-to-region (region-beginning) (region-end))
|
|
|
- (setq scope nil)))
|
|
|
-
|
|
|
- (if (not scope)
|
|
|
- (progn
|
|
|
- (org-prepare-agenda-buffers
|
|
|
- (list (buffer-file-name (current-buffer))))
|
|
|
- (setq res (org-scan-tags func matcher)))
|
|
|
- ;; Get the right scope
|
|
|
- (cond
|
|
|
- ((and scope (listp scope) (symbolp (car scope)))
|
|
|
- (setq scope (eval scope)))
|
|
|
- ((eq scope 'agenda)
|
|
|
- (setq scope (org-agenda-files t)))
|
|
|
- ((eq scope 'agenda-with-archives)
|
|
|
- (setq scope (org-agenda-files t))
|
|
|
- (setq scope (org-add-archive-files scope)))
|
|
|
- ((eq scope 'file)
|
|
|
- (setq scope (list (buffer-file-name))))
|
|
|
- ((eq scope 'file-with-archives)
|
|
|
- (setq scope (org-add-archive-files (list (buffer-file-name))))))
|
|
|
- (org-prepare-agenda-buffers scope)
|
|
|
- (while (setq file (pop scope))
|
|
|
- (with-current-buffer (org-find-base-buffer-visiting file)
|
|
|
- (save-excursion
|
|
|
- (save-restriction
|
|
|
- (widen)
|
|
|
- (goto-char (point-min))
|
|
|
- (setq res (append res (org-scan-tags func matcher))))))))))
|
|
|
- res))
|
|
|
+ (save-excursion
|
|
|
+ (save-restriction
|
|
|
+ (cond ((eq scope 'tree)
|
|
|
+ (org-back-to-heading t)
|
|
|
+ (org-narrow-to-subtree)
|
|
|
+ (setq scope nil))
|
|
|
+ ((and (eq scope 'region) (org-region-active-p))
|
|
|
+ (narrow-to-region (region-beginning)
|
|
|
+ (save-excursion
|
|
|
+ (goto-char (region-end))
|
|
|
+ (unless (and (bolp) (org-at-heading-p))
|
|
|
+ (outline-next-heading))
|
|
|
+ (point)))
|
|
|
+ (setq scope nil)))
|
|
|
+
|
|
|
+ (if (not scope)
|
|
|
+ (progn
|
|
|
+ (org-prepare-agenda-buffers
|
|
|
+ (list (buffer-file-name (current-buffer))))
|
|
|
+ (setq res (org-scan-tags func matcher)))
|
|
|
+ ;; Get the right scope
|
|
|
+ (cond
|
|
|
+ ((and scope (listp scope) (symbolp (car scope)))
|
|
|
+ (setq scope (eval scope)))
|
|
|
+ ((eq scope 'agenda)
|
|
|
+ (setq scope (org-agenda-files t)))
|
|
|
+ ((eq scope 'agenda-with-archives)
|
|
|
+ (setq scope (org-agenda-files t))
|
|
|
+ (setq scope (org-add-archive-files scope)))
|
|
|
+ ((eq scope 'file)
|
|
|
+ (setq scope (list (buffer-file-name))))
|
|
|
+ ((eq scope 'file-with-archives)
|
|
|
+ (setq scope (org-add-archive-files (list (buffer-file-name))))))
|
|
|
+ (org-prepare-agenda-buffers scope)
|
|
|
+ (while (setq file (pop scope))
|
|
|
+ (with-current-buffer (org-find-base-buffer-visiting file)
|
|
|
+ (save-excursion
|
|
|
+ (save-restriction
|
|
|
+ (widen)
|
|
|
+ (goto-char (point-min))
|
|
|
+ (setq res (append res (org-scan-tags func matcher))))))))))
|
|
|
+ res)))
|
|
|
|
|
|
;;;; Properties
|
|
|
|
|
@@ -13881,7 +13939,7 @@ things up because then unnecessary parsing is avoided."
|
|
|
beg end range props sum-props key key1 value string clocksum)
|
|
|
(save-excursion
|
|
|
(when (condition-case nil
|
|
|
- (and (org-mode-p) (org-back-to-heading t))
|
|
|
+ (and (eq major-mode 'org-mode) (org-back-to-heading t))
|
|
|
(error nil))
|
|
|
(setq beg (point))
|
|
|
(setq sum-props (get-text-property (point) 'org-summaries))
|
|
@@ -16010,7 +16068,7 @@ Entries containing a colon are interpreted as H:MM by
|
|
|
"Save all Org-mode buffers without user confirmation."
|
|
|
(interactive)
|
|
|
(message "Saving all Org-mode buffers...")
|
|
|
- (save-some-buffers t 'org-mode-p)
|
|
|
+ (save-some-buffers t (lambda () (eq major-mode 'org-mode)))
|
|
|
(when (featurep 'org-id) (org-id-locations-save))
|
|
|
(message "Saving all Org-mode buffers... done"))
|
|
|
|
|
@@ -16034,7 +16092,7 @@ changes from another. I believe the procedure must be like this:
|
|
|
(save-window-excursion
|
|
|
(mapc
|
|
|
(lambda (b)
|
|
|
- (when (and (with-current-buffer b (org-mode-p))
|
|
|
+ (when (and (with-current-buffer b (eq major-mode 'org-mode))
|
|
|
(with-current-buffer b buffer-file-name))
|
|
|
(org-pop-to-buffer-same-window b)
|
|
|
(revert-buffer t 'no-confirm)))
|
|
@@ -16047,7 +16105,7 @@ changes from another. I believe the procedure must be like this:
|
|
|
;;;###autoload
|
|
|
(defun org-switchb (&optional arg)
|
|
|
"Switch between Org buffers.
|
|
|
-With a prefix argument, restrict available to files.
|
|
|
+With one prefix argument, restrict available buffers to files.
|
|
|
With two prefix arguments, restrict available buffers to agenda files.
|
|
|
|
|
|
Defaults to `iswitchb' for buffer name completion.
|
|
@@ -16086,17 +16144,17 @@ If EXCLUDE-TMP is non-nil, ignore temporary buffers."
|
|
|
(filter
|
|
|
(cond
|
|
|
((eq predicate 'files)
|
|
|
- (lambda (b) (with-current-buffer b (org-mode-p))))
|
|
|
+ (lambda (b) (with-current-buffer b (eq major-mode 'org-mode))))
|
|
|
((eq predicate 'export)
|
|
|
(lambda (b) (string-match "\*Org .*Export" (buffer-name b))))
|
|
|
((eq predicate 'agenda)
|
|
|
(lambda (b)
|
|
|
(with-current-buffer b
|
|
|
- (and (org-mode-p)
|
|
|
+ (and (eq major-mode 'org-mode)
|
|
|
(setq bfn (buffer-file-name b))
|
|
|
(member (file-truename bfn) agenda-files)))))
|
|
|
(t (lambda (b) (with-current-buffer b
|
|
|
- (or (org-mode-p)
|
|
|
+ (or (eq major-mode 'org-mode)
|
|
|
(string-match "\*Org .*Export"
|
|
|
(buffer-name b)))))))))
|
|
|
(delq nil
|
|
@@ -16352,7 +16410,8 @@ When a buffer is unmodified, it is just killed. When modified, it is saved
|
|
|
(if (org-on-heading-p t)
|
|
|
(add-text-properties (point-at-bol) (org-end-of-subtree t) pa))))
|
|
|
(goto-char (point-min))
|
|
|
- (setq re (concat org-outline-regexp-bol "+" org-comment-string "\\>"))
|
|
|
+ (setq re (format org-heading-keyword-regexp-format
|
|
|
+ org-comment-string))
|
|
|
(while (re-search-forward re nil t)
|
|
|
(add-text-properties
|
|
|
(match-beginning 0) (org-end-of-subtree t) pc)))
|
|
@@ -16398,7 +16457,7 @@ an embedded LaTeX fragment, let texmathp do its job.
|
|
|
(interactive)
|
|
|
(let (p)
|
|
|
(cond
|
|
|
- ((not (org-mode-p)) ad-do-it)
|
|
|
+ ((not (eq major-mode 'org-mode)) ad-do-it)
|
|
|
((eq this-command 'cdlatex-math-symbol)
|
|
|
(setq ad-return-value t
|
|
|
texmathp-why '("cdlatex-math-symbol in org-mode" . 0)))
|
|
@@ -18227,7 +18286,8 @@ See the individual commands for more information."
|
|
|
(org-indent-line-function)
|
|
|
(org-indent-line-to ind)))))
|
|
|
((and org-return-follows-link
|
|
|
- (eq (get-text-property (point) 'face) 'org-link))
|
|
|
+ (or (eq (get-text-property (point) 'face) 'org-link)
|
|
|
+ (memq 'org-link (get-text-property (point) 'face))))
|
|
|
(call-interactively 'org-open-at-point))
|
|
|
((and (org-at-heading-p)
|
|
|
(looking-at
|
|
@@ -18837,8 +18897,8 @@ Your bug report will be posted to the Org-mode mailing list.
|
|
|
(save-excursion
|
|
|
(while bl
|
|
|
(set-buffer (pop bl))
|
|
|
- (if (org-mode-p) (setq bl nil)))
|
|
|
- (when (org-mode-p)
|
|
|
+ (if (eq major-mode 'org-mode) (setq bl nil)))
|
|
|
+ (when (eq major-mode 'org-mode)
|
|
|
(easy-menu-change
|
|
|
'("Org") "File List for Agenda"
|
|
|
(append
|
|
@@ -19379,9 +19439,13 @@ position before START-RE (resp. after END-RE)."
|
|
|
(cons beg end))))))
|
|
|
|
|
|
(defun org-in-block-p (names)
|
|
|
- "Is point inside any block whose name belongs to NAMES?
|
|
|
+ "Non-nil when point belongs to a block whose name belongs to NAMES.
|
|
|
+
|
|
|
+NAMES is a list of strings containing names of blocks.
|
|
|
|
|
|
-NAMES is a list of strings containing names of blocks."
|
|
|
+Return first block name matched, or nil. Beware that in case of
|
|
|
+nested blocks, the returned name may not belong to the closest
|
|
|
+block from point."
|
|
|
(save-match-data
|
|
|
(catch 'exit
|
|
|
(let ((case-fold-search t)
|
|
@@ -19393,7 +19457,7 @@ NAMES is a list of strings containing names of blocks."
|
|
|
(concat "^[ \t]*#\\+begin_" n)
|
|
|
(concat "^[ \t]*#\\+end_" n)
|
|
|
lim-up lim-down)
|
|
|
- (throw 'exit t))))
|
|
|
+ (throw 'exit n))))
|
|
|
names))
|
|
|
nil)))
|
|
|
|
|
@@ -19424,18 +19488,18 @@ NAMES is a list of strings containing names of blocks."
|
|
|
;; Emacs 23
|
|
|
(add-hook 'occur-mode-find-occurrence-hook
|
|
|
(lambda ()
|
|
|
- (when (org-mode-p)
|
|
|
+ (when (eq major-mode 'org-mode)
|
|
|
(org-reveal))))
|
|
|
;; Emacs 22
|
|
|
(defadvice occur-mode-goto-occurrence
|
|
|
(after org-occur-reveal activate)
|
|
|
- (and (org-mode-p) (org-reveal)))
|
|
|
+ (and (eq major-mode 'org-mode) (org-reveal)))
|
|
|
(defadvice occur-mode-goto-occurrence-other-window
|
|
|
(after org-occur-reveal activate)
|
|
|
- (and (org-mode-p) (org-reveal)))
|
|
|
+ (and (eq major-mode 'org-mode) (org-reveal)))
|
|
|
(defadvice occur-mode-display-occurrence
|
|
|
(after org-occur-reveal activate)
|
|
|
- (when (org-mode-p)
|
|
|
+ (when (eq major-mode 'org-mode)
|
|
|
(let ((pos (occur-mode-find-occurrence)))
|
|
|
(with-current-buffer (marker-buffer pos)
|
|
|
(save-excursion
|
|
@@ -20020,13 +20084,16 @@ this line is also exported in fixed-width font."
|
|
|
(forward-line 1)))
|
|
|
(save-excursion
|
|
|
(org-back-to-heading)
|
|
|
- (if (looking-at (concat org-outline-regexp
|
|
|
- "\\( *\\<" org-quote-string "\\>[ \t]*\\)"))
|
|
|
- (replace-match "" t t nil 1)
|
|
|
- (if (looking-at org-outline-regexp)
|
|
|
- (progn
|
|
|
- (goto-char (match-end 0))
|
|
|
- (insert org-quote-string " "))))))))
|
|
|
+ (cond
|
|
|
+ ((looking-at (format org-heading-keyword-regexp-format
|
|
|
+ org-quote-string))
|
|
|
+ (goto-char (match-end 1))
|
|
|
+ (looking-at (concat " +" org-quote-string))
|
|
|
+ (replace-match "" t t)
|
|
|
+ (when (eolp) (insert " ")))
|
|
|
+ ((looking-at org-outline-regexp)
|
|
|
+ (goto-char (match-end 0))
|
|
|
+ (insert org-quote-string " ")))))))
|
|
|
|
|
|
(defun org-reftex-citation ()
|
|
|
"Use reftex-citation to insert a citation into the buffer.
|
|
@@ -20345,8 +20412,9 @@ empty."
|
|
|
(save-excursion
|
|
|
(beginning-of-line 1)
|
|
|
(let ((case-fold-search nil))
|
|
|
- (looking-at (concat "^\\(\\*+\\)[ \t]+\\(" org-todo-regexp
|
|
|
- "\\)?[ \t]*$"))))))
|
|
|
+ (looking-at org-todo-line-regexp)))
|
|
|
+ (string= (match-string 3) "")))
|
|
|
+
|
|
|
(defun org-at-heading-or-item-p ()
|
|
|
(or (org-on-heading-p) (org-at-item-p)))
|
|
|
|
|
@@ -20491,7 +20559,7 @@ If there is no such heading, return nil."
|
|
|
(org-back-to-heading invisible-OK)
|
|
|
(let ((first t)
|
|
|
(level (funcall outline-level)))
|
|
|
- (if (and (org-mode-p) (< level 1000))
|
|
|
+ (if (and (eq major-mode 'org-mode) (< level 1000))
|
|
|
;; A true heading (not a plain list item), in Org-mode
|
|
|
;; This means we can easily find the end by looking
|
|
|
;; only for the right number of stars. Using a regexp to do
|
|
@@ -20516,7 +20584,7 @@ If there is no such heading, return nil."
|
|
|
|
|
|
(defadvice outline-end-of-subtree (around prefer-org-version activate compile)
|
|
|
"Use Org version in org-mode, for dramatic speed-up."
|
|
|
- (if (org-mode-p)
|
|
|
+ (if (eq major-mode 'org-mode)
|
|
|
(progn
|
|
|
(org-end-of-subtree nil t)
|
|
|
(unless (eobp) (backward-char 1)))
|
|
@@ -20688,7 +20756,7 @@ Show the heading too, if it is currently invisible."
|
|
|
'(progn
|
|
|
(add-hook 'imenu-after-jump-hook
|
|
|
(lambda ()
|
|
|
- (if (org-mode-p)
|
|
|
+ (if (eq major-mode 'org-mode)
|
|
|
(org-show-context 'org-goto))))))
|
|
|
|
|
|
(defun org-link-display-format (link)
|
|
@@ -20749,7 +20817,7 @@ To get rid of the restriction, use \\[org-agenda-remove-restriction-lock]."
|
|
|
(with-current-buffer (find-file-noselect
|
|
|
(let ((default-directory dir))
|
|
|
(expand-file-name txt)))
|
|
|
- (unless (org-mode-p)
|
|
|
+ (unless (eq major-mode 'org-mode)
|
|
|
(error "Cannot restrict to non-Org-mode file"))
|
|
|
(org-agenda-set-restriction-lock 'file)))
|
|
|
(t (error "Don't know how to restrict Org-mode's agenda")))
|
|
@@ -20766,7 +20834,7 @@ To get rid of the restriction, use \\[org-agenda-remove-restriction-lock]."
|
|
|
(define-key speedbar-file-key-map ">" 'org-agenda-remove-restriction-lock)
|
|
|
(define-key speedbar-file-key-map "\C-c\C-x>" 'org-agenda-remove-restriction-lock)
|
|
|
(add-hook 'speedbar-visiting-tag-hook
|
|
|
- (lambda () (and (org-mode-p) (org-show-context 'org-goto))))))
|
|
|
+ (lambda () (and (eq major-mode 'org-mode) (org-show-context 'org-goto))))))
|
|
|
|
|
|
;;; Fixes and Hacks for problems with other packages
|
|
|
|
|
@@ -20809,12 +20877,12 @@ To get rid of the restriction, use \\[org-agenda-remove-restriction-lock]."
|
|
|
(eval-after-load "ecb"
|
|
|
'(defadvice ecb-method-clicked (after esf/org-show-context activate)
|
|
|
"Make hierarchy visible when jumping into location from ECB tree buffer."
|
|
|
- (if (org-mode-p)
|
|
|
+ (if (eq major-mode 'org-mode)
|
|
|
(org-show-context))))
|
|
|
|
|
|
(defun org-bookmark-jump-unhide ()
|
|
|
"Unhide the current position, to show the bookmark location."
|
|
|
- (and (org-mode-p)
|
|
|
+ (and (eq major-mode 'org-mode)
|
|
|
(or (outline-invisible-p)
|
|
|
(save-excursion (goto-char (max (point-min) (1- (point))))
|
|
|
(outline-invisible-p)))
|