From 801a68c874777439a2eb06247891e1d1082c59c7 Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Wed, 11 Apr 2012 12:59:50 +0200 Subject: Sync with Org 7.8.09 (bugfix release) --- lisp/org/ChangeLog | 47 ++++++++++++++++++++++++++++++++++++++++++ lisp/org/ob-C.el | 2 +- lisp/org/org-agenda.el | 14 +++++++++---- lisp/org/org-clock.el | 15 +++++++------- lisp/org/org-footnote.el | 2 +- lisp/org/org-pcomplete.el | 4 ++-- lisp/org/org-special-blocks.el | 12 +++++------ lisp/org/org-table.el | 13 ++++++++---- lisp/org/org.el | 40 +++++++++++++++++------------------ 9 files changed, 104 insertions(+), 45 deletions(-) (limited to 'lisp/org') diff --git a/lisp/org/ChangeLog b/lisp/org/ChangeLog index 618d5753a46..0e80ea2fa2e 100644 --- a/lisp/org/ChangeLog +++ b/lisp/org/ChangeLog @@ -1,3 +1,50 @@ +2012-04-11 Bastien Guerry + + * org.el (org-point-at-end-of-empty-headline): Only try to match + ̀org-todo-line-regexp' when the value is non-nil, e.g. in non-org + modes. + (org-fontify-meta-lines-and-blocks-1): Prevent errors when trying + to fontify beyond (point-max). + + * org-clock.el (org-clock-task-overrun-text) + (org-task-overrun, org-clock-get-clock-string) + (org-clock-update-mode-line) + (org-clock-notify-once-if-expired): Rename `org-task-overrun' + and `org-task-overrun-text' to `org-clock-task-overrun' and + `org-clock-task-overrun-text' respectively. + (org-task-overrun-text): New alias. + + * org-table.el (org-table-eval-formula): Fix bug about handling + remote references as durations. + (org-table-get-range): Fix bug: make sure references to $0 are + correctly handled. + + * org-pcomplete.el (pcomplete/org-mode/file-option): Fix bug in + `pcomplete/org-mode/file-option'. + (org-thing-at-point): Also match line options like LATEX_CLASS + when pcompleting from LATEX_. + + * org-agenda.el (org-agenda-filter-make-matcher) + (org-agenda-filter-apply): Allow filtering entries out by + category. Using `C-u <' from the agenda view will redisplay + the agenda without entries from categories of the current + line. + +2012-04-11 Eric Schulte + + * ob-C.el (org-babel-C-ensure-main-wrap): Add an explicit return + to automatically generated main methods. + +2012-04-11 Matt Lundin + + * org.el (org-after-todo-state-change-hook): Fix docstring to + reflect name change of state to `org-state'. + +2012-04-11 Mike Sperber (tiny change) + + * org-footnote.el (org-footnote-normalize): Correctly pass keyword + arguments to `org-export-preprocess-string'. + 2012-04-03 Bastien Guerry * org.el (org-todo): Fix regression: rename `state' to diff --git a/lisp/org/ob-C.el b/lisp/org/ob-C.el index 5f6c1cb1dd1..583510ac618 100644 --- a/lisp/org/ob-C.el +++ b/lisp/org/ob-C.el @@ -152,7 +152,7 @@ it's header arguments." "Wrap body in a \"main\" function call if none exists." (if (string-match "^[ \t]*[intvod]+[ \t\n\r]*main[ \t]*(.*)" body) body - (format "int main() {\n%s\n}\n" body))) + (format "int main() {\n%s\nreturn(0);\n}\n" body))) (defun org-babel-prep-session:C (session params) "This function does nothing as C is a compiled language with no diff --git a/lisp/org/org-agenda.el b/lisp/org/org-agenda.el index 324ddd27f9a..3bb0fc84897 100644 --- a/lisp/org/org-agenda.el +++ b/lisp/org/org-agenda.el @@ -6365,7 +6365,9 @@ to switch to narrowing." (dolist (x (delete-dups (append (get 'org-agenda-category-filter :preset-filter) org-agenda-category-filter))) - (setq f1 (list 'equal (substring x 1) 'cat)) + (if (equal "-" (substring x 0 1)) + (setq f1 (list 'not (list 'equal (substring x 1) 'cat))) + (setq f1 (list 'equal (substring x 1) 'cat))) (push f1 f)) (cons 'and (nreverse f)))) @@ -6396,9 +6398,13 @@ If the line does not have an effort defined, return nil." (let (tags cat) (if (eq type 'tag) (setq org-agenda-tag-filter filter) - (setq org-agenda-category-filter filter - org-agenda-filtered-by-category t)) + (setq org-agenda-category-filter filter)) (setq org-agenda-filter-form (org-agenda-filter-make-matcher)) + (if (and (eq type 'category) + (not (equal (substring (car filter) 0 1) "-"))) + ;; Only set `org-agenda-filtered-by-category' to t + ;; when a unique category is used as the filter + (setq org-agenda-filtered-by-category t)) (org-agenda-set-mode-name) (save-excursion (goto-char (point-min)) @@ -6412,7 +6418,7 @@ If the line does not have an effort defined, return nil." (beginning-of-line 2)) (beginning-of-line 2)))) (if (get-char-property (point) 'invisible) - (org-agenda-previous-line)))) + (ignore-errors (org-agenda-previous-line))))) (defun org-agenda-filter-hide-line (type) (let (ov) diff --git a/lisp/org/org-clock.el b/lisp/org/org-clock.el index 7105bfe13dc..434f6a1d5f6 100644 --- a/lisp/org/org-clock.el +++ b/lisp/org/org-clock.el @@ -219,7 +219,8 @@ auto Automatically, either `all', or `repeat' for repeating tasks" (const :tag "All task time" all) (const :tag "Automatically, `all' or since `repeat'" auto))) -(defcustom org-task-overrun-text nil +(defvaralias 'org-task-overrun-text 'org-clock-task-overrun-text) +(defcustom org-clock-task-overrun-text nil "The extra modeline text that should indicate that the clock is overrun. The can be nil to indicate that instead of adding text, the clock time should get a different face (`org-mode-line-clock-overrun'). @@ -495,7 +496,7 @@ pointing to it." (insert (format "[%c] %-15s %s\n" i cat task)) (cons i marker))))) -(defvar org-task-overrun nil +(defvar org-clock-task-overrun nil "Internal flag indicating if the clock has overrun the planned time.") (defvar org-clock-update-period 60 "Number of seconds between mode line clock string updates.") @@ -516,7 +517,7 @@ If not, show simply the clocked time like 01:50." (work-done-str (org-propertize (format org-time-clocksum-format h m) - 'face (if (and org-task-overrun (not org-task-overrun-text)) + 'face (if (and org-clock-task-overrun (not org-clock-task-overrun-text)) 'org-mode-line-clock-overrun 'org-mode-line-clock))) (effort-str (format org-time-clocksum-format effort-h effort-m)) (clockstr (org-propertize @@ -532,7 +533,7 @@ If not, show simply the clocked time like 01:50." (defun org-clock-update-mode-line () (if org-clock-effort (org-clock-notify-once-if-expired) - (setq org-task-overrun nil)) + (setq org-clock-task-overrun nil)) (setq org-mode-line-string (org-propertize (let ((clock-string (org-clock-get-clock-string)) @@ -546,10 +547,10 @@ If not, show simply the clocked time like 01:50." 'local-map org-clock-mode-line-map 'mouse-face (if (featurep 'xemacs) 'highlight 'mode-line-highlight) )) - (if (and org-task-overrun org-task-overrun-text) + (if (and org-clock-task-overrun org-clock-task-overrun-text) (setq org-mode-line-string (concat (org-propertize - org-task-overrun-text + org-clock-task-overrun-text 'face 'org-mode-line-clock-overrun) org-mode-line-string))) (force-mode-line-update)) @@ -606,7 +607,7 @@ Notification is shown only once." (when (org-clocking-p) (let ((effort-in-minutes (org-duration-string-to-minutes org-clock-effort)) (clocked-time (org-clock-get-clocked-time))) - (if (setq org-task-overrun + (if (setq org-clock-task-overrun (if (or (null effort-in-minutes) (zerop effort-in-minutes)) nil (>= clocked-time effort-in-minutes))) diff --git a/lisp/org/org-footnote.el b/lisp/org/org-footnote.el index 34fc31f39d6..9319e0813c0 100644 --- a/lisp/org/org-footnote.el +++ b/lisp/org/org-footnote.el @@ -704,7 +704,7 @@ Additional note on `org-footnote-insert-pos-for-preprocessor': (org-combine-plists export-props '(:todo-keywords t :tags t :priority t)))) - (org-export-preprocess-string def parameters)) + (apply #'org-export-preprocess-string def parameters)) def) ;; Reference beginning position is a marker ;; to preserve it during further buffer diff --git a/lisp/org/org-pcomplete.el b/lisp/org/org-pcomplete.el index 0ca8777878c..5950d8e26da 100644 --- a/lisp/org/org-pcomplete.el +++ b/lisp/org/org-pcomplete.el @@ -69,7 +69,7 @@ The return value is a string naming the thing at point." (re-search-backward "^[ \t]*#\\+\\([A-Z_]+\\):.*" (line-beginning-position) t)) (cons "file-option" (match-string-no-properties 1))) - ((string-match "\\`[ \t]*#\\+[a-zA-Z]*\\'" line-to-here) + ((string-match "\\`[ \t]*#\\+[a-zA-Z_]*\\'" line-to-here) (cons "file-option" nil)) ((equal (char-before beg) ?\[) (cons "link" nil)) @@ -144,7 +144,7 @@ When completing for #+STARTUP, for example, this function returns (if (string-match "^#\\+\\([A-Z_]+:?\\)" x) (match-string 1 x))) (org-split-string (org-get-current-options) "\n")) - org-additional-option-like-keywords))))) + (copy-sequence org-additional-option-like-keywords)))))) (substring pcomplete-stub 2))) (defvar org-startup-options) diff --git a/lisp/org/org-special-blocks.el b/lisp/org/org-special-blocks.el index 5bf8362357f..43b37c64016 100644 --- a/lisp/org/org-special-blocks.el +++ b/lisp/org/org-special-blocks.el @@ -80,17 +80,17 @@ seen. This is run after a few special cases are taken care of." (add-hook 'org-export-latex-after-blockquotes-hook 'org-special-blocks-convert-latex-special-cookies) -(defvar org-special-blocks-line) +(defvar line) (defun org-special-blocks-convert-html-special-cookies () "Converts the special cookies into div blocks." - ;; Uses the dynamically-bound variable `org-special-blocks-line'. - (when (string-match "^ORG-\\(.*\\)-\\(START\\|END\\)$" org-special-blocks-line) + ;; Uses the dynamically-bound variable `line'. + (when (string-match "^ORG-\\(.*\\)-\\(START\\|END\\)$" line) (message "%s" (match-string 1)) - (when (equal (match-string 2 org-special-blocks-line) "START") + (when (equal (match-string 2 line) "START") (org-close-par-maybe) - (insert "\n
") + (insert "\n
") (org-open-par)) - (when (equal (match-string 2 org-special-blocks-line) "END") + (when (equal (match-string 2 line) "END") (org-close-par-maybe) (insert "\n
") (org-open-par)) diff --git a/lisp/org/org-table.el b/lisp/org/org-table.el index ae12cee2abe..08981b57e49 100644 --- a/lisp/org/org-table.el +++ b/lisp/org/org-table.el @@ -2526,8 +2526,13 @@ not overwrite the stored one." (replace-match (save-match-data (org-table-make-reference - (org-table-get-remote-range - (match-string 1 form) (match-string 2 form)) + (let ((rmtrng (org-table-get-remote-range + (match-string 1 form) (match-string 2 form)))) + (if duration + (if (listp rmtrng) + (mapcar (lambda(x) (org-table-time-string-to-seconds x)) rmtrng) + (org-table-time-string-to-seconds rmtrng)) + rmtrng)) keep-empty numbers lispp)) t t form))) ;; Insert complex ranges @@ -2663,8 +2668,8 @@ in the buffer and column1 and column2 are table column numbers." ; (setq r2 (or r2 r1) c2 (or c2 c1)) (if (not r1) (setq r1 thisline)) (if (not r2) (setq r2 thisline)) - (if (not c1) (setq c1 col)) - (if (not c2) (setq c2 col)) + (if (or (not c1) (= 0 c1)) (setq c1 col)) + (if (or (not c2) (= 0 c2)) (setq c2 col)) (if (and (not corners-only) (or (not rangep) (and (= r1 r2) (= c1 c2)))) ;; just one field diff --git a/lisp/org/org.el b/lisp/org/org.el index 0f13223d0c1..c2cc2354439 100644 --- a/lisp/org/org.el +++ b/lisp/org/org.el @@ -6,7 +6,7 @@ ;; Maintainer: Bastien Guerry ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 7.8.08 +;; Version: 7.8.09 ;; ;; This file is part of GNU Emacs. ;; @@ -206,7 +206,7 @@ identifier." ;;; Version -(defconst org-version "7.8.08" +(defconst org-version "7.8.09" "The version number of the file org.el.") ;;;###autoload @@ -2225,7 +2225,7 @@ property and include the word \"recursive\" into the value." (defcustom org-after-todo-state-change-hook nil "Hook which is run after the state of a TODO item was changed. The new state (a string with a TODO keyword, or nil) is available in the -Lisp variable `state'." +Lisp variable `org-state'." :group 'org-todo :type 'hook) @@ -5427,7 +5427,8 @@ will be prompted for." (when (re-search-forward (concat "^[ \t]*#\\+end" (match-string 4) "\\>.*") nil t) ;; on purpose, we look further than LIMIT - (setq end (match-end 0) end1 (1- (match-beginning 0))) + (setq end (min (point-max) (match-end 0)) + end1 (min (point-max) (1- (match-beginning 0)))) (setq block-end (match-beginning 0)) (when quoting (remove-text-properties beg end @@ -5455,11 +5456,12 @@ will be prompted for." '(face org-block))) ; end of source block ((not org-fontify-quote-and-verse-blocks)) ((string= block-type "quote") - (add-text-properties beg1 (1+ end1) '(face org-quote))) + (add-text-properties beg1 (min (point-max) (1+ end1)) '(face org-quote))) ((string= block-type "verse") - (add-text-properties beg1 (1+ end1) '(face org-verse)))) + (add-text-properties beg1 (min (point-max) (1+ end1)) '(face org-verse)))) (add-text-properties beg beg1 '(face org-block-begin-line)) - (add-text-properties (1+ end) (1+ end1) '(face org-block-end-line)) + (add-text-properties (min (point-max) (1+ end)) (min (point-max) (1+ end1)) + '(face org-block-end-line)) t)) ((member dc1 '("title:" "author:" "email:" "date:")) (add-text-properties @@ -5475,7 +5477,7 @@ will be prompted for." ((not (member (char-after beg) '(?\ ?\t))) ;; just any other in-buffer setting, but not indented (add-text-properties - beg (1+ (match-end 0)) + beg (match-end 0) '(font-lock-fontified t face org-meta-line)) t) ((or (member dc1 '("begin:" "end:" "caption:" "label:" @@ -13422,8 +13424,7 @@ With prefix ARG, realign all tags in headings in the current buffer." ;; Get a new set of tags from the user (save-excursion (setq table (append org-tag-persistent-alist - org-tag-alist - (org-get-buffer-tags) + (or org-tag-alist (org-get-buffer-tags)) (and org-complete-tags-always-offer-all-agenda-tags (org-global-tags-completion-table @@ -13725,11 +13726,9 @@ Returns the new tags string, or nil to not change the current settings." (condition-case nil (setq tg (org-icompleting-read "Tag: " - (delete-dups - (append (or buffer-tags - (with-current-buffer buf - (mapcar 'car (org-get-buffer-tags)))) - (mapcar 'car table))))) + (or buffer-tags + (with-current-buffer buf + (org-get-buffer-tags))))) (quit (setq tg ""))) (when (string-match "\\S-" tg) (add-to-list 'buffer-tags (list tg)) @@ -20775,11 +20774,12 @@ This version does not only check the character property, but also If the heading only contains a TODO keyword, it is still still considered empty." (and (looking-at "[ \t]*$") - (save-excursion - (beginning-of-line 1) - (let ((case-fold-search nil)) - (looking-at org-todo-line-regexp))) - (string= (match-string 3) ""))) + (when org-todo-line-regexp + (save-excursion + (beginning-of-line 1) + (let ((case-fold-search nil)) + (looking-at org-todo-line-regexp) + (string= (match-string 3) "")))))) (defun org-at-heading-or-item-p () (or (org-at-heading-p) (org-at-item-p))) -- cgit v1.2.1