Merge branch 'master' of orgmode.org:org-mode

This commit is contained in:
Eric Schulte 2011-03-14 09:31:47 -06:00
commit bb2dd85938
10 changed files with 112 additions and 90 deletions

View File

@ -3492,7 +3492,7 @@ given in `org-agenda-start-on-weekday'."
(setq org-agenda-last-arguments (list include-all start-day span))
(org-compile-prefix-format 'agenda)
(org-set-sorting-strategy 'agenda)
(let* ((span (org-agenda-ndays-to-span
(let* ((span (org-agenda-ndays-to-span
(or span org-agenda-ndays org-agenda-span)))
(today (org-today))
(sd (or start-day today))
@ -4339,7 +4339,7 @@ of what a project is and how to check if it stuck, customize the variable
(if (zerop (buffer-size))
(setq entries nil)
(setq entries (buffer-substring (point-min) (- (point-max) 1)))
(setq entries
(setq entries
(with-temp-buffer
(insert entries) (goto-char (point-min))
(while (re-search-forward "\n[ \t]+\\(.+\\)$" nil t)
@ -4702,7 +4702,7 @@ This function is invoked if `org-agenda-todo-ignore-deadlines',
b3 (match-beginning 3) e3 (match-end 3)
todo-state (save-match-data (ignore-errors (org-get-todo-state)))
show-all (or (eq org-agenda-repeating-timestamp-show-all t)
(member todo-state
(member todo-state
org-agenda-repeating-timestamp-show-all)))
(catch :skip
(and (org-at-date-range-p) (throw :skip nil))
@ -4956,7 +4956,7 @@ be skipped."
pos (1- (match-beginning 1))
todo-state (save-match-data (org-get-todo-state))
show-all (or (eq org-agenda-repeating-timestamp-show-all t)
(member todo-state
(member todo-state
org-agenda-repeating-timestamp-show-all))
d2 (org-time-string-to-absolute
(match-string 1) d1 'past show-all)
@ -5461,7 +5461,7 @@ The modified list may contain inherited tags, and tags matched by
2 (length (car new)) 'face 'org-time-grid (car new))))
(when (and todayp org-agenda-show-current-time-in-grid)
(push (org-format-agenda-item
nil
nil
org-agenda-current-time-string
"" nil
(format-time-string "%H:%M "))
@ -7918,7 +7918,7 @@ This is a command that has to be installed in `calendar-mode-map'."
(when (string-match regexp (get-text-property (point) 'txt))
(setq entries-marked (+ entries-marked 1))
(call-interactively 'org-agenda-bulk-mark))))
(if (not entries-marked)
(if (not entries-marked)
(message "No entry matching this regexp."))))
(defun org-agenda-bulk-unmark ()
@ -7969,7 +7969,7 @@ The prefix arg is passed through to the command if possible."
(interactive "P")
(unless org-agenda-bulk-marked-entries
(error "No entries are marked"))
(message "Bulk: [r]efile [$]arch [A]rch->sib [t]odo [+/-]tag [s]chd [S]catter [d]eadline")
(message "Bulk: [r]efile [$]arch [A]rch->sib [t]odo [+/-]tag [s]chd [S]catter [d]eadline [f]unction")
(let* ((action (read-char-exclusive))
(org-log-refile (if org-log-refile 'time nil))
(entries (reverse org-agenda-bulk-marked-entries))
@ -8059,6 +8059,11 @@ The prefix arg is passed through to the command if possible."
(org-agenda-date-later distance)
(error nil)))))))
((equal action ?f)
(setq cmd (list (intern
(org-icompleting-read "Function: "
obarray 'fboundp t nil nil)))))
(t (error "Invalid bulk action")))
;; Sort the markers, to make sure that parents are handled before children

View File

@ -102,7 +102,10 @@ ln create a hard link. Note that this is not supported
(defcustom org-attach-store-link-p nil
"Non-nil means store a link to a file when attaching it."
:group 'org-attach
:type 'boolean)
:type '(choice
(const :tag "Don't store link" nil)
(const :tag "Link to origin location" t)
(const :tag "Link to the attach-dir location" 'attached)))
;;;###autoload
(defun org-attach ()
@ -294,8 +297,10 @@ METHOD may be `cp', `mv', or `ln', default taken from `org-attach-method'."
((eq method 'ln) (add-name-to-file file fname)))
(org-attach-commit)
(org-attach-tag)
(when org-attach-store-link-p
(org-attach-store-link file))
(cond ((eq org-attach-store-link-p 'attached)
(org-attach-store-link fname))
((eq org-attach-store-link-p t)
(org-attach-store-link file)))
(if visit-dir
(dired attach-dir)
(message "File \"%s\" is now a task attachment." basename)))))

View File

@ -992,6 +992,7 @@ the clocking selection, associated with the letter `d'."
ts selected-task target-pos (msg-extra "")
(leftover (and (not org-clock-resolving-clocks)
org-clock-leftover-time)))
(when (and org-clock-auto-clock-resolution
(or (not interrupting)
(eq t org-clock-auto-clock-resolution))
@ -1000,11 +1001,17 @@ the clocking selection, associated with the letter `d'."
(setq org-clock-leftover-time nil)
(let ((org-clock-clocking-in t))
(org-resolve-clocks))) ; check if any clocks are dangling
(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 (equal select '(16))
;; Mark as default clocking task
(org-clock-mark-default-task))
(when interrupting
;; We are interrupting the clocking of a different task.
;; Save a marker to this task, so that we can go back.
@ -1019,7 +1026,8 @@ the clocking selection, associated with the letter `d'."
(= (marker-position org-clock-hd-marker)
(if selected-task
(marker-position selected-task)
(point)))))
(point)))
(equal org-clock-current-task (nth 4 (org-heading-components)))))
(message "Clock continues in \"%s\"" org-clock-heading)
(throw 'abort nil))
(move-marker org-clock-interrupted-task
@ -1028,10 +1036,6 @@ the clocking selection, associated with the letter `d'."
(let ((org-clock-clocking-in t))
(org-clock-out t)))
(when (equal select '(16))
;; Mark as default clocking task
(org-clock-mark-default-task))
;; Clock in at which position?
(setq target-pos
(if (and (eobp) (not (org-on-heading-p)))

View File

@ -1042,7 +1042,7 @@ Pressing `1' will switch between these two options."
"Alist of code references and line numbers.")
(defun org-export-preprocess-string (string &rest parameters)
"Cleanup STRING so that that the true exported has a more consistent source.
"Cleanup STRING so that the true exported has a more consistent source.
This function takes STRING, which should be a buffer-string of an org-file
to export. It then creates a temporary buffer where it does its job.
The result is then again returned as a string, and the exporter works
@ -2062,7 +2062,7 @@ can work correctly."
(let* ((rtn
(mapconcat
'identity
(org-split-string s "[^a-zA-Z0-9_\\.-]+") "--"))
(org-split-string s "[^a-zA-Z0-9_\\.-]+") "-"))
(a (assoc rtn alist)))
(or (cdr a) rtn))))
@ -3084,4 +3084,3 @@ The depends on the variable `org-export-copy-to-kill'."
;; arch-tag: 65985fe9-095c-49c7-a7b6-cb4ee15c0a95
;;; org-exp.el ends here

View File

@ -314,7 +314,7 @@ or new, let the user edit the definition of the footnote."
;; Skip existing footnotes
(while (re-search-forward "^[[:space:]]*\\[[^]]+\\] " nil t)
(forward-line))
(insert "[" label "] \n")
(insert "\n[" label "] \n")
(goto-char (1- (point)))
(message "Edit definition and go back with `C-c &' or, if unique, with `C-c C-c'.")))
@ -500,7 +500,7 @@ ENTRY is (fn-label num-mark definition)."
(when (re-search-forward (format ".\\[%s[]:]" (regexp-quote (car entry)))
nil t)
(org-footnote-goto-local-insertion-point)
(insert (format "\n\n[%s] %s" (car entry) (nth 2 entry))))))
(insert (format "\n[%s] %s\n" (car entry) (nth 2 entry))))))
(defun org-footnote-goto-local-insertion-point ()
"Find insertion point for footnote, just before next outline heading."

View File

@ -826,9 +826,9 @@ MAY-INLINE-P allows inlining it as an image."
(message "image %s %s" thefile org-par-open)
(org-export-html-format-image thefile org-par-open))
(concat
"<a href=\"" thefile "\"" (if attr (concat " " attr)) ">"
"@<a href=\"" thefile "\"" (if attr (concat " " attr)) ">"
(org-export-html-format-desc desc)
"</a>")))))
"@</a>")))))
(defun org-html-handle-links (line opt-plist)
"Return LINE with markup of Org mode links.
@ -864,7 +864,7 @@ OPT-PLIST is the export options list."
(if (string-match "^file:" desc)
(setq desc (substring desc (match-end 0)))))
(setq desc (org-add-props
(concat "<img src=\"" desc "\"/>")
(concat "@<img src=\"" desc "\"/>")
'(org-protected t))))
(cond
((equal type "internal")
@ -990,9 +990,9 @@ OPT-PLIST is the export options list."
(t
;; just publish the path, as default
(setq rpl (concat "<i>&lt;" type ":"
(setq rpl (concat "@<i>&lt;" type ":"
(save-match-data (org-link-unescape path))
"&gt;</i>"))))
"&gt;@</i>"))))
(setq line (replace-match rpl t t line)
start (+ start (length rpl))))
line))
@ -1289,7 +1289,7 @@ lang=\"%s\" xml:lang=\"%s\">
`((?t . ,title)
(?a . ,author) (?d . ,date) (?e . ,email)))))
(insert "<h1 class=\"title\">" title "</h1>")))
(if (and org-export-with-toc (not body-only))
(progn
(push (format "<h%d>%s</h%d>\n"
@ -1504,17 +1504,17 @@ lang=\"%s\" xml:lang=\"%s\">
"@</a> ")
t t line)))))
;; Format the links
(setq line (org-html-handle-links line opt-plist))
(setq line (org-html-handle-time-stamps line))
;; replace "&" by "&amp;", "<" and ">" by "&lt;" and "&gt;"
;; handle @<..> HTML tags (replace "@&gt;..&lt;" by "<..>")
;; Also handle sub_superscripts and checkboxes
(or (string-match org-table-hline-regexp line)
(setq line (org-html-expand line)))
;; Format the links
(setq line (org-html-handle-links line opt-plist))
(setq line (org-html-handle-time-stamps line))
;; TODO items
(if (and (string-match org-todo-line-regexp line)
(match-beginning 2))
@ -1705,7 +1705,8 @@ lang=\"%s\" xml:lang=\"%s\">
(when (and (plist-get opt-plist :author-info) author)
(insert "<p class=\"author\">" (nth 1 lang-words) ": " author "</p>\n"))
(when (and (plist-get opt-plist :email-info) email)
(insert "<p class=\"mailto:" email "\">&lt;" email "&gt;</p>\n"))
(insert "<p class=\"email\"><a href=\"mailto:"
email "\">&lt;" email "&gt;</a></p>\n"))
(when (plist-get opt-plist :creator-info)
(insert "<p class=\"creator\">"
(concat "Org version " org-version " with Emacs version "
@ -1715,7 +1716,7 @@ lang=\"%s\" xml:lang=\"%s\">
(if org-export-html-with-timestamp
(insert org-export-html-html-helper-timestamp))
(insert "\n</div>\n</body>\n</html>\n")
(unless body-only (insert "\n</div>\n</body>\n</html>\n"))
(unless (plist-get opt-plist :buffer-will-be-killed)
(normal-mode)
@ -1996,8 +1997,8 @@ for formatting. This is required for the DocBook exporter."
;; DocBook document, we want to always include the caption to make
;; DocBook XML file valid.
(push (format "<caption>%s</caption>" (or caption "")) html)
(when label (push (format "<a name=\"%s\" id=\"%s\"></a>" (org-solidify-link-text label) (org-solidify-link-text label))
html))
(when label
(setq html-table-tag (org-export-splice-attributes html-table-tag (format "id=\"%s\"" (org-solidify-link-text label)))))
(push html-table-tag html))
(setq html (mapcar
(lambda (x)
@ -2112,14 +2113,14 @@ But it has the disadvantage, that Org-mode's HTML conversions cannot be used."
(or b (setq b (substring s 0 (match-beginning 0))))
(setq r (concat
r (substring s 0 (match-beginning 0))
" <span class=\"timestamp-wrapper\">"
" @<span class=\"timestamp-wrapper\">"
(if (match-end 1)
(format "<span class=\"timestamp-kwd\">%s </span>"
(format "@<span class=\"timestamp-kwd\">%s @</span>"
(match-string 1 s)))
(format " <span class=\"timestamp\">%s</span>"
(format " @<span class=\"timestamp\">%s@</span>"
(substring
(org-translate-time (match-string 3 s)) 1 -1))
"</span>")
"@</span>")
s (substring s (match-end 0))))
;; Line break if line started and ended with time stamp stuff
(if (not r)
@ -2181,12 +2182,12 @@ that uses these same face definitions."
(defun org-html-protect (s)
"Convert characters to HTML equivalent.
Possible conversions are set in `org-export-html-protect-char-alist'."
(let ((start 0)
(cl org-export-html-protect-char-alist) c)
(let ((cl org-export-html-protect-char-alist) c)
(while (setq c (pop cl))
(while (string-match (car c) s start)
(setq s (replace-match (cdr c) t t s)
start (1+ (match-beginning 0)))))
(let ((start 0))
(while (string-match (car c) s start)
(setq s (replace-match (cdr c) t t s)
start (1+ (match-beginning 0))))))
s))
(defun org-html-expand (string)

View File

@ -400,6 +400,17 @@ group 4: description tag")
(goto-char (match-end 0)))
(looking-at regexp))))
(defun org-list-in-valid-block-p ()
"Non-nil if point is in a valid block.
Invalid blocks are referring to `org-list-forbidden-blocks'."
(save-match-data
(let ((case-fold-search t))
(not (org-in-regexps-block-p
(concat "^[ \t]*#\\+begin_\\("
(mapconcat 'regexp-quote org-list-forbidden-blocks "\\|")
"\\)")
'(concat "^[ \t]*#\\+end_" (match-string 1)))))))
(defun org-in-item-p ()
"Return item beginning position when in a plain list, nil otherwise.
This checks `org-list-ending-method'."
@ -476,8 +487,7 @@ This checks `org-list-ending-method'."
"Is point in a line starting a hand-formatted item?"
(save-excursion
(beginning-of-line)
(and (looking-at (org-item-re))
(not (eq (nth 2 (org-list-context)) 'invalid)))))
(and (looking-at (org-item-re)) (org-list-in-valid-block-p))))
(defun org-at-item-bullet-p ()
"Is point at the bullet of a plain list item?"
@ -1037,9 +1047,9 @@ in `re-search-forward'."
(unless (funcall search re bound noerr)
(throw 'exit (and (goto-char (if (memq noerr '(t nil)) origin bound))
nil)))
;; 2. Match in an `invalid' context: continue searching. Else,
;; return point.
(unless (eq (org-list-context) 'invalid) (throw 'exit (point)))))))
;; 2. Match in valid context: return point. Else, continue
;; searching.
(when (org-list-in-valid-block-p) (throw 'exit (point)))))))
(defun org-list-search-backward (regexp &optional bound noerror)
"Like `re-search-backward' but stop only where lists are recognized.
@ -1150,10 +1160,10 @@ This function modifies STRUCT."
;; BEFOREP and SPLIT-LINE-P. The difference of size
;; between what was cut and what was inserted in buffer
;; is stored in SIZE-OFFSET.
(ind (let ((ind-ref (org-list-get-ind item struct)))
(if (not indent-tabs-mode)
ind-ref
(+ (/ ind-ref tab-width) (mod ind-ref tab-width)))))
(ind (org-list-get-ind item struct))
(ind-size (if indent-tabs-mode
(+ (/ ind tab-width) (mod ind tab-width))
ind))
(bullet (org-list-bullet-string (org-list-get-bullet item struct)))
(box (when checkbox "[ ]"))
(text-cut
@ -1170,7 +1180,7 @@ This function modifies STRUCT."
text-cut))
"")))
(item-sep (make-string (1+ blank-nb) ?\n))
(item-size (+ ind (length body) (length item-sep)))
(item-size (+ ind-size (length body) (length item-sep)))
(size-offset (- item-size (length text-cut))))
;; 4. Insert effectively item into buffer
(goto-char item)
@ -2097,8 +2107,8 @@ in subtree, ignoring drawers."
((equal toggle-presence '(16)) "[-]")
((equal toggle-presence '(4))
(unless cbox "[ ]"))
((equal "[ ]" cbox) "[X]")
(t "[ ]"))))))
((equal "[X]" cbox) "[ ]")
(t "[X]"))))))
;; When an item is found within bounds, grab the full list at
;; point structure, then: 1. set checkbox of all its items
;; within bounds to ref-checkbox; 2. fix checkboxes of the whole

