From: Carsten Dominik Date: Sun, 23 Nov 2008 13:39:49 +0000 (+0000) Subject: 2008-11-23 Carsten Dominik X-Git-Tag: emacs-pretest-23.0.90~1593 X-Git-Url: https://code.delx.au/gnu-emacs/commitdiff_plain/ce4fdcb95a25c7dbfac7d221869de2ee0edfa747 2008-11-23 Carsten Dominik * org-clock.el (org-dblock-write:clocktable): Make sure the clocktable sees the first line. (org-clock-in): Warn if the clock cannot be resumed. 2008-11-23 Carsten Dominik * org.el (org-open-at-point): Fix mixup about interactive and non-interactive elisp links. 2008-11-23 Carsten Dominik * org-exp.el (org-export-preprocess-string): Allow one comment line before the first headline to always be included. This is to not miss a commented target. * org-mouse.el (org-mouse-insert-item): Call `org-indent-to-column' instead of `indent-to', for XEmacs compatibility. * org.el (org-refile-targets): Fix customize definition so that it works also in XEmacs. (org-fixup-indentation): Call `org-indent-to-column' instead of `indent-to', for XEmacs compatibility. 2008-11-23 Tokuya Kameshima * org-mew.el (org-mew-store-link): Get the correct case folder for refiled messages. 2008-11-23 Carsten Dominik * org-exp.el (org-export-as-ascii): Remove the "\\" forced line break indicators. * org.el (org-ido-completing-read): Remove the "i:" prefix for ido-completion propts. 2008-11-23 Carsten Dominik * org-remember.el (org-remember-apply-template): Use `org-substring-no-properties'. * org-compat.el (org-substring-no-properties): New function. * org-remember.el (org-remember-apply-template): Use `org-substring-no-properties' for compatibility. * org-list.el (org-list-two-spaces-after-bullet-regexp): New option. (org-fix-bullet-type): respect `org-list-two-spaces-after-bullet-regexp'. * org-clock.el (org-clock-load): Clean up the code. * org.el (org-adaptive-fill-function): Allow two spaces after "1." as a list bullet. 2008-11-23 Carsten Dominik * org-clock.el (org-clock-save, org-clock-load): Check for live buffers, existing files, and buffer file names to ensure consistent information. (org-clock-persist): Make `clock' a special value of this variable, and improve docstring. * org-list.el (org-cycle-list-bullet, org-fix-bullet-type) (org-get-string-indentation): Adapt indentation when the bullet width changes. 2008-11-23 Carsten Dominik * org-remember.el (org-remember-finalize): Make interactive. (org-remember-kill): New command. (org-remember-finish-immediately): Call `org-remember-finalize' directly. (org-remember-finalize): Make `org-remember-finalize' an interactive function. 2008-11-23 Carsten Dominik * org-remember.el (org-remember-apply-template): No ido completion for free prompts in remember templates. (org-remember-before-finalize-hook): New hook. (org-remember-mode): New minor mode. (org-remember-apply-template): Turn on `org-remember-mode'. * org-id.el (org-id-add-location): Avoid error when no file is given. * org-remember.el (org-remember-apply-template): Fix the way how the list of allowed properties is retrieved from the target file. * org.el (org-insert-link): Improve file link matching. 2008-11-23 Carsten Dominik * org-colview.el (org-columns-display-here): New argument DATELINE, to trigger using the new face. (org-agenda-colview-summarize): Call `org-columns-display-here' with the new argument. * org-faces.el (org-agenda-column-dateline): New face. * org-publish.el (org-publish-org-index): Use index-title at page title, not as section. * org-exp.el (org-export-html-format-desc): Respect the org-protect property. (org-export-as-html): Protect image specifiers that are in the description part of a link. * org.el (org-sort-entries-or-items, org-completing-read) (org-refile-get-location, org-olpath-completing-read, org-todo) (org-show-todo-tree, org-sparse-tree, org-make-tags-matcher) (org-set-tags, org-change-tag-in-region, org-fast-tag-selection) (org-set-property, org-delete-property) (org-delete-property-globally): Use `org-ido-completing-read'. * org-remember.el (org-remember-apply-template): Use `org-ido-completing-read'. * org-publish.el (org-publish): Use `org-ido-completing-read'. * org-colview.el (org-columns-edit-value, org-columns-new) (org-insert-columns-dblock): Use `org-ido-completing-read'. * org-colview-xemacs.el (org-columns-edit-value) (org-columns-new, org-insert-columns-dblock): Use `org-ido-completing-read'. * org-attach.el (org-attach-delete-one, org-attach-open): Use `org-ido-completing-read'. * org-agenda.el (org-todo-list, org-agenda-filter-by-tag): Use `org-ido-completing-read'. * org.el (org-time-today): New function. (org-matcher-time): Use `org-time-today'. Add special treatment for "" and "". (org-ido-completing-read): New function. (org-completion-use-ido): New option. * org-exp.el (org-export-format-source-code): Fix bug in require htmlize code. (org-export-target-internal-links): Fix bug in search for text property. 2008-11-23 Carsten Dominik * org-export-latex.el (org-export-latex-subcontent): Interprete target aliases as additonal labels. * org-exp.el (org-export-target-aliases): New variable. (org-export-preprocess-string) (org-export-handle-invisible-targets): Fill the alias alist. (org-export-as-html): Remove the   from the anchor, and also assign an id. (org-html-level-start): Insert the target aliases as additonal anchors. * org.el (org-edit-fixed-width-region): Fix bug when starting a new picture area. 2008-11-23 Carsten Dominik * org.el (org-open-at-mouse): Ensure correct link abbreviations when following a link with the mouse from the agenda. * org-exp.el (org-export-as-html): Avoid lone when no headlines are created. 2008-11-23 Carsten Dominik * org.el (org-link-translation-function): New option. (org-open-at-point): Call `org-link-translation-function' if non-nil. (org-translate-link): New function. (org-translate-link-from-planner): New function. (org-open-at-point): Allow interactive commands in elisp links. * org-exp.el (org-icalendar-cleanup-string): Restore the old iCalendar quoting. The new one seems to caus problems with applications. * org.el (org-yank): Set `this-command' to `yank', so that `yank-pop' will work. 2008-11-23 Carsten Dominik * org-exp.el (org-icalendar-cleanup-string): Improve RFC2455 compliance as far as quoting is concerned. * org.el (org-link-expand-abbrev): Implement %h as an escape for a hexified version of the tag. * org-vm.el (org-vm-follow-link): Require `vm-search'. * org.el (org-up-heading-safe, org-forward-same-level): Always call `org-back-to-heading' instead of `outline-back-to-heading'. (org-back-to-heading): New wrapper around outline-back-to-heading, with a useful error message telling where the error happened. * org-list.el (org-update-checkbox-count): Always call `org-back-to-heading' instead of `outline-back-to-heading'. * org-exp.el (org-export-as-html): Make sure that each tag has an `alt' attribute, to ensure XHTML validation. 2008-11-23 Carsten Dominik * org-publish.el (org-publish-attachment): Allow publishing to overwrite attachment files. * org-agenda.el (org-agenda-timerange-leaders): New option. (org-agenda-get-blocks): Use `org-agenda-timerange-leaders'. * org.el (org-edit-src-exit): Untabify ASCII image before returning. --- diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog index 81b502df8f..ec9a85a597 100644 --- a/doc/misc/ChangeLog +++ b/doc/misc/ChangeLog @@ -1,3 +1,11 @@ +2008-11-23 Carsten Dominik + + * org.texi (Setting up Remember): Document `org-remember-mode'. + (External links): Document that bbdb links can use a regular + expression. + (External links): Document that elisp links can contain interactive + commands. + 2008-11-22 Michael Kifer * viper.texi (viper-translate-all-ESC-keysequences): diff --git a/lisp/org/org-agenda.el b/lisp/org/org-agenda.el index 4f7b87769b..0988066eb6 100644 --- a/lisp/org/org-agenda.el +++ b/lisp/org/org-agenda.el @@ -6,7 +6,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.12a +;; Version: 6.13 ;; ;; This file is part of GNU Emacs. ;; @@ -878,6 +878,20 @@ to occupy a fixed space in the agenda display." :group 'org-agenda-line-format :type 'string) +(defcustom org-agenda-timerange-leaders '("" "(%d/%d): ") + "Text preceding timerange entries in the agenda view. +This is a list with two strings. The first applies when the range +is entirely on one day. The second applies if the range spans several days. +The strings may have two \"%d\" format specifiers which will be filled +with the sequence number of the days, and the total number of days in the +range, respectively." + :group 'org-agenda-line-format + :type '(list + (string :tag "Deadline today ") + (choice :tag "Deadline relative" + (string :tag "Format string") + (function)))) + (defcustom org-agenda-scheduled-leaders '("Scheduled: " "Sched.%2dx: ") "Text preceeding scheduled items in the agenda view. This is a list with two strings. The first applies when the item is @@ -2722,7 +2736,7 @@ for a keyword. A numeric prefix directly selects the Nth keyword in rtn rtnall files file pos) (when (equal arg '(4)) (setq org-select-this-todo-keyword - (completing-read "Keyword (or KWD1|K2D2|...): " + (org-ido-completing-read "Keyword (or KWD1|K2D2|...): " (mapcar 'list kwds) nil nil))) (and (equal 0 arg) (setq org-select-this-todo-keyword nil)) (org-set-local 'org-last-arg arg) @@ -3384,7 +3398,7 @@ the documentation of `org-diary'." (push txt ee)))) (nreverse ee))) -(defalias 'org-get-closed 'org-agenda-get-progress) +(defalias 'org-get-closed 'org-get-progress) (defun org-agenda-get-progress () "Return the logged TODO entries for agenda display." (let* ((props (list 'mouse-face 'highlight @@ -3398,7 +3412,7 @@ the documentation of `org-diary'." (items (if (consp org-agenda-show-log) org-agenda-show-log org-agenda-log-mode-items)) - (parts + (parts (delq nil (list (if (memq 'closed items) (concat "\\<" org-closed-string)) @@ -3677,8 +3691,10 @@ FRACTION is what fraction of the head-warning time has passed." (org-entry-is-done-p) (throw :skip t)) (setq txt (org-format-agenda-item - (format (if (= d1 d2) "" "(%d/%d): ") - (1+ (- d0 d1)) (1+ (- d2 d1))) + (format + (nth (if (= d1 d2) 0 1) + org-agenda-timerange-leaders) + (1+ (- d0 d1)) (1+ (- d2 d1))) head category tags (if (= d0 d1) timestr)))) (setq txt org-agenda-no-heading-message)) @@ -4255,7 +4271,7 @@ to switch to narrowing." (org-set-local 'org-global-tags-completion-table (org-global-tags-completion-table))) (let ((completion-ignore-case t)) - (setq tag (completing-read + (setq tag (org-ido-completing-read "Tag: " org-global-tags-completion-table)))) (cond ((equal char ?/) (org-agenda-filter-by-tag-show-all)) diff --git a/lisp/org/org-archive.el b/lisp/org/org-archive.el index d580db989f..547fee259a 100644 --- a/lisp/org/org-archive.el +++ b/lisp/org/org-archive.el @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.12a +;; Version: 6.13 ;; ;; This file is part of GNU Emacs. ;; diff --git a/lisp/org/org-attach.el b/lisp/org/org-attach.el index feeb5f66a4..539de7f5b1 100644 --- a/lisp/org/org-attach.el +++ b/lisp/org/org-attach.el @@ -4,7 +4,7 @@ ;; Author: John Wiegley ;; Keywords: org data task -;; Version: 6.12a +;; Version: 6.13 ;; This file is part of GNU Emacs. ;; @@ -153,6 +153,9 @@ D Delete all of a task's attachments. A safer way is "Return the directory associated with the current entry. If the directory does not exist and CREATE-IF-NOT-EXISTS-P is non-nil, the directory and the corresponding ID will be created." + (when (and (not (buffer-file-name (buffer-base-buffer))) + (not (file-name-absolute-p org-attach-directory))) + (error "Need absolute `org-attach-directory' to attach in buffers without filename.")) (let ((uuid (org-id-get (point) create-if-not-exists-p))) (when (or uuid create-if-not-exists-p) (unless uuid @@ -245,7 +248,7 @@ The attachment is created as an Emacs buffer." (let* ((attach-dir (org-attach-dir t)) (files (org-attach-file-list attach-dir)) (file (or file - (completing-read + (org-ido-completing-read "Delete attachment: " (mapcar (lambda (f) (list (file-name-nondirectory f))) @@ -320,7 +323,7 @@ If IN-EMACS is non-nil, force opening in Emacs." (files (org-attach-file-list attach-dir)) (file (if (= (length files) 1) (car files) - (completing-read "Open attachment: " + (org-ido-completing-read "Open attachment: " (mapcar 'list files) nil t)))) (org-open-file (expand-file-name file attach-dir) in-emacs))) diff --git a/lisp/org/org-bbdb.el b/lisp/org/org-bbdb.el index 13b3ff047d..ca2fe13934 100644 --- a/lisp/org/org-bbdb.el +++ b/lisp/org/org-bbdb.el @@ -6,7 +6,7 @@ ;; Thomas Baumann ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.12a +;; Version: 6.13 ;; ;; This file is part of GNU Emacs. ;; diff --git a/lisp/org/org-bibtex.el b/lisp/org/org-bibtex.el index b457121e44..d2e975ed8c 100644 --- a/lisp/org/org-bibtex.el +++ b/lisp/org/org-bibtex.el @@ -5,7 +5,7 @@ ;; Author: Bastien Guerry ;; Carsten Dominik ;; Keywords: org, wp, remember -;; Version: 6.12a +;; Version: 6.13 ;; ;; This file is part of GNU Emacs. ;; diff --git a/lisp/org/org-clock.el b/lisp/org/org-clock.el index d54a490047..82064e0cdb 100644 --- a/lisp/org/org-clock.el +++ b/lisp/org/org-clock.el @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.12a +;; Version: 6.13 ;; ;; This file is part of GNU Emacs. ;; @@ -104,9 +104,19 @@ has not been closed, resume the clock from that point" (defcustom org-clock-persist nil "When non-nil, save the running clock when emacs is closed, and - resume it next time emacs is started." + resume it next time emacs is started. +When this is t, both the running clock, and the entire clock +history are saved. When this is the symbol `clock', only the +running clock is saved. + +When Emacs restarts with saved clock information, the file containing the +running clock as well as all files mentioned in the clock history will +be visited." :group 'org-clock - :type 'boolean) + :type '(choice + (const :tag "Just the running clock" clock) + (const :tag "Clock and history" t) + (const :tag "No persistence" nil))) (defcustom org-clock-persist-file "~/.emacs.d/org-clock-save.el" "File to save clock data to" @@ -246,7 +256,7 @@ of a different task.") 'help-echo (concat help-text ": " org-clock-heading)) (org-propertize clock-string 'help-echo help-text))) 'local-map org-clock-mode-map - 'mouse-face '(face mode-line-highlight))) + 'mouse-face (if (featurep 'xemacs) 'highlight 'mode-line-highlight))) (force-mode-line-update))) (defvar org-clock-mode-line-entry nil @@ -260,88 +270,102 @@ clock into. When SELECT is `C-u C-u', clock into the current task and mark is as the default task, a special task that will always be offered in the clocking selection, associated with the letter `d'." (interactive "P") - (let ((interrupting (marker-buffer org-clock-marker)) - ts selected-task target-pos) - (when (equal select '(4)) - (setq selected-task (org-clock-select-task "Clock-in on task: ")) - (if selected-task - (setq selected-task (copy-marker selected-task)) - (error "Abort"))) - (when interrupting - ;; We are interrupting the clocking of a differnt task. - ;; Save a marker to this task, so that we can go back. - (move-marker org-clock-interrupted-task - (marker-position org-clock-marker) - (marker-buffer org-clock-marker)) - (org-clock-out t)) - - (when (equal select '(16)) - ;; Mark as default clocking task - (save-excursion - (org-back-to-heading t) - (move-marker org-clock-default-task (point)))) - - (setq target-pos (point)) ;; we want to clock in at this location - (save-excursion - (when (and selected-task (marker-buffer selected-task)) - ;; There is a selected task, move to the correct buffer - ;; and set the new target position. - (set-buffer (org-base-buffer (marker-buffer selected-task))) - (setq target-pos (marker-position selected-task)) - (move-marker selected-task nil)) - (save-excursion - (save-restriction - (widen) - (goto-char target-pos) + (catch 'abort + (let ((interrupting (marker-buffer org-clock-marker)) + ts selected-task target-pos) + (when (equal select '(4)) + (setq selected-task (org-clock-select-task "Clock-in on task: ")) + (if selected-task + (setq selected-task (copy-marker selected-task)) + (error "Abort"))) + (when interrupting + ;; We are interrupting the clocking of a differnt task. + ;; Save a marker to this task, so that we can go back. + (move-marker org-clock-interrupted-task + (marker-position org-clock-marker) + (marker-buffer org-clock-marker)) + (org-clock-out t)) + + (when (equal select '(16)) + ;; Mark as default clocking task + (save-excursion (org-back-to-heading t) - (or interrupting (move-marker org-clock-interrupted-task nil)) - (org-clock-history-push) - (cond ((functionp org-clock-in-switch-to-state) - (looking-at org-complex-heading-regexp) - (let ((newstate (funcall org-clock-in-switch-to-state (match-string 2)))) - (if newstate (org-todo newstate)))) - ((and org-clock-in-switch-to-state - (not (looking-at (concat outline-regexp "[ \t]*" - org-clock-in-switch-to-state - "\\>")))) - (org-todo org-clock-in-switch-to-state))) - (setq org-clock-heading-for-remember - (and (looking-at org-complex-heading-regexp) - (match-end 4) - (org-trim (buffer-substring (match-end 1) (match-end 4))))) - (setq org-clock-heading - (cond ((and org-clock-heading-function - (functionp org-clock-heading-function)) - (funcall org-clock-heading-function)) - ((looking-at org-complex-heading-regexp) - (match-string 4)) - (t "???"))) - (setq org-clock-heading (org-propertize org-clock-heading 'face nil)) - (org-clock-find-position) - (if (and org-clock-in-resume - (looking-at (concat "^[ \\t]* " org-clock-string - " \\[\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}" - " +\\sw+ +[012][0-9]:[0-5][0-9]\\)\\]$"))) - (progn (message "Matched %s" (match-string 1)) - (setq ts (concat "[" (match-string 1) "]")) - (goto-char (match-end 1)) - (setq org-clock-start-time - (apply 'encode-time (org-parse-time-string (match-string 1))))) - (progn + (move-marker org-clock-default-task (point)))) + + (setq target-pos (point)) ;; we want to clock in at this location + (save-excursion + (when (and selected-task (marker-buffer selected-task)) + ;; There is a selected task, move to the correct buffer + ;; and set the new target position. + (set-buffer (org-base-buffer (marker-buffer selected-task))) + (setq target-pos (marker-position selected-task)) + (move-marker selected-task nil)) + (save-excursion + (save-restriction + (widen) + (goto-char target-pos) + (org-back-to-heading t) + (or interrupting (move-marker org-clock-interrupted-task nil)) + (org-clock-history-push) + (cond ((functionp org-clock-in-switch-to-state) + (looking-at org-complex-heading-regexp) + (let ((newstate (funcall org-clock-in-switch-to-state + (match-string 2)))) + (if newstate (org-todo newstate)))) + ((and org-clock-in-switch-to-state + (not (looking-at (concat outline-regexp "[ \t]*" + org-clock-in-switch-to-state + "\\>")))) + (org-todo org-clock-in-switch-to-state))) + (setq org-clock-heading-for-remember + (and (looking-at org-complex-heading-regexp) + (match-end 4) + (org-trim (buffer-substring (match-end 1) + (match-end 4))))) + (setq org-clock-heading + (cond ((and org-clock-heading-function + (functionp org-clock-heading-function)) + (funcall org-clock-heading-function)) + ((looking-at org-complex-heading-regexp) + (match-string 4)) + (t "???"))) + (setq org-clock-heading (org-propertize org-clock-heading + 'face nil)) + (org-clock-find-position) + (cond + ((and org-clock-in-resume + (looking-at + (concat "^[ \\t]* " org-clock-string + " \\[\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}" + " +\\sw+ +[012][0-9]:[0-5][0-9]\\)\\][ \t]*$"))) + (message "Matched %s" (match-string 1)) + (setq ts (concat "[" (match-string 1) "]")) + (goto-char (match-end 1)) + (setq org-clock-start-time + (apply 'encode-time + (org-parse-time-string (match-string 1))))) + ((eq org-clock-in-resume 'auto-restart) + ;; called from org-clock-load during startup, + ;; do not interrupt, but warn! + (message "Cannot restart clock because task does not contain unfinished clock") + (ding) + (sit-for 2) + (throw 'abort nil)) + (t (insert "\n") (backward-char 1) (org-indent-line-function) (insert org-clock-string " ") (setq org-clock-start-time (current-time)) (setq ts (org-insert-time-stamp org-clock-start-time 'with-hm 'inactive)))) - (move-marker org-clock-marker (point) (buffer-base-buffer)) - (or global-mode-string (setq global-mode-string '(""))) - (or (memq 'org-mode-line-string global-mode-string) - (setq global-mode-string - (append global-mode-string '(org-mode-line-string)))) - (org-update-mode-line) - (setq org-mode-line-timer - (run-with-timer 60 60 'org-update-mode-line)) - (message "Clock started at %s" ts)))))) + (move-marker org-clock-marker (point) (buffer-base-buffer)) + (or global-mode-string (setq global-mode-string '(""))) + (or (memq 'org-mode-line-string global-mode-string) + (setq global-mode-string + (append global-mode-string '(org-mode-line-string)))) + (org-update-mode-line) + (setq org-mode-line-timer + (run-with-timer 60 60 'org-update-mode-line)) + (message "Clock started at %s" ts))))))) (defun org-clock-find-position () "Find the location where the next clock line should be inserted." @@ -820,7 +844,7 @@ the currently selected interval size." (block (plist-get params :block)) (link (plist-get params :link)) ipos time p level hlc hdl content recalc formula pcol - cc beg end pos tbl tbl1 range-text rm-file-column scope-is-list) + cc beg end pos tbl tbl1 range-text rm-file-column scope-is-list st) (setq org-clock-file-total-minutes nil) (when step (unless (or block (and ts te)) @@ -902,7 +926,11 @@ the currently selected interval size." (unless scope-is-list (org-clock-sum ts te) (goto-char (point-min)) - (while (setq p (next-single-property-change (point) :org-clock-minutes)) + (setq st t) + (while (or (and (bobp) (prog1 st (setq st nil)) + (get-text-property (point) :org-clock-minutes) + (setq p (point-min))) + (setq p (next-single-property-change (point) :org-clock-minutes))) (goto-char p) (when (setq time (get-text-property p :org-clock-minutes)) (save-excursion @@ -1062,71 +1090,92 @@ This function is made for clock tables." 0)))) (defun org-clock-save () - "Persist various clock-related data to disk" - (with-current-buffer (find-file (expand-file-name org-clock-persist-file)) - (progn (delete-region (point-min) (point-max)) - ;;Store clock - (insert (format ";; org-persist.el - %s at %s\n" - system-name (format-time-string - (cdr org-time-stamp-formats)))) - (if (and org-clock-persist (marker-buffer org-clock-marker) - (or (not org-clock-persist-query-save) - (y-or-n-p (concat "Save current clock (" - (substring-no-properties org-clock-heading) - ")")))) - (insert "(setq resume-clock '(\"" - (buffer-file-name (marker-buffer org-clock-marker)) - "\" . " (int-to-string (marker-position org-clock-marker)) - "))\n")) - ;;Store clocked task history. Tasks are stored reversed to make - ;;reading simpler - (if org-clock-history - (insert "(setq stored-clock-history '(" - (mapconcat - (lambda (m) - (when (marker-buffer m) - (concat "(\"" (buffer-file-name (marker-buffer m)) - "\" . " (int-to-string (marker-position m)) - ")"))) - (reverse org-clock-history) " ") "))\n")) - (save-buffer) - (kill-buffer (current-buffer))))) - -(defvar org-clock-loaded nil) + "Persist various clock-related data to disk. +The details of what will be saved are regulated by the variable +`org-clock-persist'." + (when org-clock-persist + (let (b) + (with-current-buffer (find-file (expand-file-name org-clock-persist-file)) + (progn + (delete-region (point-min) (point-max)) + ;;Store clock + (insert (format ";; org-persist.el - %s at %s\n" + system-name (format-time-string + (cdr org-time-stamp-formats)))) + (if (and (setq b (marker-buffer org-clock-marker)) + (setq b (or (buffer-base-buffer b) b)) + (buffer-live-p b) + (buffer-file-name b) + (or (not org-clock-persist-query-save) + (y-or-n-p (concat "Save current clock (" + (substring-no-properties org-clock-heading) + ") ")))) + (insert "(setq resume-clock '(\"" + (buffer-file-name (marker-buffer org-clock-marker)) + "\" . " (int-to-string (marker-position org-clock-marker)) + "))\n")) + ;; Store clocked task history. Tasks are stored reversed to make + ;; reading simpler + (when (and org-clock-history (eq org-clock-persist t)) + (insert + "(setq stored-clock-history '(" + (mapconcat + (lambda (m) + (when (and (setq b (marker-buffer m)) + (setq b (or (buffer-base-buffer b) b)) + (buffer-live-p b) + (buffer-file-name b)) + (concat "(\"" (buffer-file-name b) + "\" . " (int-to-string (marker-position m)) + ")"))) + (reverse org-clock-history) " ") "))\n")) + (save-buffer) + (kill-buffer (current-buffer))))))) + +(defvar org-clock-loaded nil + "Was the clock file loaded?") (defun org-clock-load () "Load various clock-related data from disk, optionally resuming a stored clock" - (if (not org-clock-loaded) - (let ((filename (expand-file-name org-clock-persist-file)) - (org-clock-in-resume t)) - (if (file-readable-p filename) - (progn - (message "%s" "Restoring clock data") - (setq org-clock-loaded t) - (load-file filename) - ;; load history - (if (boundp 'stored-clock-history) - (save-window-excursion - (mapc (lambda (task) - (org-clock-history-push (cdr task) - (find-file (car task)))) - stored-clock-history))) - ;; resume clock - (if (and (boundp 'resume-clock) org-clock-persist - (or (not org-clock-persist-query-resume) - (y-or-n-p - (concat - "Resume clock (" - (with-current-buffer (find-file (car resume-clock)) - (progn (goto-char (cdr resume-clock)) - (looking-at org-complex-heading-regexp) - (match-string 4))) ")")))) - (with-current-buffer (find-file (car resume-clock)) - (progn (goto-char (cdr resume-clock)) - (org-clock-in))))) + (when (and org-clock-persist (not org-clock-loaded)) + (let ((filename (expand-file-name org-clock-persist-file)) + (org-clock-in-resume 'auto-restart) + resume-clock stored-clock-history) + (if (not (file-readable-p filename)) (message "Not restoring clock data; %s not found" - org-clock-persist-file))))) + org-clock-persist-file) + (message "%s" "Restoring clock data") + (setq org-clock-loaded t) + (load-file filename) + ;; load history + (when stored-clock-history + (save-window-excursion + (mapc (lambda (task) + (if (file-exists-p (car task)) + (org-clock-history-push (cdr task) + (find-file (car task))))) + stored-clock-history))) + ;; resume clock + (when (and resume-clock org-clock-persist + (file-exists-p (car resume-clock)) + (or (not org-clock-persist-query-resume) + (y-or-n-p + (concat + "Resume clock (" + (with-current-buffer (find-file (car resume-clock)) + (save-excursion + (goto-char (cdr resume-clock)) + (org-back-to-heading t) + (and (looking-at org-complex-heading-regexp) + (match-string 4)))) + ") ")))) + (when (file-exists-p (car resume-clock)) + (with-current-buffer (find-file (car resume-clock)) + (goto-char (cdr resume-clock)) + (org-clock-in) + (if (org-invisible-p) + (org-show-context))))))))) ;;;###autoload (defun org-clock-persistence-insinuate () diff --git a/lisp/org/org-colview.el b/lisp/org/org-colview.el index b3be9f2816..3daef2a0f2 100644 --- a/lisp/org/org-colview.el +++ b/lisp/org/org-colview.el @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.12a +;; Version: 6.13 ;; ;; This file is part of GNU Emacs. ;; @@ -130,7 +130,7 @@ This is the compiled version of the format.") (push ov org-columns-overlays) ov)) -(defun org-columns-display-here (&optional props) +(defun org-columns-display-here (&optional props dateline) "Overlay the current line with column display." (interactive) (let* ((fmt org-columns-current-fmt-compiled) @@ -145,6 +145,7 @@ This is the compiled version of the format.") 'default)) (color (list :foreground (face-attribute ref-face :foreground))) (face (list color 'org-column ref-face)) + (face1 (list color 'org-agenda-column-dateline ref-face)) (pl (or (get-text-property (point-at-bol) 'prefix-length) 0)) (cphr (get-text-property (point-at-bol) 'org-complex-heading-regexp)) pom property ass width f string ov column val modval s1 s2 title) @@ -189,7 +190,7 @@ This is the compiled version of the format.") ;; Create the overlay (org-unmodified (setq ov (org-columns-new-overlay - beg (setq beg (1+ beg)) string face)) + beg (setq beg (1+ beg)) string (if dateline face1 face))) (org-overlay-put ov 'keymap org-columns-map) (org-overlay-put ov 'org-columns-key property) (org-overlay-put ov 'org-columns-value (cdr ass)) @@ -425,7 +426,7 @@ Where possible, use the standard interface for changing this line." (t (setq allowed (org-property-get-allowed-values pom key 'table)) (if allowed - (setq nval (completing-read "Value: " allowed nil t)) + (setq nval (org-ido-completing-read "Value: " allowed nil t)) (setq nval (read-string "Edit: " value))) (setq nval (org-trim nval)) (when (not (equal nval value)) @@ -675,7 +676,7 @@ around it." (interactive) (let ((editp (and prop (assoc prop org-columns-current-fmt-compiled))) cell) - (setq prop (completing-read + (setq prop (org-ido-completing-read "Property: " (mapcar 'list (org-buffer-property-keys t nil t)) nil nil prop)) (setq title (read-string (concat "Column title [" prop "]: ") (or title prop))) @@ -683,7 +684,7 @@ around it." (if (string-match "\\S-" width) (setq width (string-to-number width)) (setq width nil)) - (setq fmt (completing-read "Summary [none]: " + (setq fmt (org-ido-completing-read "Summary [none]: " '(("none") ("add_numbers") ("currency") ("add_times") ("checkbox") ("checkbox-n-of-m") ("checkbox-percent")) nil t)) (if (string-match "\\S-" fmt) @@ -1151,7 +1152,7 @@ and tailing newline characters." "Create a dynamic block capturing a column view table." (interactive) (let ((defaults '(:name "columnview" :hlines 1)) - (id (completing-read + (id (org-ido-completing-read "Capture columns (local, global, entry with :ID: property) [local]: " (append '(("global") ("local")) (mapcar 'list (org-property-values "ID")))))) @@ -1282,7 +1283,7 @@ This will add overlays to the date lines, to show the summary for each day." 0 (length lsum) 'face 'bold lsum) (cons prop lsum)))) fmt)) - (org-columns-display-here props) + (org-columns-display-here props 'dateline) (org-set-local 'org-agenda-columns-active t))) (if (bobp) (throw 'exit t)) (beginning-of-line 0)))))) diff --git a/lisp/org/org-compat.el b/lisp/org/org-compat.el index df0b187f47..f3707cdd4f 100644 --- a/lisp/org/org-compat.el +++ b/lisp/org/org-compat.el @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.12a +;; Version: 6.13 ;; ;; This file is part of GNU Emacs. ;; @@ -277,9 +277,16 @@ that can be added." (defun org-propertize (string &rest properties) (if (featurep 'xemacs) - (add-text-properties 0 (length string) properties string) + (progn + (add-text-properties 0 (length string) properties string) + string) (apply 'propertize string properties))) +(defun org-substring-no-properties (string &optional from to) + (if (featurep 'xemacs) + (org-no-properties (substring string from to)) + (substring-no-properties string from to))) + (provide 'org-compat) ;; arch-tag: a0a0579f-e68c-4bdf-9e55-93768b846bbe diff --git a/lisp/org/org-exp.el b/lisp/org/org-exp.el index 87023e74c0..dfe9f8a4f7 100644 --- a/lisp/org/org-exp.el +++ b/lisp/org/org-exp.el @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.12a +;; Version: 6.13 ;; ;; This file is part of GNU Emacs. ;; @@ -1415,6 +1415,9 @@ translations. There is currently no way for users to extend this.") ;;; General functions for all backends +(defvar org-export-target-aliases nil + "Alist of targets with invisible aliases.") + (defun org-export-preprocess-string (string &rest parameters) "Cleanup STRING so that that the true exported has a more consistent source. This function takes STRING, which should be a buffer-string of an org-file @@ -1431,6 +1434,8 @@ on this string to produce the exported version." (outline-regexp "\\*+ ") target-alist rtn) + (setq org-export-target-aliases nil) + (with-current-buffer (get-buffer-create " org-mode-tmp") (erase-buffer) (insert string) @@ -1464,7 +1469,7 @@ on this string to produce the exported version." ;; Get the correct stuff before the first headline (when (plist-get parameters :skip-before-1st-heading) (goto-char (point-min)) - (when (re-search-forward "^\\*+[ \t]" nil t) + (when (re-search-forward "\\(^#.*\n\\)^\\*+[ \t]" nil t) (delete-region (point-min) (match-beginning 0)) (goto-char (point-min)) (insert "\n"))) @@ -1576,7 +1581,7 @@ The new targets are added to TARGET-ALIST, which is also returned." (defun org-export-handle-invisible-targets (target-alist) "Find targets in comments and move them out of comments. Mark them as invisible targets." - (let (target tmp) + (let (target tmp a) (goto-char (point-min)) (while (re-search-forward "^#.*?\\(<<\r\n]+\\)>>>?\\).*" nil t) ;; Check if the line before or after is a headline with a target @@ -1587,8 +1592,13 @@ Mark them as invisible targets." (setq tmp (match-string 2)) (replace-match "") (and (looking-at "\n") (delete-char 1)) - (push (cons (org-solidify-link-text tmp) target) - target-alist)) + (push (cons (setq tmp (org-solidify-link-text tmp)) target) + target-alist) + (setq a (or (assoc target org-export-target-aliases) + (progn + (push (list target) org-export-target-aliases) + (car org-export-target-aliases)))) + (push tmp (cdr a))) ;; Make an invisible target (replace-match "\\1(INVISIBLE)")))) target-alist) @@ -1622,8 +1632,8 @@ let the link point to the corresponding section." (or (get-text-property (point) 'target) (get-text-property (max (point-min) - (1- (previous-single-property-change - (point) 'target))) + (1- (or (previous-single-property-change + (point) 'target) 0))) 'target)))))))) (when target (set-match-data md) @@ -1885,7 +1895,8 @@ When it is nil, all comments will be removed." (goto-char (1- (match-end 0))) (org-if-unprotected (let* ((xx (save-match-data - (org-link-expand-abbrev (match-string 1)))) + (org-translate-link + (org-link-expand-abbrev (match-string 1))))) (s (concat "[[" xx "]" (if (match-end 3) @@ -2149,7 +2160,7 @@ backends, it converts the segment into an EXAMPLE segment." (cond (htmlp ;; We are exporting to HTML - (condition-case nil (require 'htmlize) (nil t)) + (require 'htmlize nil t) (if (not (fboundp 'htmlize-region-for-paste)) (progn ;; we do not have htmlize.el, or an old version of it @@ -2423,6 +2434,9 @@ underlined headlines. The default is 3." "\n") "\n"))) (t (setq line (org-fix-indentation line org-ascii-current-indentation)) + ;; Remove forced line breaks + (if (string-match "\\\\\\\\[ \t]*$" line) + (setq line (replace-match "" t t line))) (if (and org-export-with-fixed-width (string-match "^\\([ \t]*\\)\\(:\\)" line)) (setq line (replace-match "\\1" nil nil line))) @@ -3183,9 +3197,10 @@ lang=\"%s\" xml:lang=\"%s\"> (cond ((match-end 2) (setq line (replace-match - (concat "@\\nbsp@") + (format + "@@" + (org-solidify-link-text (match-string 1 line)) + (org-solidify-link-text (match-string 1 line))) t t line))) ((and org-export-with-toc (equal (string-to-char line) ?*)) ;; FIXME: NOT DEPENDENT on TOC????????????????????? @@ -3233,7 +3248,9 @@ lang=\"%s\" xml:lang=\"%s\"> (save-match-data (if (string-match "^file:" desc) (setq desc (substring desc (match-end 0))))) - (setq desc (concat ""))) + (setq desc (org-add-props + (concat "") + '(org-protected t)))) ;; FIXME: do we need to unescape here somewhere? (cond ((equal type "internal") @@ -3250,7 +3267,10 @@ lang=\"%s\" xml:lang=\"%s\"> (if (and (or (eq t org-export-html-inline-images) (and org-export-html-inline-images (not descp))) (org-file-image-p path)) - (setq rpl (concat "")) + (setq rpl (concat "\""")) (setq link (concat type ":" path)) (setq rpl (concat " (or (eq t org-export-html-inline-images) (and org-export-html-inline-images (not descp)))) - (concat "") + (concat "\""") (concat "" (org-export-html-format-desc desc) ""))) @@ -3503,7 +3527,7 @@ lang=\"%s\" xml:lang=\"%s\"> (and org-export-with-toc (<= level umax)) head-count) ;; the to close the last text-... div. - (insert "\n") + (when (and (> umax 0) first-heading-pos) (insert "\n")) (save-excursion (goto-char (point-min)) @@ -3604,7 +3628,7 @@ lang=\"%s\" xml:lang=\"%s\"> (defun org-export-html-format-desc (s) "Make sure the S is valid as a description in a link." - (if s + (if (and s (not (get-text-property 1 'org-protected s))) (save-match-data (org-html-do-expand s)) s)) @@ -4143,9 +4167,15 @@ stacked delimiters is N. Escaping delimiters is not possible." "Insert a new level in HTML export. When TITLE is nil, just close all open levels." (org-close-par-maybe) - (let ((target (and title (org-get-text-property-any 0 'target title))) - (l org-level-max) - snumber) + (let* ((target (and title (org-get-text-property-any 0 'target title))) + (extra-targets + (mapconcat (lambda (x) + (format "" + x x)) + (cdr (assoc target org-export-target-aliases)) + "")) + (l org-level-max) + snumber) (while (>= l level) (if (aref org-levels-open (1- l)) (progn @@ -4173,13 +4203,13 @@ When TITLE is nil, just close all open levels." (progn (org-close-li) (if target - (insert (format "
  • " target) title "
    \n") + (insert (format "
  • " target) extra-targets title "
    \n") (insert "
  • " title "
    \n"))) (aset org-levels-open (1- level) t) (org-close-par-maybe) (if target (insert (format "
      \n
    • " target) - title "
      \n") + extra-targets title "
      \n") (insert "
        \n
      • " title "
        \n")))) (aset org-levels-open (1- level) t) (setq snumber (org-section-number level)) @@ -4187,8 +4217,8 @@ When TITLE is nil, just close all open levels." (setq title (concat snumber " " title))) (setq level (+ level org-export-html-toplevel-hlevel -1)) (unless (= head-count 1) (insert "\n\n")) - (insert (format "\n
        \n%s\n
        \n" - snumber level level snumber title level snumber)) + (insert (format "\n
        \n%s%s\n
        \n" + snumber level level snumber extra-targets title level snumber)) (org-open-par))))) (defun org-get-text-property-any (pos prop &optional object) @@ -4523,10 +4553,10 @@ characters." (while (string-match "\\([,;]\\)" s start) (setq start (+ (match-beginning 0) 2) s (replace-match "\\\\\\1" nil nil s)))) + (setq s (org-trim s)) (when is-body (while (string-match "[ \t]*\n[ \t]*" s) (setq s (replace-match "\\n" t t s)))) - (setq s (org-trim s)) (if is-body (if maxlength (if (and (numberp maxlength) @@ -4534,6 +4564,32 @@ characters." (setq s (substring s 0 maxlength))))) s)) +(defun org-icalendar-cleanup-string-rfc2455 (s &optional is-body maxlength) + "Take out stuff and quote what needs to be quoted. +When IS-BODY is non-nil, assume that this is the body of an item, clean up +whitespace, newlines, drawers, and timestamps, and cut it down to MAXLENGTH +characters. +This seems to be more like RFC 2455, but it causes problems, so it is +not used right now." + (if (not s) + nil + (if is-body + (let ((re (concat "\\(" org-drawer-regexp "\\)[^\000]*?:END:.*\n?")) + (re2 (concat "^[ \t]*" org-keyword-time-regexp ".*\n?"))) + (while (string-match re s) (setq s (replace-match "" t t s))) + (while (string-match re2 s) (setq s (replace-match "" t t s))) + (setq s (org-trim s)) + (while (string-match "[ \t]*\n[ \t]*" s) + (setq s (replace-match "\\n" t t s))) + (if maxlength + (if (and (numberp maxlength) + (> (length s) maxlength)) + (setq s (substring s 0 maxlength))))) + (setq s (org-trim s))) + (while (string-match "\"" s) (setq s (replace-match "''" t t s))) + (when (string-match "[;,:]" s) (setq s (concat "\"" s "\""))) + s)) + (defun org-get-entry () "Clean-up description string." (save-excursion diff --git a/lisp/org/org-export-latex.el b/lisp/org/org-export-latex.el index cf80dffa22..09ada3e451 100644 --- a/lisp/org/org-export-latex.el +++ b/lisp/org/org-export-latex.el @@ -4,7 +4,7 @@ ;; ;; Emacs Lisp Archive Entry ;; Filename: org-export-latex.el -;; Version: 6.12a +;; Version: 6.13 ;; Author: Bastien Guerry ;; Maintainer: Bastien Guerry ;; Keywords: org, wp, tex @@ -613,7 +613,9 @@ If NUM, export sections as numerical sections." (occur (number-to-string (cdr (assoc 'occur subcontent)))) (content (cdr (assoc 'content subcontent))) (subcontent (cadr (assoc 'subcontent subcontent))) - (label (org-get-text-property-any 0 'target heading))) + (label (org-get-text-property-any 0 'target heading)) + (label-list (cons label (cdr (assoc label + org-export-target-aliases))))) (cond ;; Normal conversion ((<= level org-export-latex-sectioning-depth) @@ -624,7 +626,9 @@ If NUM, export sections as numerical sections." end (nth (if num 1 3) sec)) (setq start (if num (car sec) (cdr sec)))) (insert (format start heading) "\n") - (when label (insert (format "\\label{%s}\n" label))) + (when label + (insert (mapconcat (lambda (l) (format "\\label{%s}" l)) + label-list "\n") "\n")) (insert (org-export-latex-content content)) (cond ((stringp subcontent) (insert subcontent)) ((listp subcontent) (org-export-latex-sub subcontent))) diff --git a/lisp/org/org-faces.el b/lisp/org/org-faces.el index e24441135f..6cf4db4df6 100644 --- a/lisp/org/org-faces.el +++ b/lisp/org/org-faces.el @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.12a +;; Version: 6.13 ;; ;; This file is part of GNU Emacs. ;; @@ -203,6 +203,12 @@ column view defines special faces for each outline level. See the file :height (face-attribute 'default :height) :family (face-attribute 'default :family))) +(defface org-agenda-column-dateline + (org-compatible-face 'org-column + '((t nil))) + "Face used in agenda column view for datelines with summaries." + :group 'org-faces) + (defface org-warning (org-compatible-face 'font-lock-warning-face '((((class color) (min-colors 16) (background light)) (:foreground "Red1" :bold t)) diff --git a/lisp/org/org-gnus.el b/lisp/org/org-gnus.el index 3f2781bbf3..1d707dc7b1 100644 --- a/lisp/org/org-gnus.el +++ b/lisp/org/org-gnus.el @@ -3,9 +3,10 @@ ;; Copyright (C) 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. ;; Author: Carsten Dominik +;; Tassilo Horn ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.12a +;; Version: 6.13 ;; ;; This file is part of GNU Emacs. ;; @@ -37,7 +38,11 @@ ;; Customization variables -(defcustom org-usenet-links-prefer-google nil +(when (fboundp 'defvaralias) + (defvaralias 'org-usenet-links-prefer-google 'org-gnus-prefer-web-links + "Deprecated name for `org-gnus-prefer-web-links'.")) + +(defcustom org-gnus-prefer-web-links nil "Non-nil means, `org-store-link' will create web links to Google groups. When nil, Gnus will be used for such links. Using a prefix arg to the command \\[org-store-link] (`org-store-link') @@ -57,50 +62,83 @@ negates this setting for the duration of the command." (add-hook 'org-store-link-functions 'org-gnus-store-link) ;; Implementation + +(defun org-gnus-group-link (group) + "Create a link to the Gnus group GROUP. +If GROUP is a newsgroup and `org-gnus-prefer-web-links' is +non-nil, create a link to groups.google.com or gmane.org. +Otherwise create a link to the group inside Gnus. + +If `org-store-link' was called with a prefix arg the meaning of +`org-gnus-prefer-web-links' is reversed." + (let ((unprefixed-group (replace-regexp-in-string "^[^:]+:" "" group))) + (if (and (string-match "^nntp" group) ;; Only for nntp groups + (org-xor current-prefix-arg + org-gnus-prefer-web-links)) + (concat (if (string-match "gmane" unprefixed-group) + "http://news.gmane.org/" + "http://groups.google.com/group/") + unprefixed-group) + (concat "gnus:" group)))) + +(defun org-gnus-article-link (group newsgroups message-id x-no-archive) + "Create a link to a Gnus article. +The article is specified by its MESSAGE-ID. Additional +parameters are the Gnus GROUP, the NEWSGROUPS the article was +posted to and the X-NO-ARCHIVE header value of that article. + +If GROUP is a newsgroup and `org-gnus-prefer-web-links' is +non-nil, create a link to groups.google.com or gmane.org. +Otherwise create a link to the article inside Gnus. + +If `org-store-link' was called with a prefix arg the meaning of +`org-gnus-prefer-web-links' is reversed." + (if (and (org-xor current-prefix-arg org-gnus-prefer-web-links) + newsgroups ;; Make web links only for nntp groups + (not x-no-archive)) ;; and if X-No-Archive isn't set. + (format (if (string-match "gmane\\." newsgroups) + "http://mid.gmane.org/%s" + "http://groups.google.com/groups/search?as_umsgid=%s") + (org-fixup-message-id-for-http + (replace-regexp-in-string "[<>]" "" message-id))) + (org-make-link "gnus:" group "#" message-id))) + (defun org-gnus-store-link () "Store a link to a Gnus folder or message." (cond ((eq major-mode 'gnus-group-mode) - (let ((group (cond ((fboundp 'gnus-group-group-name) ; depending on Gnus - (gnus-group-group-name)) ; version - ((fboundp 'gnus-group-name) - (gnus-group-name)) - (t "???"))) - desc link) + (let* ((group (cond ((fboundp 'gnus-group-group-name) ; depending on Gnus + (gnus-group-group-name)) ; version + ((fboundp 'gnus-group-name) + (gnus-group-name)) + (t "???"))) + desc link) (unless group (error "Not on a group")) (org-store-link-props :type "gnus" :group group) - (setq desc (concat - (if (org-xor current-prefix-arg - org-usenet-links-prefer-google) - "http://groups.google.com/groups?group=" - "gnus:") - group) + (setq desc (org-gnus-group-link group) link (org-make-link desc)) (org-add-link-props :link link :description desc) link)) ((memq major-mode '(gnus-summary-mode gnus-article-mode)) - (and (eq major-mode 'gnus-article-mode) (gnus-article-show-summary)) + (and (eq major-mode 'gnus-summary-mode) (gnus-summary-show-article)) (let* ((group gnus-newsgroup-name) - (article (gnus-summary-article-number)) - (header (gnus-summary-article-header article)) - (from (mail-header-from header)) - (message-id (mail-header-id header)) - (date (mail-header-date header)) - (extra (mail-header-extra header)) - (to (cdr (assoc 'To extra))) + (header (with-current-buffer gnus-article-buffer + (gnus-summary-toggle-header 1) + (goto-char (point-min)) + (mail-header-extract-no-properties))) + (from (mail-header 'from header)) + (message-id (mail-header 'message-id header)) + (date (mail-header 'date header)) + (to (mail-header 'to header)) + (newsgroups (mail-header 'newsgroups header)) + (x-no-archive (mail-header 'x-no-archive header)) (subject (gnus-summary-subject-string)) desc link) (org-store-link-props :type "gnus" :from from :subject subject :message-id message-id :group group :to to) - (setq desc (org-email-link-description)) - (if (org-xor current-prefix-arg org-usenet-links-prefer-google) - (setq link - (format "http://groups.google.com/groups?as_umsgid=%s" - (org-fixup-message-id-for-http message-id))) - (setq link (org-make-link "gnus:" group "#" - (or message-id - (number-to-string article))))) + (setq desc (org-email-link-description) + link (org-gnus-article-link group newsgroups message-id x-no-archive)) (org-add-link-props :link link :description desc) link)))) diff --git a/lisp/org/org-id.el b/lisp/org/org-id.el index 764c0254e7..64f139c5f1 100644 --- a/lisp/org/org-id.el +++ b/lisp/org/org-id.el @@ -4,7 +4,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.12a +;; Version: 6.13 ;; ;; This file is part of GNU Emacs. ;; @@ -376,15 +376,16 @@ Store the relation between files and corresponding ID's." (defun org-id-add-location (id file) "Add the ID with location FILE to the database of ID loations." - (unless org-id-locations (org-id-locations-load)) - (catch 'exit - (let ((locs org-id-locations) list) - (while (setq list (pop locs)) - (when (equal (file-truename file) (file-truename (car list))) - (setcdr list (cons id (cdr list))) - (throw 'exit t)))) - (push (list file id) org-id-locations)) - (org-id-locations-save)) + (when (and id file) ; don't error when called from a buffer with no file + (unless org-id-locations (org-id-locations-load)) + (catch 'exit + (let ((locs org-id-locations) list) + (while (setq list (pop locs)) + (when (equal (file-truename file) (file-truename (car list))) + (setcdr list (cons id (cdr list))) + (throw 'exit t)))) + (push (list file id) org-id-locations)) + (org-id-locations-save))) ;; Finding entries with specified id diff --git a/lisp/org/org-info.el b/lisp/org/org-info.el index 20127e4aca..c040ba6f87 100644 --- a/lisp/org/org-info.el +++ b/lisp/org/org-info.el @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.12a +;; Version: 6.13 ;; ;; This file is part of GNU Emacs. ;; diff --git a/lisp/org/org-irc.el b/lisp/org/org-irc.el index acc9918582..4d35ef3dd9 100644 --- a/lisp/org/org-irc.el +++ b/lisp/org/org-irc.el @@ -4,7 +4,7 @@ ;; ;; Author: Philip Jackson ;; Keywords: erc, irc, link, org -;; Version: 6.12a +;; Version: 6.13 ;; ;; This file is part of GNU Emacs. ;; @@ -27,7 +27,7 @@ ;; Org-mode loads this module by default - if this is not what you want, ;; configure the variable `org-modules'. ;; -;; Please customize the variable `org-default-extensions' to select +;; Please customize the variable `org-modules' to select ;; extensions you would like to use, and to deselect those which you don't ;; want. ;; diff --git a/lisp/org/org-jsinfo.el b/lisp/org/org-jsinfo.el index 93a57de618..f1bb3ef7ed 100644 --- a/lisp/org/org-jsinfo.el +++ b/lisp/org/org-jsinfo.el @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.12a +;; Version: 6.13 ;; ;; This file is part of GNU Emacs. ;; diff --git a/lisp/org/org-list.el b/lisp/org/org-list.el index 0b3dd3d360..a2990743a5 100644 --- a/lisp/org/org-list.el +++ b/lisp/org/org-list.el @@ -6,7 +6,7 @@ ;; Bastien Guerry ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.12a +;; Version: 6.13 ;; ;; This file is part of GNU Emacs. ;; @@ -72,6 +72,18 @@ the safe choice." (const :tag "paren like in \"2)\"" ?\)) (const :tab "both" t))) +(defcustom org-list-two-spaces-after-bullet-regexp nil + "A regular expression matching bullets that should have 2 spaces after them. +When nil, no bullet will have two spaces after them. +When a string, it will be used as a regular expression. When the bullet +type of a list is changed, the new bullet type will be matched against this +regexp. If it matches, there will be two spaces instead of one after +the bullet in each item of he list." + :group 'org-plain-list + :type '(choice + (const :tag "never" nil) + (regexp))) + (defcustom org-empty-line-terminates-plain-lists nil "Non-nil means, an empty line ends all plain list levels. When nil, empty lines are part of the preceeding item." @@ -259,7 +271,7 @@ the whole buffer." (save-excursion (let* ((buffer-invisibility-spec (org-inhibit-invisibility)) ; Emacs 21 (beg (condition-case nil - (progn (outline-back-to-heading) (point)) + (progn (org-back-to-heading) (point)) (error (point-min)))) (end (move-marker (make-marker) (progn (outline-next-heading) (point)))) @@ -589,7 +601,7 @@ If WHICH is a string, use that as the new bullet. If WHICH is an integer, (beginning-of-line 1) (let ((current (match-string 0)) (prevp (eq which 'previous)) - new) + new old) (setq new (cond ((and (numberp which) (nth (1- which) '("-" "+" "*" "1." "1)")))) @@ -597,10 +609,14 @@ If WHICH is a string, use that as the new bullet. If WHICH is an integer, ((string-match "\\+" current) (if prevp "-" (if (looking-at "\\S-") "1." "*"))) ((string-match "\\*" current) (if prevp "+" "1.")) - ((string-match "\\." current) (if prevp "*" "1)")) + ((string-match "\\." current) + (if prevp (if (looking-at "\\S-") "+" "*") "1)")) ((string-match ")" current) (if prevp "1." "-")) (t (error "This should not happen")))) - (and (looking-at "\\([ \t]*\\)\\S-+") (replace-match (concat "\\1" new))) + (and (looking-at "\\([ \t]*\\)\\(\\S-+\\)") + (setq old (match-string 2)) + (replace-match (concat "\\1" new))) + (org-shift-item-indentation (- (length new) (length old))) (org-fix-bullet-type) (org-maybe-renumber-ordered-list)))) @@ -629,7 +645,7 @@ with something like \"1.\" or \"2)\"." (buffer-substring (point-at-bol) (match-beginning 3)))) ;; (term (substring (match-string 3) -1)) ind1 (n (1- arg)) - fmt bobp) + fmt bobp old new) ;; find where this list begins (org-beginning-of-item-list) (setq bobp (bobp)) @@ -647,26 +663,32 @@ with something like \"1.\" or \"2)\"." (if (> ind1 ind) (throw 'next t)) (if (< ind1 ind) (throw 'exit t)) (if (not (org-at-item-p)) (throw 'exit nil)) + (setq old (match-string 2)) (delete-region (match-beginning 2) (match-end 2)) (goto-char (match-beginning 2)) - (insert (format fmt (setq n (1+ n))))))) + (insert (setq new (format fmt (setq n (1+ n))))) + (org-shift-item-indentation (- (length new) (length old)))))) (goto-line line) (org-move-to-column col))) (defun org-fix-bullet-type () - "Make sure all items in this list have the same bullet as the firsst item." + "Make sure all items in this list have the same bullet as the first item. +Also, fix the indentation." (interactive) (unless (org-at-item-p) (error "This is not a list")) (let ((line (org-current-line)) (col (current-column)) (ind (current-indentation)) - ind1 bullet) + ind1 bullet oldbullet) ;; find where this list begins (org-beginning-of-item-list) (beginning-of-line 1) ;; find out what the bullet type is (looking-at "[ \t]*\\(\\S-+\\)") - (setq bullet (match-string 1)) + (setq bullet (concat (match-string 1) " ")) + (if (and org-list-two-spaces-after-bullet-regexp + (string-match org-list-two-spaces-after-bullet-regexp bullet)) + (setq bullet (concat bullet " "))) ;; walk forward and replace these numbers (beginning-of-line 0) (catch 'exit @@ -680,13 +702,31 @@ with something like \"1.\" or \"2)\"." (if (< ind1 ind) (throw 'exit t)) (if (not (org-at-item-p)) (throw 'exit nil)) (skip-chars-forward " \t") - (looking-at "\\S-+") - (replace-match bullet)))) + (looking-at "\\S-+ *") + (setq oldbullet (match-string 0)) + (replace-match bullet) + (org-shift-item-indentation (- (length bullet) (length oldbullet)))))) (goto-line line) (org-move-to-column col) (if (string-match "[0-9]" bullet) (org-renumber-ordered-list 1)))) +(defun org-shift-item-indentation (delta) + "Shift the indentation in current item by DELTA." + (save-excursion + (let ((beg (point-at-bol)) + (end (progn (org-end-of-item) (point))) + i) + (goto-char end) + (beginning-of-line 0) + (while (> (point) beg) + (when (looking-at "[ \t]*\\S-") + ;; this is not an empty line + (setq i (org-get-indentation)) + (if (and (> i 0) (> (setq i (+ i delta)) 0)) + (indent-line-to i))) + (beginning-of-line 0))))) + (defun org-beginning-of-item-list () "Go to the beginning of the current item list. I.e. to the first item in this list." diff --git a/lisp/org/org-mac-message.el b/lisp/org/org-mac-message.el index 13fa6ddd75..2f9e63bed8 100644 --- a/lisp/org/org-mac-message.el +++ b/lisp/org/org-mac-message.el @@ -3,7 +3,7 @@ ;; Copyright (C) 2008 Free Software Foundation, Inc. ;; Author: John Wiegley -;; Version: 6.12a +;; Version: 6.13 ;; Keywords: outlines, hypermedia, calendar, wp ;; This file is part of GNU Emacs. diff --git a/lisp/org/org-macs.el b/lisp/org/org-macs.el index 7f4f3d106f..563f6c3e33 100644 --- a/lisp/org/org-macs.el +++ b/lisp/org/org-macs.el @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.12a +;; Version: 6.13 ;; ;; This file is part of GNU Emacs. ;; diff --git a/lisp/org/org-mew.el b/lisp/org/org-mew.el index f8c7f3f916..fda6270016 100644 --- a/lisp/org/org-mew.el +++ b/lisp/org/org-mew.el @@ -5,7 +5,7 @@ ;; Author: Tokuya Kameshima ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.12a +;; Version: 6.13 ;; This file is part of GNU Emacs. @@ -34,21 +34,23 @@ (require 'org) (defgroup org-mew nil - "Options concerning the Mew link." - :tag "Org Startup" - :group 'org-link) + "Options concerning the Mew link." + :tag "Org Startup" + :group 'org-link) (defcustom org-mew-link-to-refile-destination t - "Create a link to the refile destination if the message is marked as refile." - :group 'org-mew - :type 'boolean) + "Create a link to the refile destination if the message is marked as refile." + :group 'org-mew + :type 'boolean) ;; Declare external functions and variables (declare-function mew-cache-hit "ext:mew-cache" (fld msg &optional must-hit)) +(declare-function mew-case-folder "ext:mew-func" (case folder)) (declare-function mew-header-get-value "ext:mew-header" (field &optional as-list)) (declare-function mew-init "ext:mew" ()) (declare-function mew-refile-get "ext:mew-refile" (msg)) +(declare-function mew-sinfo-get-case "ext:mew-summary" ()) (declare-function mew-summary-display "ext:mew-summary2" (&optional redisplay)) (declare-function mew-summary-folder-name "ext:mew-syntax" (&optional ext)) (declare-function mew-summary-get-mark "ext:mew-mark" ()) @@ -69,17 +71,18 @@ ;; Implementation (defun org-mew-store-link () - "Store a link to a Mew folder or message." - (when (memq major-mode '(mew-summary-mode mew-virtual-mode)) - (let* ((msgnum (mew-summary-message-number2)) + "Store a link to a Mew folder or message." + (when (memq major-mode '(mew-summary-mode mew-virtual-mode)) + (let* ((msgnum (mew-summary-message-number2)) (mark-info (mew-summary-get-mark)) (folder-name (if (and org-mew-link-to-refile-destination (eq mark-info ?o)) ; marked as refile - (nth 1 (mew-refile-get msgnum)) + (mew-case-folder (mew-sinfo-get-case) + (nth 1 (mew-refile-get msgnum))) (mew-summary-folder-name))) message-id from to subject desc link) - (save-window-excursion + (save-window-excursion (if (fboundp 'mew-summary-set-message-buffer) (mew-summary-set-message-buffer folder-name msgnum) (set-buffer (mew-cache-hit folder-name msgnum t))) @@ -87,35 +90,35 @@ (setq from (mew-header-get-value "From:")) (setq to (mew-header-get-value "To:")) (setq subject (mew-header-get-value "Subject:"))) - (org-store-link-props :type "mew" :from from :to to + (org-store-link-props :type "mew" :from from :to to :subject subject :message-id message-id) - (setq message-id (org-remove-angle-brackets message-id)) - (setq desc (org-email-link-description)) - (setq link (org-make-link "mew:" folder-name + (setq message-id (org-remove-angle-brackets message-id)) + (setq desc (org-email-link-description)) + (setq link (org-make-link "mew:" folder-name "#" message-id)) - (org-add-link-props :link link :description desc) - link))) + (org-add-link-props :link link :description desc) + link))) (defun org-mew-open (path) - "Follow the Mew message link specified by PATH." - (let (folder msgnum) - (cond ((string-match "\\`\\(+.*\\)+\\+\\([0-9]+\\)\\'" path) ; for Bastien's + "Follow the Mew message link specified by PATH." + (let (folder msgnum) + (cond ((string-match "\\`\\(+.*\\)+\\+\\([0-9]+\\)\\'" path) ; for Bastien's (setq folder (match-string 1 path)) (setq msgnum (match-string 2 path))) ((string-match "\\`\\(\\(%#\\)?[^#]+\\)\\(#\\(.*\\)\\)?" path) (setq folder (match-string 1 path)) (setq msgnum (match-string 4 path))) (t (error "Error in Mew link"))) - (require 'mew) - (mew-window-push) - (unless mew-init-p (mew-init)) - (mew-summary-visit-folder folder) - (when msgnum - (if (not (string-match "\\`[0-9]+\\'" msgnum)) + (require 'mew) + (mew-window-push) + (unless mew-init-p (mew-init)) + (mew-summary-visit-folder folder) + (when msgnum + (if (not (string-match "\\`[0-9]+\\'" msgnum)) (let* ((pattern (concat "message-id=" msgnum)) (msgs (mew-summary-pick-with-mewl pattern folder nil))) (setq msgnum (car msgs)))) - (if (mew-summary-search-msg msgnum) + (if (mew-summary-search-msg msgnum) (if mew-summary-goto-line-then-display (mew-summary-display)) (error "Message not found"))))) diff --git a/lisp/org/org-mhe.el b/lisp/org/org-mhe.el index 19c7f5b1d3..ab9f797cb8 100644 --- a/lisp/org/org-mhe.el +++ b/lisp/org/org-mhe.el @@ -5,7 +5,7 @@ ;; Author: Thomas Baumann ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.12a +;; Version: 6.13 ;; ;; This file is part of GNU Emacs. ;; diff --git a/lisp/org/org-mouse.el b/lisp/org/org-mouse.el index 7f3e322d1b..0cb6505816 100644 --- a/lisp/org/org-mouse.el +++ b/lisp/org/org-mouse.el @@ -4,7 +4,7 @@ ;; ;; Author: Piotr Zielinski ;; Maintainer: Carsten Dominik -;; Version: 6.12a +;; Version: 6.13 ;; ;; This file is part of GNU Emacs. ;; @@ -144,7 +144,7 @@ (defvar org-agenda-undo-list) (defvar org-agenda-custom-commands) (declare-function org-agenda-change-all-lines "org-agenda" - (newhead hdmarker &optional fixface just-this)) + (newhead hdmarker &optional fixface)) (declare-function org-verify-change-for-undo "org-agenda" (l1 l2)) (defvar org-mouse-plain-list-regexp "\\([ \t]*\\)\\([-+*]\\|[0-9]+[.)]\\) " @@ -584,7 +584,7 @@ SCHEDULED: or DEADLINE: or ANYTHINGLIKETHIS:" (beginning-of-line) (looking-at "[ \t]*") (open-line 1) - (indent-to (- (match-end 0) (match-beginning 0))) + (org-indent-to-column (- (match-end 0) (match-beginning 0))) (insert "+ ")) (:middle ; insert after diff --git a/lisp/org/org-plot.el b/lisp/org/org-plot.el index a469cf6168..b2443ccd7e 100644 --- a/lisp/org/org-plot.el +++ b/lisp/org/org-plot.el @@ -5,7 +5,7 @@ ;; Author: Eric Schulte ;; Keywords: tables, plotting ;; Homepage: http://orgmode.org -;; Version: 6.12a +;; Version: 6.13 ;; ;; This file is part of GNU Emacs. ;; diff --git a/lisp/org/org-publish.el b/lisp/org/org-publish.el index bbd9180512..eafa8faab6 100644 --- a/lisp/org/org-publish.el +++ b/lisp/org/org-publish.el @@ -4,7 +4,7 @@ ;; Author: David O'Toole ;; Maintainer: Bastien Guerry ;; Keywords: hypermedia, outlines, wp -;; Version: 6.12a +;; Version: 6.13 ;; This file is part of GNU Emacs. ;; @@ -626,7 +626,7 @@ Default for INDEX-FILENAME is 'index.org'." (if index-buffer (kill-buffer index-buffer)) (with-temp-buffer - (insert (concat "* " index-title "\n\n")) + (insert (concat "#+TITLE: " index-title "\n\n")) (while (setq file (pop files)) (let ((fn (file-name-nondirectory file)) (link (file-relative-name file dir)) @@ -703,7 +703,7 @@ Default for INDEX-FILENAME is 'index.org'." (if force nil org-publish-use-timestamps-flag))) (org-publish-projects (list (or project - (assoc (completing-read + (assoc (org-ido-completing-read "Publish project: " org-publish-project-alist nil t) org-publish-project-alist))))))) diff --git a/lisp/org/org-remember.el b/lisp/org/org-remember.el index 7968f0a894..ce3f5479ea 100644 --- a/lisp/org/org-remember.el +++ b/lisp/org/org-remember.el @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.12a +;; Version: 6.13 ;; ;; This file is part of GNU Emacs. ;; @@ -54,7 +54,7 @@ (defcustom org-remember-store-without-prompt t "Non-nil means, `C-c C-c' stores remember note without further prompts. It then uses the file and headline specified by the template or (if the -themplate does not specify them) by the variables `org-default-notes-file' +template does not specify them) by the variables `org-default-notes-file' and `org-remember-default-headline'. To force prompting anyway, use `C-u C-c C-c' to file the note. @@ -195,6 +195,26 @@ calendar | %:type %:date" (symbol :tag "Major mode")) (function :tag "Perform a check against function"))))) +(defcustom org-remember-before-finalize-hook nil + "Hook that is run right before a remember process is finalized. +The remember buffer is still current when this hook runs." + :group 'org-remember + :type 'hook) + +(defvar org-remember-mode-map (make-sparse-keymap) + "Keymap for org-remember-mode, a minor mode. +Use this map to set additional keybindings for when Org-mode is used +for a Remember buffer.") +(defvar org-remember-mode-hook nil + "Hook for the minor `org-remember-mode'.") + +(define-minor-mode org-remember-mode + "Minor mode for special key bindings in a remember buffer." + nil " Rem" org-remember-mode-map + (run-hooks 'org-remember-mode-hook)) +(define-key org-remember-mode-map "\C-c\C-c" 'org-remember-finalize) +(define-key org-remember-mode-map "\C-c\C-k" 'org-remember-kill) + (defcustom org-remember-clock-out-on-exit 'query "Non-nil means, stop the clock when exiting a clocking remember buffer. This only applies if the clock is running in the remember buffer. If the @@ -360,7 +380,7 @@ to be run from that hook to function properly." v-a)) (v-n user-full-name) (v-k (if (marker-buffer org-clock-marker) - (substring-no-properties org-clock-heading))) + (org-substring-no-properties org-clock-heading))) (v-K (if (marker-buffer org-clock-marker) (org-make-link-string (buffer-file-name (marker-buffer org-clock-marker)) @@ -446,8 +466,7 @@ to be run from that hook to function properly." (replace-match x t t)))) ;; Turn on org-mode in the remember buffer, set local variables - (let ((org-inhibit-startup t)) (org-mode)) - (org-set-local 'org-finish-function 'org-remember-finalize) + (let ((org-inhibit-startup t)) (org-mode) (org-remember-mode 1)) (if (and file (string-match "\\S-" file) (not (file-directory-p file))) (org-set-local 'org-default-notes-file file)) (if headline @@ -474,7 +493,7 @@ to be run from that hook to function properly." (org-global-tags-completion-table (if (equal char "G") (org-agenda-files) (and file (list file))))) (org-add-colon-after-tag-completion t) - (ins (completing-read + (ins (org-ido-completing-read (if prompt (concat prompt ": ") "Tags: ") 'org-tags-completion-function nil nil nil 'org-tags-history))) @@ -501,17 +520,23 @@ to be run from that hook to function properly." (car clipboards)))))) ((equal char "p") (let* - ((prop (substring-no-properties prompt)) - (allowed (with-current-buffer - (get-buffer (file-name-nondirectory file)) - (org-property-get-allowed-values nil prop 'table))) + ((prop (org-substring-no-properties prompt)) + (pall (concat prop "_ALL")) + (allowed + (with-current-buffer + (get-buffer (file-name-nondirectory file)) + (or (cdr (assoc pall org-file-properties)) + (cdr (assoc pall org-global-properties)) + (cdr (assoc pall org-global-properties-fixed))))) (existing (with-current-buffer (get-buffer (file-name-nondirectory file)) (mapcar 'list (org-property-values prop)))) (propprompt (concat "Value for " prop ": ")) (val (if allowed - (org-completing-read propprompt allowed nil - 'req-match) + (org-completing-read + propprompt + (mapcar 'list (org-split-string allowed "[ \t]+")) + nil 'req-match) (org-completing-read propprompt existing nil nil "" nil "")))) (org-set-property prop val))) @@ -524,17 +549,17 @@ to be run from that hook to function properly." (member char '("u" "U")) nil nil (list org-end-time-was-given))) (t - (insert (org-completing-read - (concat (if prompt prompt "Enter string") - (if default (concat " [" default "]")) - ": ") - completions nil nil nil histvar default))))) + (let (org-completion-use-ido) + (insert (org-completing-read + (concat (if prompt prompt "Enter string") + (if default (concat " [" default "]")) + ": ") + completions nil nil nil histvar default)))))) (goto-char (point-min)) (if (re-search-forward "%\\?" nil t) (replace-match "") (and (re-search-forward "^[^#\n]" nil t) (backward-char 1)))) - (let ((org-inhibit-startup t)) (org-mode)) - (org-set-local 'org-finish-function 'org-remember-finalize)) + (let ((org-inhibit-startup t)) (org-mode) (org-remember-mode 1))) (when (save-excursion (goto-char (point-min)) (re-search-forward "%&" nil t)) @@ -551,8 +576,7 @@ to be run from that hook to function properly." This should be run in `post-command-hook' and will remove itself from that hook." (remove-hook 'post-command-hook 'org-remember-finish-immediately) - (when org-finish-function - (funcall org-finish-function))) + (org-remember-finalize)) (defun org-remember-visit-immediately () "File remember note immediately. @@ -572,6 +596,10 @@ from that hook." (defvar org-clock-marker) ; Defined in org.el (defun org-remember-finalize () "Finalize the remember process." + (interactive) + (unless org-remember-mode + (error "This does not seem to be a remember buffer for Org-mode")) + (run-hooks 'org-remember-before-finalize-hook) (unless (fboundp 'remember-finalize) (defalias 'remember-finalize 'remember-buffer)) (when (and org-clock-marker @@ -587,6 +615,12 @@ from that hook." (setq buffer-file-name nil)) (remember-finalize)) +(defun org-remember-kill () + "Abort the current remember process." + (interactive) + (let ((org-note-abort t)) + (org-remember-finalize))) + ;;;###autoload (defun org-remember (&optional goto org-force-remember-template-char) "Call `remember'. If this is already a remember buffer, re-apply template. @@ -610,7 +644,7 @@ associated with a template in `org-remember-templates'." ;; `org-select-remember-template' (setq org-select-template-temp-major-mode major-mode) (setq org-select-template-original-buffer (current-buffer)) - (if (eq org-finish-function 'org-remember-finalize) + (if org-remember-mode (progn (when (< (length org-remember-templates) 2) (error "No other template available")) @@ -769,6 +803,10 @@ See also the variable `org-reverse-note-order'." (not fastp)) (org-refile nil (or visiting (find-file-noselect file))) (and visitp (run-with-idle-timer 0.01 nil 'org-remember-visit-immediately)) + (save-excursion + (bookmark-jump "org-refile-last-stored") + (bookmark-set "org-remember-last-stored") + (move-marker org-remember-last-stored-marker (point))) (throw 'quit t)) ;; Find the file (if (not visiting) (find-file-noselect file)) diff --git a/lisp/org/org-rmail.el b/lisp/org/org-rmail.el index 8754f2a8c6..4782f50eac 100644 --- a/lisp/org/org-rmail.el +++ b/lisp/org/org-rmail.el @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.12a +;; Version: 6.13 ;; ;; This file is part of GNU Emacs. ;; diff --git a/lisp/org/org-table.el b/lisp/org/org-table.el index 5394241654..0797d1b132 100644 --- a/lisp/org/org-table.el +++ b/lisp/org/org-table.el @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.12a +;; Version: 6.13 ;; ;; This file is part of GNU Emacs. ;; diff --git a/lisp/org/org-vm.el b/lisp/org/org-vm.el index 1195e1192f..2394591ffd 100644 --- a/lisp/org/org-vm.el +++ b/lisp/org/org-vm.el @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.12a +;; Version: 6.13 ;; ;; This file is part of GNU Emacs. ;; @@ -111,6 +111,7 @@ (funcall (cdr (assq 'vm org-link-frame-setup)) folder readonly) (sit-for 0.1) (when article + (require 'vm-search) (vm-select-folder-buffer) (widen) (let ((case-fold-search t)) diff --git a/lisp/org/org-wl.el b/lisp/org/org-wl.el index ac2be1f409..e07bc82c06 100644 --- a/lisp/org/org-wl.el +++ b/lisp/org/org-wl.el @@ -5,7 +5,7 @@ ;; Author: Tokuya Kameshima ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.12a +;; Version: 6.13 ;; ;; This file is part of GNU Emacs. ;; diff --git a/lisp/org/org.el b/lisp/org/org.el index caac01689f..d25d9c5cf5 100644 --- a/lisp/org/org.el +++ b/lisp/org/org.el @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.12a +;; Version: 6.13 ;; ;; This file is part of GNU Emacs. ;; @@ -92,7 +92,7 @@ ;;; Version -(defconst org-version "6.12a" +(defconst org-version "6.13" "The version number of the file org.el.") (defun org-version (&optional here) @@ -125,7 +125,7 @@ With prefix arg HERE, insert it at point." "Have the modules been loaded already?") (defun org-load-modules-maybe (&optional force) - "Load all extensions listed in `org-default-extensions'." + "Load all extensions listed in `org-modules'." (when (or force (not org-modules-loaded)) (mapc (lambda (ext) (condition-case nil (require ext) @@ -180,7 +180,9 @@ to add the symbol `xyz', and the package must have a call to (const :tag "C depend: TODO dependencies for Org-mode" org-depend) (const :tag "C elisp-symbol: Org links to emacs-lisp symbols" org-elisp-symbol) (const :tag "C eval: Include command output as text" org-eval) + (const :tag "C eval-light: Evaluate inbuffer-code on demand" org-eval-light) (const :tag "C expiry: Expiry mechanism for Org entries" org-expiry) + (const :tag "C exp-blocks: Pre-process blocks for export" org-exp-blocks) (const :tag "C id: Global id's for identifying entries" org-id) (const :tag "C interactive-query: Interactive modification of tags query" org-interactive-query) (const :tag "C mairix: Hook mairix search into Org for different MUAs" org-mairix) @@ -843,7 +845,9 @@ links in Org-mode buffers can have an optional tag after a double colon, e.g. [[linkkey:tag][description]] If REPLACE is a string, the tag will simply be appended to create the link. -If the string contains \"%s\", the tag will be inserted there. +If the string contains \"%s\", the tag will be inserted there. Alternatively, +the placeholder \"%h\" will cause a url-encoded version of the tag to +be inserted at that point (see the function `url-hexify-string'). REPLACE may also be a function that will be called with the tag as the only argument to create the link, which should be returned as a string. @@ -979,6 +983,20 @@ more efficient." :tag "Org Follow Link" :group 'org-link) +(defcustom org-link-translation-function nil + "Function to translate links with different syntax to Org syntax. +This can be used to translate links created for example by the Planner +or emacs-wiki packages to Org syntax. +The function must accept two parameters, a TYPE containing the link +protocol name like \"rmail\" or \"gnus\" as a string, and the linked path, +which is everything after the link protocol. It should return a cons +with possibly modifed values of type and path. +Org contains a function for this, so if you set this variable to +`org-translate-link-from-planner', you should be able follow many +links created by planner." + :group 'org-link-follow + :type 'function) + (defcustom org-follow-link-hook nil "Hook that is run after a link has been followed." :group 'org-link-follow @@ -1304,11 +1322,11 @@ are used, equivalent to the value `((nil . (:level . 1))'." (const :tag "Current buffer" nil) (function) (variable) (file)) (choice :tag "Identify target headline by" - (cons :tag "Specific tag" (const :tag) (string)) - (cons :tag "TODO keyword" (const :todo) (string)) - (cons :tag "Regular expression" (const :regexp) (regexp)) - (cons :tag "Level number" (const :level) (integer)) - (cons :tag "Max Level number" (const :maxlevel) (integer)))))) + (cons :tag "Specific tag" (const :value :tag) (string)) + (cons :tag "TODO keyword" (const :value :todo) (string)) + (cons :tag "Regular expression" (const :value :regexp) (regexp)) + (cons :tag "Level number" (const :value :level) (integer)) + (cons :tag "Max Level number" (const :value :maxlevel) (integer)))))) (defcustom org-refile-use-outline-path nil "Non-nil means, provide refile targets as paths. @@ -1699,7 +1717,7 @@ end of the second format." org-mode generates a time duration." :group 'org-time :type 'string) - + (defcustom org-deadline-warning-days 14 "No. of days before expiration during which a deadline becomes active. This variable governs the display in sparse trees and in the agenda. @@ -1996,7 +2014,8 @@ These are fixed values, for the preset properties.") (defcustom org-global-properties nil "List of property/value pairs that can be inherited by any entry. -You can set buffer-local values for this by adding lines like +You can set buffer-local values for the same purpose in the variable +`org-file-properties' this by adding lines like #+PROPERTY: NAME VALUE" :group 'org-properties @@ -2319,6 +2338,11 @@ Use customize to modify this, or restart Emacs after changing it." :tag "Org Completion" :group 'org) +(defcustom org-completion-use-ido nil + "Non-ni means, use ido completion wherever possible." + :group 'org-completion + :type 'boolean) + (defcustom org-completion-fallback-command 'hippie-expand "The expansion command called by \\[org-complete] in normal context. Normal means, no org-mode-specific context." @@ -2357,11 +2381,12 @@ Normal means, no org-mode-specific context." (extra txt &optional category tags dotime noprefix remove-re)) (declare-function org-agenda-new-marker "org-agenda" (&optional pos)) (declare-function org-agenda-change-all-lines "org-agenda" - (newhead hdmarker &optional fixface just-this)) + (newhead hdmarker &optional fixface)) (declare-function org-agenda-set-restriction-lock "org-agenda" (&optional type)) (declare-function org-agenda-maybe-redo "org-agenda" ()) (declare-function org-agenda-save-markers-for-cut-and-paste "org-agenda" (beg end)) +(declare-function org-agenda-copy-local-variable "org-agenda" (var)) (declare-function parse-time-string "parse-time" (string)) (declare-function remember "remember" (&optional initial)) (declare-function remember-buffer-desc "remember" ()) @@ -2565,7 +2590,7 @@ Otherwise, return nil." (<= org-clock-marker (point-at-eol))) ;; The clock is running here (setq org-clock-start-time - (apply 'encode-time + (apply 'encode-time (org-parse-time-string (match-string 1)))) (org-update-mode-line))) (t @@ -2612,17 +2637,19 @@ If yes, offer to stop it and to save the buffer with the changes." (defcustom org-archive-location "%s_archive::" "The location where subtrees should be archived. -Otherwise, the value of this variable is a string, consisting of two -parts, separated by a double-colon. +The value of this variable is a string, consisting of two parts, +separated by a double-colon. The first part is a filename and +the second part is a headline. -The first part is a file name - when omitted, archiving happens in the same -file. %s will be replaced by the current file name (without directory part). -Archiving to a different file is useful to keep archived entries from -contributing to the Org-mode Agenda. +When the filename is omitted, archiving happens in the same file. +%s in the filename will be replaced by the current file +name (without the directory part). Archiving to a different file +is useful to keep archived entries from contributing to the +Org-mode Agenda. -The part after the double colon is a headline. The archived entries will be -filed under that headline. When omitted, the subtrees are simply filed away -at the end of the file, as top-level entries. +The archived entries will be filed as subtrees of the specified +headline. When the headline is omitted, the subtrees are simply +filed away at the end of the file, as top-level entries. Here are a few examples: \"%s_archive::\" @@ -2738,8 +2765,8 @@ collapsed state." ;; Autoload ID code (org-autoload "org-id" - '(org-id-get-create org-id-new org-id-copy org-id-get - org-id-get-with-outline-path-completion + '(org-id-get-create org-id-new org-id-copy org-id-get + org-id-get-with-outline-path-completion org-id-get-with-outline-drilling org-id-goto org-id-find)) @@ -3397,6 +3424,8 @@ The following commands are available: "Matches a link with spaces, optional angular brackets around it.") (defvar org-link-re-with-space2 nil "Matches a link with spaces, optional angular brackets around it.") +(defvar org-link-re-with-space3 nil + "Matches a link with spaces, only for internal part in bracket links.") (defvar org-angle-link-re nil "Matches link with angular brackets, spaces are allowed.") (defvar org-plain-link-re nil @@ -3432,6 +3461,11 @@ This should be called after the variable `org-link-types' has changed." "\\([^" org-non-link-chars " ]" "[^\t\n\r]*" "[^" org-non-link-chars " ]\\)>?") + org-link-re-with-space3 + (concat + "]+\\)" link)) + (string-match "^file:\\(.+?\\)::\\([^>]+\\)" link)) (let* ((path (match-string 1 link)) (case-fold-search nil) (search (match-string 2 link))) @@ -6495,7 +6534,7 @@ used as the link location instead of reading one interactively." (setq link search))))) ;; Check if we can/should use a relative path. If yes, simplify the link - (when (string-match "\\