diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog index 3e56e06..0c6aad9 100644 --- a/doc/misc/ChangeLog +++ b/doc/misc/ChangeLog @@ -1,3 +1,7 @@ +2012-05-16 Bastien Guerry + + * org.texi (Durations and time values): Fix typo. + 2012-05-14 Andreas Schwab * cc-mode.texi: Avoid space before macro in 4th argument of cross Modified doc/misc/org.texi diff --git a/doc/misc/org.texi b/doc/misc/org.texi index 775ff63..3b68ae5 100644 --- a/doc/misc/org.texi +++ b/doc/misc/org.texi @@ -286,7 +286,7 @@ license to the document, as described in section 6 of the license. @end quotation @end copying address@hidden Emacs editing modes address@hidden Emacs @direntry * Org Mode: (org). Outline-based notes management and organizer @end direntry @@ -2625,7 +2625,7 @@ formulas or Elisp formulas: Input duration values must be of the form @code{[HH:MM[:SS]}, where seconds are optional. With the @code{T} flag, computed durations will be displayed -as @code{[HH:MM:SS} (see the first formula above). With the @code{t} flag, +as @code{HH:MM:SS} (see the first formula above). With the @code{t} flag, computed durations will be displayed according to the value of the variable @code{org-table-duration-custom-format}, which defaults to @code{'hours} and will display the result as a fraction of hours (see the second formula in the @@ -7900,9 +7900,9 @@ Interactively select another agenda view and append it to the current view. Delete other windows. @c @orgcmdkskc{v d,d,org-agenda-day-view} address@hidden w,w,org-agenda-day-view} address@hidden w,w,org-agenda-week-view} @xorgcmd{v m,org-agenda-month-view} address@hidden y,org-agenda-month-year} address@hidden y,org-agenda-year-view} @xorgcmd{v SPC,org-agenda-reset-view} @vindex org-agenda-span Switch to day/week/month/year view. When switching to day or week view, this Modified lisp/org/ChangeLog diff --git a/lisp/org/ChangeLog b/lisp/org/ChangeLog index 8cdc901..82175c3 100644 --- a/lisp/org/ChangeLog +++ b/lisp/org/ChangeLog @@ -1,3 +1,79 @@ +2012-05-16 Bastien Guerry + + * org.el (org-scan-tags): Correctly match TODO keywords. + +2012-05-16 Nicolas Goaziou + + * org-list.el (org-list-struct): Fix white spaces. + (org-list-swap-items, org-list-send-item): Fix visibility + preservation. + +2012-05-16 Nicolas Goaziou + + * org-list.el (org-list-swap-items, org-list-send-item): Preserve + visibility when moving items. + +2012-05-16 Mark E. Shoulson (tiny change) + + * org.el (org-fontify-entities): Hide {} when prettifying + entities. + +2012-05-16 Bastien Guerry + + * org.el (org-cycle-internal-global): Prevent the display of + messages when cycling from with a Gnus article buffer. + +2012-05-16 Bastien Guerry + + * org-table.el (org-table-time-seconds-to-string): Fix bug about + handling a negative duration value. + +2012-05-16 Nicolas Goaziou + + * org.el (org-link-expand-abbrev): Fix docstring. + +2012-05-16 Nicolas Goaziou + + * org.el (org-translate-link): Fix bug. + +2012-05-16 Bastien Guerry + + * org-agenda.el (org-agenda-bulk-mark-regexp): Fix bug when + setting the number of marked entries. + +2012-05-16 Bastien Guerry + + * org-table.el (org-tbl-calc-modes): Rename from + `org-table-modes'. + (org-set-calc-mode, org-table-eval-formula): Use it. + +2012-05-16 Eric Schulte + + * ob.el (org-babel-find-named-result): Fix bug finding empty named + results. + +2012-05-16 Nicolas Goaziou + + * org.el (org-set-regexps-and-options): Fix + `org-planning-or-clock-line-re' regexp. Indeed "\\>" will never + match since time keywords must end with colons, which are not word + constituent. + +2012-05-16 Bastien Guerry + + * org-ctags.el (org-ctags-new-topic-template): Fix the option + default value back again. + +2012-05-16 Eric Schulte + + * org-bibtex.el (org-bibtex-export-to-kill-ring): Don't rely on + kill-new to return a string. + +2012-05-16 Eric Schulte + + * org-bibtex.el (org-bibtex-headline): Remove call to + bibtex-reformat which often hangs. + 2012-04-27 Glenn Morris * org-ctags.el (org-ctags-new-topic-template): Modified lisp/org/ob.el diff --git a/lisp/org/ob.el b/lisp/org/ob.el index ac6de9f..f3b7d68 100644 --- a/lisp/org/ob.el +++ b/lisp/org/ob.el @@ -1498,7 +1498,7 @@ buffer or nil if no such result exists." (catch 'is-a-code-block (when (re-search-forward (concat org-babel-result-regexp - "[ \t]" (regexp-quote name) "[ \t\n\f\v\r]+") nil t) + "[ \t]" (regexp-quote name) "[ \t]*[\n\f\v\r]") nil t) (when (and (string= "name" (downcase (match-string 1))) (or (beginning-of-line 1) (looking-at org-babel-src-block-regexp) Modified lisp/org/org-agenda.el diff --git a/lisp/org/org-agenda.el b/lisp/org/org-agenda.el index ddb56ca..367d8e8 100644 --- a/lisp/org/org-agenda.el +++ b/lisp/org/org-agenda.el @@ -8315,13 +8315,13 @@ This is a command that has to be installed in `calendar-mode-map'." (defun org-agenda-bulk-mark-regexp (regexp) "Mark entries match REGEXP." (interactive "sMark entries matching regexp: ") - (let (entries-marked) + (let ((entries-marked 0)) (save-excursion (goto-char (point-min)) (goto-char (next-single-property-change (point) 'txt)) (while (re-search-forward regexp nil t) (when (string-match regexp (get-text-property (point) 'txt)) - (setq entries-marked (+ entries-marked 1)) + (setq entries-marked (1+ entries-marked)) (call-interactively 'org-agenda-bulk-mark)))) (if (not entries-marked) (message "No entry matching this regexp.")))) Modified lisp/org/org-bibtex.el diff --git a/lisp/org/org-bibtex.el b/lisp/org/org-bibtex.el index 21e36a7..4c852fc 100644 --- a/lisp/org/org-bibtex.el +++ b/lisp/org/org-bibtex.el @@ -369,7 +369,7 @@ This variable is relevant only if `org-bibtex-export-tags-as-keywords` is t." (progn (goto-char (match-end 1)) (insert ", ")) (bibtex-make-field "keywords" t t)) (insert (mapconcat #'identity tags ", "))) - (bibtex-reformat) (buffer-string))))))) + (buffer-string))))))) (defun org-bibtex-ask (field) (unless (assoc field org-bibtex-fields) @@ -661,7 +661,8 @@ This uses `bibtex-parse-entry'." (defun org-bibtex-export-to-kill-ring () "Export current headline to kill ring as bibtex entry." (interactive) - (kill-new (org-bibtex-headline))) + (let ((result (org-bibtex-headline))) + (kill-new result) result)) (defun org-bibtex-search (string) "Search for bibliographical entries in agenda files. Modified lisp/org/org-list.el diff --git a/lisp/org/org-list.el b/lisp/org/org-list.el index 4498280..8d39486 100644 --- a/lisp/org/org-list.el +++ b/lisp/org/org-list.el @@ -714,15 +714,15 @@ Assume point is at an item." ;; equally indented than BEG-CELL's cdr. Also, store ending ;; position of items in END-LST-2. (catch 'exit - (while t - (let ((ind (+ (or (get-text-property (point) 'original-indentation) 0) + (while t + (let ((ind (+ (or (get-text-property (point) 'original-indentation) 0) (org-get-indentation)))) - (cond - ((>= (point) lim-down) + (cond + ((>= (point) lim-down) ;; At downward limit: this is de facto the end of the ;; list. Save point as an ending position, and jump to ;; part 3. - (throw 'exit + (throw 'exit (push (cons 0 (funcall end-before-blank)) end-lst-2))) ;; At a verbatim block, move to its end. Point is at bol ;; and 'org-example property is set by whole lines: @@ -1071,8 +1071,10 @@ It determines the number of whitespaces to append by looking at (defun org-list-swap-items (beg-A beg-B struct) "Swap item starting at BEG-A with item starting at BEG-B in STRUCT. -Blank lines at the end of items are left in place. Return the -new structure after the changes. + +Blank lines at the end of items are left in place. Item +visibility is preserved. Return the new structure after the +changes. Assume BEG-A is lesser than BEG-B and that BEG-A and BEG-B belong to the same sub-list. @@ -1089,7 +1091,17 @@ This function modifies STRUCT." (body-B (buffer-substring beg-B end-B-no-blank)) (between-A-no-blank-and-B (buffer-substring end-A-no-blank beg-B)) (sub-A (cons beg-A (org-list-get-subtree beg-A struct))) - (sub-B (cons beg-B (org-list-get-subtree beg-B struct)))) + (sub-B (cons beg-B (org-list-get-subtree beg-B struct))) + ;; Store overlays responsible for visibility status. We + ;; also need to store their boundaries as they will be + ;; removed from buffer. + (overlays (cons + (mapcar (lambda (ov) + (list ov (overlay-start ov) (overlay-end ov))) + (overlays-in beg-A end-A)) + (mapcar (lambda (ov) + (list ov (overlay-start ov) (overlay-end ov))) + (overlays-in beg-B end-B))))) ;; 1. Move effectively items in buffer. (goto-char beg-A) (delete-region beg-A end-B-no-blank) @@ -1122,7 +1134,22 @@ This function modifies STRUCT." (setcar e (+ pos (- size-B size-A))) (setcar (nthcdr 6 e) (+ end-e (- size-B size-A)))))))) struct) - (sort struct (lambda (e1 e2) (< (car e1) (car e2))))))) + (setq struct (sort struct (lambda (e1 e2) (< (car e1) (car e2))))) + ;; Restore visibility status, by moving overlays to their new + ;; position. + (mapc (lambda (ov) + (move-overlay + (car ov) + (+ (nth 1 ov) (- (+ beg-B (- size-B size-A)) beg-A)) + (+ (nth 2 ov) (- (+ beg-B (- size-B size-A)) beg-A)))) + (car overlays)) + (mapc (lambda (ov) + (move-overlay (car ov) + (+ (nth 1 ov) (- beg-A beg-B)) + (+ (nth 2 ov) (- beg-A beg-B)))) + (cdr overlays)) + ;; Return structure. + struct))) (defun org-list-separating-blank-lines-number (pos struct prevs) "Return number of blank lines that should separate items in list. @@ -1340,8 +1367,8 @@ If DEST is a buffer position, the function will assume it points to another item in the same list as ITEM, and will move the latter just before the former. -If DEST is `begin' \(respectively `end'\), ITEM will be moved at -the beginning \(respectively end\) of the list it belongs to. +If DEST is `begin' (respectively `end'), ITEM will be moved at +the beginning (respectively end) of the list it belongs to. If DEST is a string like \"N\", where N is an integer, ITEM will be moved at the Nth position in the list. @@ -1351,6 +1378,8 @@ added to the kill-ring. If DEST is `delete', ITEM will be deleted. +Visibility of item is preserved. + This function returns, destructively, the new list structure." (let* ((prevs (org-list-prevs-alist struct)) (item-end (org-list-get-item-end item struct)) @@ -1393,7 +1422,9 @@ This function returns, destructively, the new list structure." (org-list-get-last-item item struct prevs)) (point-at-eol))))) (t dest))) - (org-M-RET-may-split-line nil)) + (org-M-RET-may-split-line nil) + ;; Store visibility. + (visibility (overlays-in item item-end))) (cond ((eq dest 'delete) (org-list-delete-item item struct)) ((eq dest 'kill) @@ -1429,9 +1460,14 @@ This function returns, destructively, the new list structure." (+ end shift))))))) moved-items)) (lambda (e1 e2) (< (car e1) (car e2)))))) - ;; 2. Eventually delete extra copy of the item and clean marker. - (prog1 - (org-list-delete-item (marker-position item) struct) + ;; 2. Restore visibility. + (mapc (lambda (ov) + (move-overlay ov + (+ (overlay-start ov) (- (point) item)) + (+ (overlay-end ov) (- (point) item)))) + visibility) + ;; 3. Eventually delete extra copy of the item and clean marker. + (prog1 (org-list-delete-item (marker-position item) struct) (move-marker item nil))) (t struct)))) Modified lisp/org/org-protocol.el diff --git a/lisp/org/org-protocol.el b/lisp/org/org-protocol.el index 419a1ff..74fc35f 100644 --- a/lisp/org/org-protocol.el +++ b/lisp/org/org-protocol.el @@ -225,7 +225,7 @@ Consider using the interactive functions `org-protocol-create' and :type 'alist) (defcustom org-protocol-protocol-alist nil - " Register custom handlers for org-protocol. + "Register custom handlers for org-protocol. Each element of this list must be of the form: Modified lisp/org/org-table.el diff --git a/lisp/org/org-table.el b/lisp/org/org-table.el index 37e5c4f..e02062a 100644 --- a/lisp/org/org-table.el +++ b/lisp/org/org-table.el @@ -2368,7 +2368,7 @@ of the new mark." (looking-at org-table-auto-recalculate-regexp)) (org-table-recalculate) t)) -(defvar org-table-modes) +(defvar org-tbl-calc-modes) ;; Dynamically bound in `org-table-eval-formula' (defsubst org-set-calc-mode (var &optional value) (if (stringp var) (setq var (assoc var '(("D" calc-angle-mode deg) @@ -2376,10 +2376,10 @@ of the new mark." ("F" calc-prefer-frac t) ("S" calc-symbolic-mode t))) value (nth 2 var) var (nth 1 var))) - (if (memq var org-table-modes) - (setcar (cdr (memq var org-table-modes)) value) - (cons var (cons value org-table-modes))) - org-table-modes) + (if (memq var org-tbl-calc-modes) + (setcar (cdr (memq var org-tbl-calc-modes)) value) + (cons var (cons value org-tbl-calc-modes))) + org-tbl-calc-modes) (defun org-table-eval-formula (&optional arg equation suppress-align suppress-const @@ -2437,7 +2437,7 @@ not overwrite the stored one." equation (org-table-get-formula equation (equal arg '(4))))) (n0 (org-table-current-column)) - (modes (copy-sequence org-calc-default-modes)) + (org-tbl-calc-modes (copy-sequence org-calc-default-modes)) (numbers nil) ; was a variable, now fixed default (keep-empty nil) n form form0 formrpl formrg bw fmt x ev orig c lispp literal @@ -2453,12 +2453,13 @@ not overwrite the stored one." (setq c (string-to-char (match-string 1 fmt)) n (string-to-number (match-string 2 fmt))) (if (= c ?p) - (setq modes (org-set-calc-mode 'calc-internal-prec n)) - (setq modes (org-set-calc-mode - 'calc-float-format - (list (cdr (assoc c '((?n . float) (?f . fix) - (?s . sci) (?e . eng)))) - n)))) + (setq org-tbl-calc-modes (org-set-calc-mode 'calc-internal-prec n)) + (setq org-tbl-calc-modes + (org-set-calc-mode + 'calc-float-format + (list (cdr (assoc c '((?n . float) (?f . fix) + (?s . sci) (?e . eng)))) + n)))) (setq fmt (replace-match "" t t fmt))) (if (string-match "T" fmt) (setq duration t numbers t @@ -2479,7 +2480,7 @@ not overwrite the stored one." (setq keep-empty t fmt (replace-match "" t t fmt))) (while (string-match "[DRFS]" fmt) - (setq modes (org-set-calc-mode (match-string 0 fmt))) + (setq org-tbl-calc-modes (org-set-calc-mode (match-string 0 fmt))) (setq fmt (replace-match "" t t fmt))) (unless (string-match "\\S-" fmt) (setq fmt nil)))) @@ -2588,7 +2589,7 @@ not overwrite the stored one." duration-output-format) ev)) (or (fboundp 'calc-eval) (error "Calc does not seem to be installed, and is needed to evaluate the formula")) - (setq ev (calc-eval (cons form modes) (if numbers 'num)) + (setq ev (calc-eval (cons form org-tbl-calc-modes) (if numbers 'num)) ev (if duration (org-table-time-seconds-to-string (string-to-number ev) duration-output-format) ev))) @@ -3309,15 +3310,18 @@ If S is a string representing a number, keep this number." "Convert a number of seconds to a time string. If OUTPUT-FORMAT is non-nil, return a number of days, hours, minutes or seconds." - (cond ((eq output-format 'days) - (format "%.3f" (/ (float secs) 86400))) - ((eq output-format 'hours) - (format "%.2f" (/ (float secs) 3600))) - ((eq output-format 'minutes) - (format "%.1f" (/ (float secs) 60))) - ((eq output-format 'seconds) - (format "%d" secs)) - (t (org-format-seconds "%.2h:%.2m:%.2s" secs)))) + (let* ((secs0 (abs secs)) + (res + (cond ((eq output-format 'days) + (format "%.3f" (/ (float secs0) 86400))) + ((eq output-format 'hours) + (format "%.2f" (/ (float secs0) 3600))) + ((eq output-format 'minutes) + (format "%.1f" (/ (float secs0) 60))) + ((eq output-format 'seconds) + (format "%d" secs0)) + (t (org-format-seconds "%.2h:%.2m:%.2s" secs0))))) + (if (< secs 0) (concat "-" res) res))) (defun org-table-fedit-convert-buffer (function) "Convert all references in this buffer, using FUNCTION." Modified lisp/org/org.el diff --git a/lisp/org/org.el b/lisp/org/org.el index 838a9a1..c73be41 100644 --- a/lisp/org/org.el +++ b/lisp/org/org.el @@ -4789,10 +4789,11 @@ but the stars and the body are.") "\\|" org-clock-string "\\)\\)?" " *\\([[<][0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} ?[^]\r\n>]*?[]>]\\|<%%([^\r\n>]*>\\)") org-planning-or-clock-line-re - (concat "\\(?:^[ \t]*\\(" org-scheduled-string - "\\|" org-deadline-string - "\\|" org-closed-string "\\|" org-clock-string - "\\)\\>\\)") + (concat "^[ \t]*\\(" + org-scheduled-string "\\|" + org-deadline-string "\\|" + org-closed-string "\\|" + org-clock-string "\\)") org-all-time-keywords (mapcar (lambda (w) (substring w 0 -1)) (list org-scheduled-string org-deadline-string @@ -5916,16 +5917,19 @@ needs to be inserted at a specific position in the font-lock sequence.") (when org-pretty-entities (catch 'match (while (re-search-forward - "\\\\\\(frac[13][24]\\|[a-zA-Z]+\\)\\($\\|[^[:alpha:]\n]\\)" + "\\\\\\(frac[13][24]\\|[a-zA-Z]+\\)\\($\\|{}\\|[^[:alpha:]\n]\\)" limit t) (if (and (not (org-in-indented-comment-line)) (setq ee (org-entity-get (match-string 1))) (= (length (nth 6 ee)) 1)) - (progn + (let* + ((end (if (equal (match-string 2) "{}") + (match-end 2) + (match-end 1)))) (add-text-properties - (match-beginning 0) (match-end 1) + (match-beginning 0) end (list 'font-lock-fontified t)) - (compose-region (match-beginning 0) (match-end 1) + (compose-region (match-beginning 0) end (nth 6 ee) nil) (backward-char 1) (throw 'match t)))) @@ -6255,34 +6259,36 @@ in special contexts. (defun org-cycle-internal-global () "Do the global cycling action." - (cond - ((and (eq last-command this-command) - (eq org-cycle-global-status 'overview)) - ;; We just created the overview - now do table of contents - ;; This can be slow in very large buffers, so indicate action - (run-hook-with-args 'org-pre-cycle-hook 'contents) - (message "CONTENTS...") - (org-content) - (message "CONTENTS...done") - (setq org-cycle-global-status 'contents) - (run-hook-with-args 'org-cycle-hook 'contents)) - - ((and (eq last-command this-command) - (eq org-cycle-global-status 'contents)) - ;; We just showed the table of contents - now show everything - (run-hook-with-args 'org-pre-cycle-hook 'all) - (show-all) - (message "SHOW ALL") - (setq org-cycle-global-status 'all) - (run-hook-with-args 'org-cycle-hook 'all)) + ;; Hack to avoid display of messages for .org attachments in Gnus + (let ((ga (string-match "\\*fontification" (buffer-name)))) + (cond + ((and (eq last-command this-command) + (eq org-cycle-global-status 'overview)) + ;; We just created the overview - now do table of contents + ;; This can be slow in very large buffers, so indicate action + (run-hook-with-args 'org-pre-cycle-hook 'contents) + (unless ga (message "CONTENTS...")) + (org-content) + (unless ga (message "CONTENTS...done")) + (setq org-cycle-global-status 'contents) + (run-hook-with-args 'org-cycle-hook 'contents)) + + ((and (eq last-command this-command) + (eq org-cycle-global-status 'contents)) + ;; We just showed the table of contents - now show everything + (run-hook-with-args 'org-pre-cycle-hook 'all) + (show-all) + (unless ga (message "SHOW ALL")) + (setq org-cycle-global-status 'all) + (run-hook-with-args 'org-cycle-hook 'all)) - (t - ;; Default action: go to overview - (run-hook-with-args 'org-pre-cycle-hook 'overview) - (org-overview) - (message "OVERVIEW") - (setq org-cycle-global-status 'overview) - (run-hook-with-args 'org-cycle-hook 'overview)))) + (t + ;; Default action: go to overview + (run-hook-with-args 'org-pre-cycle-hook 'overview) + (org-overview) + (unless ga (message "OVERVIEW")) + (setq org-cycle-global-status 'overview) + (run-hook-with-args 'org-cycle-hook 'overview))))) (defun org-cycle-internal-local () "Do the local cycling action." @@ -8574,7 +8580,7 @@ call CMD." ;;; Link abbreviations (defun org-link-expand-abbrev (link) - "Apply replacements as defined in `org-link-abbrev-alist." + "Apply replacements as defined in `org-link-abbrev-alist'." (if (string-match "^\\([^:]*\\)\\(::?\\(.*\\)\\)?$" link) (let* ((key (match-string 1 link)) (as (or (assoc key org-link-abbrev-alist-local) @@ -9432,7 +9438,7 @@ If the link is in hidden text, expose it." (string-match "\\([a-zA-Z0-9]+\\):\\(.*\\)" s)) (progn (setq s (funcall org-link-translation-function - (match-string 1) (match-string 2))) + (match-string 1 s) (match-string 2 s))) (concat (car s) ":" (cdr s))) s)) @@ -12823,7 +12829,9 @@ headlines matching this string." " *\\(\\<\\(" (mapconcat 'regexp-quote org-todo-keywords-1 "\\|") (org-re - "\\>\\)\\)? *\\(.*?\\)\\(:[[:alnum:address@hidden:]+:\\)?[ \t]*$"))) + (if todo-only + "\\>\\)\\)[ \t]+\\(.*?\\)\\(:[[:alnum:address@hidden:]+:\\)?[ \t]*$" + "\\>\\)\\)? *\\([^ ].*?\\)\\(:[[:alnum:address@hidden:]+:\\)?[ \t]*$")))) (props (list 'face 'default 'done-face 'org-agenda-done 'undone-face 'default