View File

@ -334,13 +334,11 @@ point nowhere."
data)))))
(defmacro org-with-wide-buffer (&rest body)
"Execute body while temporarily widening the buffer."
`(let ((beg (point-min)) (end (point-max)) (pos (point)))
(prog2
(widen)
,@body
(narrow-to-region beg end)
(goto-char pos))))
"Execute body while temporarily widening the buffer."
`(save-excursion
(save-restriction
(widen)
,@body)))
(defmacro org-with-limited-levels (&rest body)
"Execute BODY with limited number of outline levels."

View File

@ -207,21 +207,20 @@ it in the buffer."
(defun org-timer-item (&optional arg)
"Insert a description-type item with the current timer value."
(interactive "P")
(let ((itemp (org-in-item-p)))
(let ((itemp (org-in-item-p)) (pos (point)))
(cond
;; In a timer list, insert with `org-list-insert-item',
;; then fix the list.
((and itemp
(save-excursion (goto-char itemp) (org-at-item-timer-p)))
((and itemp (goto-char itemp) (org-at-item-timer-p))
(let* ((struct (org-list-struct))
(prevs (org-list-prevs-alist struct))
(s (concat (org-timer (when arg '(4)) t) ":: ")))
(setq struct (org-list-insert-item (point) struct prevs nil s))
(setq struct (org-list-insert-item pos struct prevs nil s))
(org-list-write-struct struct (org-list-parents-alist struct))
(looking-at org-list-full-item-re)
(goto-char (match-end 0))))
;; In a list of another type, don't break anything: throw an error.
(itemp (error "This is not a timer list"))
(itemp (goto-char pos) (error "This is not a timer list"))
;; Else, start a new list.
(t
(beginning-of-line)

View File

@ -10390,7 +10390,7 @@ This can be done with a 0 prefix: `C-0 C-c C-w'"
(defun org-refile-get-location (&optional prompt default-buffer new-nodes)
"Prompt the user for a refile location, using PROMPT.
PROMPT should not be suffixed with a colon and a space, because
this function appends the default value from
this function appends the default value from
`org-refile-history' automatically, if that is not empty."
(let ((org-refile-targets org-refile-targets)
(org-refile-use-outline-path org-refile-use-outline-path))
@ -13402,7 +13402,8 @@ but in some other way.")
'("ARCHIVE" "CATEGORY" "SUMMARY" "DESCRIPTION" "CUSTOM_ID"
"LOCATION" "LOGGING" "COLUMNS" "VISIBILITY"
"TABLE_EXPORT_FORMAT" "TABLE_EXPORT_FILE"
"EXPORT_FILE_NAME" "EXPORT_TITLE" "EXPORT_AUTHOR" "EXPORT_DATE"
"EXPORT_OPTIONS" "EXPORT_TEXT" "EXPORT_FILE_NAME"
"EXPORT_TITLE" "EXPORT_AUTHOR" "EXPORT_DATE"
"ORDERED" "NOBLOCKING" "COOKIE_DATA" "LOG_INTO_DRAWER" "REPEAT_TO_STATE"
"CLOCK_MODELINE_TOTAL" "STYLE" "HTML_CONTAINER_CLASS")
"Some properties that are used by Org-mode for various purposes.
@ -13853,7 +13854,8 @@ and the new value.")
With INCLUDE-SPECIALS, also list the special properties that reflect things
like tags and TODO state.
With INCLUDE-DEFAULTS, also include properties that has special meaning
internally: ARCHIVE, CATEGORY, SUMMARY, DESCRIPTION, LOCATION, and LOGGING.
internally: ARCHIVE, CATEGORY, SUMMARY, DESCRIPTION, LOCATION, and LOGGING
and others.
With INCLUDE-COLUMNS, also include property names given in COLUMN
formats in the current buffer."
(let (rtn range cfmt s p)
@ -15553,7 +15555,7 @@ customizing `org-effort-durations' (which see).
Entries containing a colon are interpreted as H:MM by
`org-hh:mm-string-to-minutes'."
(let ((result 0)
(re (concat "\\([0-9]+\\) *\\("
(re (concat "\\([0-9]+\\) *\\("
(regexp-opt (mapcar 'car org-effort-durations))
"\\)")))
(while (string-match re s)
@ -17512,8 +17514,8 @@ This command does many different things, depending on context:
(cond
((equal arg '(16)) "[-]")
((equal arg '(4)) nil)
((equal "[ ]" cbox) "[X]")
(t "[ ]")))
((equal "[X]" cbox) "[ ]")
(t "[X]")))
(org-list-struct-fix-ind struct parents)
(org-list-struct-fix-bul struct prevs)
(setq block-item
@ -18773,10 +18775,9 @@ Taken from `count' in cl-seq.el with all keyword arguments removed."
"Move backwards over whitespace, to the beginning of the first empty line.
Returns the number of empty lines passed."
(let ((pos (point)))
(skip-chars-backward " \t\n\r")
;; (if (cdr (assoc 'heading org-blank-before-new-entry))
;; (skip-chars-backward " \t\n\r")
;; (forward-line -1))
(if (cdr (assoc 'heading org-blank-before-new-entry))
(skip-chars-backward " \t\n\r")
(forward-line -1))
(beginning-of-line 2)
(goto-char (min (point) pos))
(count-lines (point) pos)))
@ -18990,6 +18991,12 @@ If point is in an inline task, mark that task instead."
;; Literal examples
((looking-at "[ \t]*:[ \t]")
(setq column (org-get-indentation))) ; do nothing
;; Lists
((ignore-errors (goto-char (org-in-item-p)))
(setq column (if itemp
(org-get-indentation)
(org-list-item-body-column (point))))
(goto-char pos))
;; Drawers
((and (looking-at "[ \t]*:END:")
(save-excursion (re-search-backward org-drawer-regexp nil t)))
@ -19011,12 +19018,6 @@ If point is in an inline task, mark that task instead."
;; src blocks: let `org-edit-src-exit' handle them
(org-get-indentation)
(org-get-indentation (match-string 0)))))
;; Lists
((ignore-errors (goto-char (org-in-item-p)))
(setq column (if itemp
(org-get-indentation)
(org-list-item-body-column (point))))
(goto-char pos))
;; This line has nothing special, look at the previous relevant
;; line to compute indentation
(t
@ -19184,13 +19185,13 @@ the functionality can be provided as a fall-back.")
;; a paragraph adjacent to a list: make sure this paragraph
;; doesn't get merged with the end of the list by narrowing
;; buffer first.
((save-excursion (fill-forward-paragraph -1)
((save-excursion (forward-paragraph -1)
(setq itemp (org-in-item-p)))
(let ((struct (save-excursion (goto-char itemp)
(org-list-struct))))
(save-restriction
(narrow-to-region (org-list-get-bottom-point struct)
(save-excursion (fill-forward-paragraph 1)
(save-excursion (forward-paragraph 1)
(point)))
(fill-paragraph justify) t)))
;; Else simply call `fill-paragraph'.
@ -19207,15 +19208,15 @@ the functionality can be provided as a fall-back.")
;; Comment line
((looking-at "#[ \t]+")
(match-string-no-properties 0))
;; Plain list item
((org-at-item-p)
(make-string (org-list-item-body-column (point-at-bol)) ?\ ))
;; Point is in a list after `backward-paragraph': original
;; point wasn't in the list, or filling would have been taken
;; care of by `org-auto-fill-function', but the list and the
;; real paragraph are not separated by a blank line. Thus, move
;; point after the list to go back to real paragraph and
;; determine fill-prefix. If point is at an item, do not
;; compute prefix and list structure, as first line of
;; paragraph will be skipped anyway.
((org-at-item-p) "")
;; determine fill-prefix.
((setq itemp (org-in-item-p))
(goto-char itemp)
(let* ((struct (org-list-struct))