1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-03 10:31:37 -08:00

2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>

* 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  <carsten.dominik@gmail.com>

	* org.el (org-open-at-point): Fix mixup about interactive and
	non-interactive elisp links.

2008-11-23  Carsten Dominik  <carsten.dominik@gmail.com>

	* 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  <kames@fa2.so-net.ne.jp>

	* org-mew.el (org-mew-store-link): Get the correct case folder
	for refiled messages.

2008-11-23  Carsten Dominik  <carsten.dominik@gmail.com>

	* 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  <carsten.dominik@gmail.com>

	* 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  <carsten.dominik@gmail.com>

	* 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  <carsten.dominik@gmail.com>

	* 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  <carsten.dominik@gmail.com>

	* 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  <carsten.dominik@gmail.com>

	* 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 "<tomorrow>" and "<yesterday>".
	(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  <carsten.dominik@gmail.com>

	* 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 &nbsp; 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  <carsten.dominik@gmail.com>

	* 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 </div> when no
	headlines are created.

2008-11-23  Carsten Dominik  <carsten.dominik@gmail.com>

	* 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  <carsten.dominik@gmail.com>

	* 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 <img> tag
	has an `alt' attribute, to ensure XHTML validation.

2008-11-23  Carsten Dominik  <carsten.dominik@gmail.com>

	* 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.
This commit is contained in:
Carsten Dominik 2008-11-23 13:39:49 +00:00
parent 770f39cf50
commit ce4fdcb95a
31 changed files with 817 additions and 423 deletions

View file

@ -1,3 +1,11 @@
2008-11-23 Carsten Dominik <dominik@science.uva.nl>
* 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 <kifer@cs.stonybrook.edu> 2008-11-22 Michael Kifer <kifer@cs.stonybrook.edu>
* viper.texi (viper-translate-all-ESC-keysequences): * viper.texi (viper-translate-all-ESC-keysequences):

View file

@ -6,7 +6,7 @@
;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Author: Carsten Dominik <carsten at orgmode dot org>
;; Keywords: outlines, hypermedia, calendar, wp ;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org ;; Homepage: http://orgmode.org
;; Version: 6.12a ;; Version: 6.13
;; ;;
;; This file is part of GNU Emacs. ;; 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 :group 'org-agenda-line-format
:type 'string) :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: ") (defcustom org-agenda-scheduled-leaders '("Scheduled: " "Sched.%2dx: ")
"Text preceeding scheduled items in the agenda view. "Text preceeding scheduled items in the agenda view.
This is a list with two strings. The first applies when the item is 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) rtn rtnall files file pos)
(when (equal arg '(4)) (when (equal arg '(4))
(setq org-select-this-todo-keyword (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))) (mapcar 'list kwds) nil nil)))
(and (equal 0 arg) (setq org-select-this-todo-keyword nil)) (and (equal 0 arg) (setq org-select-this-todo-keyword nil))
(org-set-local 'org-last-arg arg) (org-set-local 'org-last-arg arg)
@ -3384,7 +3398,7 @@ the documentation of `org-diary'."
(push txt ee)))) (push txt ee))))
(nreverse ee))) (nreverse ee)))
(defalias 'org-get-closed 'org-agenda-get-progress) (defalias 'org-get-closed 'org-get-progress)
(defun org-agenda-get-progress () (defun org-agenda-get-progress ()
"Return the logged TODO entries for agenda display." "Return the logged TODO entries for agenda display."
(let* ((props (list 'mouse-face 'highlight (let* ((props (list 'mouse-face 'highlight
@ -3398,7 +3412,7 @@ the documentation of `org-diary'."
(items (if (consp org-agenda-show-log) (items (if (consp org-agenda-show-log)
org-agenda-show-log org-agenda-show-log
org-agenda-log-mode-items)) org-agenda-log-mode-items))
(parts (parts
(delq nil (delq nil
(list (list
(if (memq 'closed items) (concat "\\<" org-closed-string)) (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) (org-entry-is-done-p)
(throw :skip t)) (throw :skip t))
(setq txt (org-format-agenda-item (setq txt (org-format-agenda-item
(format (if (= d1 d2) "" "(%d/%d): ") (format
(1+ (- d0 d1)) (1+ (- d2 d1))) (nth (if (= d1 d2) 0 1)
org-agenda-timerange-leaders)
(1+ (- d0 d1)) (1+ (- d2 d1)))
head category tags head category tags
(if (= d0 d1) timestr)))) (if (= d0 d1) timestr))))
(setq txt org-agenda-no-heading-message)) (setq txt org-agenda-no-heading-message))
@ -4255,7 +4271,7 @@ to switch to narrowing."
(org-set-local 'org-global-tags-completion-table (org-set-local 'org-global-tags-completion-table
(org-global-tags-completion-table))) (org-global-tags-completion-table)))
(let ((completion-ignore-case t)) (let ((completion-ignore-case t))
(setq tag (completing-read (setq tag (org-ido-completing-read
"Tag: " org-global-tags-completion-table)))) "Tag: " org-global-tags-completion-table))))
(cond (cond
((equal char ?/) (org-agenda-filter-by-tag-show-all)) ((equal char ?/) (org-agenda-filter-by-tag-show-all))

View file

@ -5,7 +5,7 @@
;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Author: Carsten Dominik <carsten at orgmode dot org>
;; Keywords: outlines, hypermedia, calendar, wp ;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org ;; Homepage: http://orgmode.org
;; Version: 6.12a ;; Version: 6.13
;; ;;
;; This file is part of GNU Emacs. ;; This file is part of GNU Emacs.
;; ;;

View file

@ -4,7 +4,7 @@
;; Author: John Wiegley <johnw@newartisans.com> ;; Author: John Wiegley <johnw@newartisans.com>
;; Keywords: org data task ;; Keywords: org data task
;; Version: 6.12a ;; Version: 6.13
;; This file is part of GNU Emacs. ;; 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. "Return the directory associated with the current entry.
If the directory does not exist and CREATE-IF-NOT-EXISTS-P is non-nil, If the directory does not exist and CREATE-IF-NOT-EXISTS-P is non-nil,
the directory and the corresponding ID will be created." 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))) (let ((uuid (org-id-get (point) create-if-not-exists-p)))
(when (or uuid create-if-not-exists-p) (when (or uuid create-if-not-exists-p)
(unless uuid (unless uuid
@ -245,7 +248,7 @@ The attachment is created as an Emacs buffer."
(let* ((attach-dir (org-attach-dir t)) (let* ((attach-dir (org-attach-dir t))
(files (org-attach-file-list attach-dir)) (files (org-attach-file-list attach-dir))
(file (or file (file (or file
(completing-read (org-ido-completing-read
"Delete attachment: " "Delete attachment: "
(mapcar (lambda (f) (mapcar (lambda (f)
(list (file-name-nondirectory 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)) (files (org-attach-file-list attach-dir))
(file (if (= (length files) 1) (file (if (= (length files) 1)
(car files) (car files)
(completing-read "Open attachment: " (org-ido-completing-read "Open attachment: "
(mapcar 'list files) nil t)))) (mapcar 'list files) nil t))))
(org-open-file (expand-file-name file attach-dir) in-emacs))) (org-open-file (expand-file-name file attach-dir) in-emacs)))

View file

@ -6,7 +6,7 @@
;; Thomas Baumann <thomas dot baumann at ch dot tum dot de> ;; Thomas Baumann <thomas dot baumann at ch dot tum dot de>
;; Keywords: outlines, hypermedia, calendar, wp ;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org ;; Homepage: http://orgmode.org
;; Version: 6.12a ;; Version: 6.13
;; ;;
;; This file is part of GNU Emacs. ;; This file is part of GNU Emacs.
;; ;;

View file

@ -5,7 +5,7 @@
;; Author: Bastien Guerry <bzg at altern dot org> ;; Author: Bastien Guerry <bzg at altern dot org>
;; Carsten Dominik <carsten dot dominik at gmail dot com> ;; Carsten Dominik <carsten dot dominik at gmail dot com>
;; Keywords: org, wp, remember ;; Keywords: org, wp, remember
;; Version: 6.12a ;; Version: 6.13
;; ;;
;; This file is part of GNU Emacs. ;; This file is part of GNU Emacs.
;; ;;

View file

@ -5,7 +5,7 @@
;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Author: Carsten Dominik <carsten at orgmode dot org>
;; Keywords: outlines, hypermedia, calendar, wp ;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org ;; Homepage: http://orgmode.org
;; Version: 6.12a ;; Version: 6.13
;; ;;
;; This file is part of GNU Emacs. ;; 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 (defcustom org-clock-persist nil
"When non-nil, save the running clock when emacs is closed, and "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 :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" (defcustom org-clock-persist-file "~/.emacs.d/org-clock-save.el"
"File to save clock data to" "File to save clock data to"
@ -246,7 +256,7 @@ of a different task.")
'help-echo (concat help-text ": " org-clock-heading)) 'help-echo (concat help-text ": " org-clock-heading))
(org-propertize clock-string 'help-echo help-text))) (org-propertize clock-string 'help-echo help-text)))
'local-map org-clock-mode-map '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))) (force-mode-line-update)))
(defvar org-clock-mode-line-entry nil (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 is as the default task, a special task that will always be offered in
the clocking selection, associated with the letter `d'." the clocking selection, associated with the letter `d'."
(interactive "P") (interactive "P")
(let ((interrupting (marker-buffer org-clock-marker)) (catch 'abort
ts selected-task target-pos) (let ((interrupting (marker-buffer org-clock-marker))
(when (equal select '(4)) ts selected-task target-pos)
(setq selected-task (org-clock-select-task "Clock-in on task: ")) (when (equal select '(4))
(if selected-task (setq selected-task (org-clock-select-task "Clock-in on task: "))
(setq selected-task (copy-marker selected-task)) (if selected-task
(error "Abort"))) (setq selected-task (copy-marker selected-task))
(when interrupting (error "Abort")))
;; We are interrupting the clocking of a differnt task. (when interrupting
;; Save a marker to this task, so that we can go back. ;; We are interrupting the clocking of a differnt task.
(move-marker org-clock-interrupted-task ;; Save a marker to this task, so that we can go back.
(marker-position org-clock-marker) (move-marker org-clock-interrupted-task
(marker-buffer org-clock-marker)) (marker-position org-clock-marker)
(org-clock-out t)) (marker-buffer org-clock-marker))
(org-clock-out t))
(when (equal select '(16))
;; Mark as default clocking task (when (equal select '(16))
(save-excursion ;; Mark as default clocking task
(org-back-to-heading t) (save-excursion
(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) (org-back-to-heading t)
(or interrupting (move-marker org-clock-interrupted-task nil)) (move-marker org-clock-default-task (point))))
(org-clock-history-push)
(cond ((functionp org-clock-in-switch-to-state) (setq target-pos (point)) ;; we want to clock in at this location
(looking-at org-complex-heading-regexp) (save-excursion
(let ((newstate (funcall org-clock-in-switch-to-state (match-string 2)))) (when (and selected-task (marker-buffer selected-task))
(if newstate (org-todo newstate)))) ;; There is a selected task, move to the correct buffer
((and org-clock-in-switch-to-state ;; and set the new target position.
(not (looking-at (concat outline-regexp "[ \t]*" (set-buffer (org-base-buffer (marker-buffer selected-task)))
org-clock-in-switch-to-state (setq target-pos (marker-position selected-task))
"\\>")))) (move-marker selected-task nil))
(org-todo org-clock-in-switch-to-state))) (save-excursion
(setq org-clock-heading-for-remember (save-restriction
(and (looking-at org-complex-heading-regexp) (widen)
(match-end 4) (goto-char target-pos)
(org-trim (buffer-substring (match-end 1) (match-end 4))))) (org-back-to-heading t)
(setq org-clock-heading (or interrupting (move-marker org-clock-interrupted-task nil))
(cond ((and org-clock-heading-function (org-clock-history-push)
(functionp org-clock-heading-function)) (cond ((functionp org-clock-in-switch-to-state)
(funcall org-clock-heading-function)) (looking-at org-complex-heading-regexp)
((looking-at org-complex-heading-regexp) (let ((newstate (funcall org-clock-in-switch-to-state
(match-string 4)) (match-string 2))))
(t "???"))) (if newstate (org-todo newstate))))
(setq org-clock-heading (org-propertize org-clock-heading 'face nil)) ((and org-clock-in-switch-to-state
(org-clock-find-position) (not (looking-at (concat outline-regexp "[ \t]*"
(if (and org-clock-in-resume org-clock-in-switch-to-state
(looking-at (concat "^[ \\t]* " org-clock-string "\\>"))))
" \\[\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}" (org-todo org-clock-in-switch-to-state)))
" +\\sw+ +[012][0-9]:[0-5][0-9]\\)\\]$"))) (setq org-clock-heading-for-remember
(progn (message "Matched %s" (match-string 1)) (and (looking-at org-complex-heading-regexp)
(setq ts (concat "[" (match-string 1) "]")) (match-end 4)
(goto-char (match-end 1)) (org-trim (buffer-substring (match-end 1)
(setq org-clock-start-time (match-end 4)))))
(apply 'encode-time (org-parse-time-string (match-string 1))))) (setq org-clock-heading
(progn (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) (insert "\n") (backward-char 1)
(org-indent-line-function) (org-indent-line-function)
(insert org-clock-string " ") (insert org-clock-string " ")
(setq org-clock-start-time (current-time)) (setq org-clock-start-time (current-time))
(setq ts (org-insert-time-stamp org-clock-start-time 'with-hm 'inactive)))) (setq ts (org-insert-time-stamp org-clock-start-time 'with-hm 'inactive))))
(move-marker org-clock-marker (point) (buffer-base-buffer)) (move-marker org-clock-marker (point) (buffer-base-buffer))
(or global-mode-string (setq global-mode-string '(""))) (or global-mode-string (setq global-mode-string '("")))
(or (memq 'org-mode-line-string global-mode-string) (or (memq 'org-mode-line-string global-mode-string)
(setq global-mode-string (setq global-mode-string
(append global-mode-string '(org-mode-line-string)))) (append global-mode-string '(org-mode-line-string))))
(org-update-mode-line) (org-update-mode-line)
(setq org-mode-line-timer (setq org-mode-line-timer
(run-with-timer 60 60 'org-update-mode-line)) (run-with-timer 60 60 'org-update-mode-line))
(message "Clock started at %s" ts)))))) (message "Clock started at %s" ts)))))))
(defun org-clock-find-position () (defun org-clock-find-position ()
"Find the location where the next clock line should be inserted." "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)) (block (plist-get params :block))
(link (plist-get params :link)) (link (plist-get params :link))
ipos time p level hlc hdl content recalc formula pcol 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) (setq org-clock-file-total-minutes nil)
(when step (when step
(unless (or block (and ts te)) (unless (or block (and ts te))
@ -902,7 +926,11 @@ the currently selected interval size."
(unless scope-is-list (unless scope-is-list
(org-clock-sum ts te) (org-clock-sum ts te)
(goto-char (point-min)) (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) (goto-char p)
(when (setq time (get-text-property p :org-clock-minutes)) (when (setq time (get-text-property p :org-clock-minutes))
(save-excursion (save-excursion
@ -1062,71 +1090,92 @@ This function is made for clock tables."
0)))) 0))))
(defun org-clock-save () (defun org-clock-save ()
"Persist various clock-related data to disk" "Persist various clock-related data to disk.
(with-current-buffer (find-file (expand-file-name org-clock-persist-file)) The details of what will be saved are regulated by the variable
(progn (delete-region (point-min) (point-max)) `org-clock-persist'."
;;Store clock (when org-clock-persist
(insert (format ";; org-persist.el - %s at %s\n" (let (b)
system-name (format-time-string (with-current-buffer (find-file (expand-file-name org-clock-persist-file))
(cdr org-time-stamp-formats)))) (progn
(if (and org-clock-persist (marker-buffer org-clock-marker) (delete-region (point-min) (point-max))
(or (not org-clock-persist-query-save) ;;Store clock
(y-or-n-p (concat "Save current clock (" (insert (format ";; org-persist.el - %s at %s\n"
(substring-no-properties org-clock-heading) system-name (format-time-string
")")))) (cdr org-time-stamp-formats))))
(insert "(setq resume-clock '(\"" (if (and (setq b (marker-buffer org-clock-marker))
(buffer-file-name (marker-buffer org-clock-marker)) (setq b (or (buffer-base-buffer b) b))
"\" . " (int-to-string (marker-position org-clock-marker)) (buffer-live-p b)
"))\n")) (buffer-file-name b)
;;Store clocked task history. Tasks are stored reversed to make (or (not org-clock-persist-query-save)
;;reading simpler (y-or-n-p (concat "Save current clock ("
(if org-clock-history (substring-no-properties org-clock-heading)
(insert "(setq stored-clock-history '(" ") "))))
(mapconcat (insert "(setq resume-clock '(\""
(lambda (m) (buffer-file-name (marker-buffer org-clock-marker))
(when (marker-buffer m) "\" . " (int-to-string (marker-position org-clock-marker))
(concat "(\"" (buffer-file-name (marker-buffer m)) "))\n"))
"\" . " (int-to-string (marker-position m)) ;; Store clocked task history. Tasks are stored reversed to make
")"))) ;; reading simpler
(reverse org-clock-history) " ") "))\n")) (when (and org-clock-history (eq org-clock-persist t))
(save-buffer) (insert
(kill-buffer (current-buffer))))) "(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) (defvar org-clock-loaded nil
"Was the clock file loaded?")
(defun org-clock-load () (defun org-clock-load ()
"Load various clock-related data from disk, optionally resuming "Load various clock-related data from disk, optionally resuming
a stored clock" a stored clock"
(if (not org-clock-loaded) (when (and org-clock-persist (not org-clock-loaded))
(let ((filename (expand-file-name org-clock-persist-file)) (let ((filename (expand-file-name org-clock-persist-file))
(org-clock-in-resume t)) (org-clock-in-resume 'auto-restart)
(if (file-readable-p filename) resume-clock stored-clock-history)
(progn (if (not (file-readable-p filename))
(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)))))
(message "Not restoring clock data; %s not found" (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 ;;;###autoload
(defun org-clock-persistence-insinuate () (defun org-clock-persistence-insinuate ()

View file

@ -5,7 +5,7 @@
;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Author: Carsten Dominik <carsten at orgmode dot org>
;; Keywords: outlines, hypermedia, calendar, wp ;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org ;; Homepage: http://orgmode.org
;; Version: 6.12a ;; Version: 6.13
;; ;;
;; This file is part of GNU Emacs. ;; This file is part of GNU Emacs.
;; ;;
@ -130,7 +130,7 @@ This is the compiled version of the format.")
(push ov org-columns-overlays) (push ov org-columns-overlays)
ov)) ov))
(defun org-columns-display-here (&optional props) (defun org-columns-display-here (&optional props dateline)
"Overlay the current line with column display." "Overlay the current line with column display."
(interactive) (interactive)
(let* ((fmt org-columns-current-fmt-compiled) (let* ((fmt org-columns-current-fmt-compiled)
@ -145,6 +145,7 @@ This is the compiled version of the format.")
'default)) 'default))
(color (list :foreground (face-attribute ref-face :foreground))) (color (list :foreground (face-attribute ref-face :foreground)))
(face (list color 'org-column ref-face)) (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)) (pl (or (get-text-property (point-at-bol) 'prefix-length) 0))
(cphr (get-text-property (point-at-bol) 'org-complex-heading-regexp)) (cphr (get-text-property (point-at-bol) 'org-complex-heading-regexp))
pom property ass width f string ov column val modval s1 s2 title) 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 ;; Create the overlay
(org-unmodified (org-unmodified
(setq ov (org-columns-new-overlay (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 'keymap org-columns-map)
(org-overlay-put ov 'org-columns-key property) (org-overlay-put ov 'org-columns-key property)
(org-overlay-put ov 'org-columns-value (cdr ass)) (org-overlay-put ov 'org-columns-value (cdr ass))
@ -425,7 +426,7 @@ Where possible, use the standard interface for changing this line."
(t (t
(setq allowed (org-property-get-allowed-values pom key 'table)) (setq allowed (org-property-get-allowed-values pom key 'table))
(if allowed (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 (read-string "Edit: " value)))
(setq nval (org-trim nval)) (setq nval (org-trim nval))
(when (not (equal nval value)) (when (not (equal nval value))
@ -675,7 +676,7 @@ around it."
(interactive) (interactive)
(let ((editp (and prop (assoc prop org-columns-current-fmt-compiled))) (let ((editp (and prop (assoc prop org-columns-current-fmt-compiled)))
cell) cell)
(setq prop (completing-read (setq prop (org-ido-completing-read
"Property: " (mapcar 'list (org-buffer-property-keys t nil t)) "Property: " (mapcar 'list (org-buffer-property-keys t nil t))
nil nil prop)) nil nil prop))
(setq title (read-string (concat "Column title [" prop "]: ") (or title prop))) (setq title (read-string (concat "Column title [" prop "]: ") (or title prop)))
@ -683,7 +684,7 @@ around it."
(if (string-match "\\S-" width) (if (string-match "\\S-" width)
(setq width (string-to-number width)) (setq width (string-to-number width))
(setq width nil)) (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")) '(("none") ("add_numbers") ("currency") ("add_times") ("checkbox") ("checkbox-n-of-m") ("checkbox-percent"))
nil t)) nil t))
(if (string-match "\\S-" fmt) (if (string-match "\\S-" fmt)
@ -1151,7 +1152,7 @@ and tailing newline characters."
"Create a dynamic block capturing a column view table." "Create a dynamic block capturing a column view table."
(interactive) (interactive)
(let ((defaults '(:name "columnview" :hlines 1)) (let ((defaults '(:name "columnview" :hlines 1))
(id (completing-read (id (org-ido-completing-read
"Capture columns (local, global, entry with :ID: property) [local]: " "Capture columns (local, global, entry with :ID: property) [local]: "
(append '(("global") ("local")) (append '(("global") ("local"))
(mapcar 'list (org-property-values "ID")))))) (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) 0 (length lsum) 'face 'bold lsum)
(cons prop lsum)))) (cons prop lsum))))
fmt)) fmt))
(org-columns-display-here props) (org-columns-display-here props 'dateline)
(org-set-local 'org-agenda-columns-active t))) (org-set-local 'org-agenda-columns-active t)))
(if (bobp) (throw 'exit t)) (if (bobp) (throw 'exit t))
(beginning-of-line 0)))))) (beginning-of-line 0))))))

View file

@ -5,7 +5,7 @@
;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Author: Carsten Dominik <carsten at orgmode dot org>
;; Keywords: outlines, hypermedia, calendar, wp ;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org ;; Homepage: http://orgmode.org
;; Version: 6.12a ;; Version: 6.13
;; ;;
;; This file is part of GNU Emacs. ;; This file is part of GNU Emacs.
;; ;;
@ -277,9 +277,16 @@ that can be added."
(defun org-propertize (string &rest properties) (defun org-propertize (string &rest properties)
(if (featurep 'xemacs) (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))) (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) (provide 'org-compat)
;; arch-tag: a0a0579f-e68c-4bdf-9e55-93768b846bbe ;; arch-tag: a0a0579f-e68c-4bdf-9e55-93768b846bbe

View file

@ -5,7 +5,7 @@
;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Author: Carsten Dominik <carsten at orgmode dot org>
;; Keywords: outlines, hypermedia, calendar, wp ;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org ;; Homepage: http://orgmode.org
;; Version: 6.12a ;; Version: 6.13
;; ;;
;; This file is part of GNU Emacs. ;; 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 ;;; 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) (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 that the true exported has a more consistent source.
This function takes STRING, which should be a buffer-string of an org-file 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 "\\*+ ") (outline-regexp "\\*+ ")
target-alist rtn) target-alist rtn)
(setq org-export-target-aliases nil)
(with-current-buffer (get-buffer-create " org-mode-tmp") (with-current-buffer (get-buffer-create " org-mode-tmp")
(erase-buffer) (erase-buffer)
(insert string) (insert string)
@ -1464,7 +1469,7 @@ on this string to produce the exported version."
;; Get the correct stuff before the first headline ;; Get the correct stuff before the first headline
(when (plist-get parameters :skip-before-1st-heading) (when (plist-get parameters :skip-before-1st-heading)
(goto-char (point-min)) (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)) (delete-region (point-min) (match-beginning 0))
(goto-char (point-min)) (goto-char (point-min))
(insert "\n"))) (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) (defun org-export-handle-invisible-targets (target-alist)
"Find targets in comments and move them out of comments. "Find targets in comments and move them out of comments.
Mark them as invisible targets." Mark them as invisible targets."
(let (target tmp) (let (target tmp a)
(goto-char (point-min)) (goto-char (point-min))
(while (re-search-forward "^#.*?\\(<<<?\\([^>\r\n]+\\)>>>?\\).*" nil t) (while (re-search-forward "^#.*?\\(<<<?\\([^>\r\n]+\\)>>>?\\).*" nil t)
;; Check if the line before or after is a headline with a target ;; 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)) (setq tmp (match-string 2))
(replace-match "") (replace-match "")
(and (looking-at "\n") (delete-char 1)) (and (looking-at "\n") (delete-char 1))
(push (cons (org-solidify-link-text tmp) target) (push (cons (setq tmp (org-solidify-link-text tmp)) target)
target-alist)) 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 ;; Make an invisible target
(replace-match "\\1(INVISIBLE)")))) (replace-match "\\1(INVISIBLE)"))))
target-alist) target-alist)
@ -1622,8 +1632,8 @@ let the link point to the corresponding section."
(or (get-text-property (point) 'target) (or (get-text-property (point) 'target)
(get-text-property (get-text-property
(max (point-min) (max (point-min)
(1- (previous-single-property-change (1- (or (previous-single-property-change
(point) 'target))) (point) 'target) 0)))
'target)))))))) 'target))))))))
(when target (when target
(set-match-data md) (set-match-data md)
@ -1885,7 +1895,8 @@ When it is nil, all comments will be removed."
(goto-char (1- (match-end 0))) (goto-char (1- (match-end 0)))
(org-if-unprotected (org-if-unprotected
(let* ((xx (save-match-data (let* ((xx (save-match-data
(org-link-expand-abbrev (match-string 1)))) (org-translate-link
(org-link-expand-abbrev (match-string 1)))))
(s (concat (s (concat
"[[" xx "]" "[[" xx "]"
(if (match-end 3) (if (match-end 3)
@ -2149,7 +2160,7 @@ backends, it converts the segment into an EXAMPLE segment."
(cond (cond
(htmlp (htmlp
;; We are exporting to HTML ;; We are exporting to HTML
(condition-case nil (require 'htmlize) (nil t)) (require 'htmlize nil t)
(if (not (fboundp 'htmlize-region-for-paste)) (if (not (fboundp 'htmlize-region-for-paste))
(progn (progn
;; we do not have htmlize.el, or an old version of it ;; we do not have htmlize.el, or an old version of it
@ -2423,6 +2434,9 @@ underlined headlines. The default is 3."
"\n") "\n"))) "\n") "\n")))
(t (t
(setq line (org-fix-indentation line org-ascii-current-indentation)) (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 (if (and org-export-with-fixed-width
(string-match "^\\([ \t]*\\)\\(:\\)" line)) (string-match "^\\([ \t]*\\)\\(:\\)" line))
(setq line (replace-match "\\1" nil nil line))) (setq line (replace-match "\\1" nil nil line)))
@ -3183,9 +3197,10 @@ lang=\"%s\" xml:lang=\"%s\">
(cond (cond
((match-end 2) ((match-end 2)
(setq line (replace-match (setq line (replace-match
(concat "@<a name=\"" (format
(org-solidify-link-text (match-string 1 line)) "@<a name=\"%s\" id=\"%s\">@</a>"
"\">\\nbsp@</a>") (org-solidify-link-text (match-string 1 line))
(org-solidify-link-text (match-string 1 line)))
t t line))) t t line)))
((and org-export-with-toc (equal (string-to-char line) ?*)) ((and org-export-with-toc (equal (string-to-char line) ?*))
;; FIXME: NOT DEPENDENT on TOC????????????????????? ;; FIXME: NOT DEPENDENT on TOC?????????????????????
@ -3233,7 +3248,9 @@ lang=\"%s\" xml:lang=\"%s\">
(save-match-data (save-match-data
(if (string-match "^file:" desc) (if (string-match "^file:" desc)
(setq desc (substring desc (match-end 0))))) (setq desc (substring desc (match-end 0)))))
(setq desc (concat "<img src=\"" desc "\"/>"))) (setq desc (org-add-props
(concat "<img src=\"" desc "\"/>")
'(org-protected t))))
;; FIXME: do we need to unescape here somewhere? ;; FIXME: do we need to unescape here somewhere?
(cond (cond
((equal type "internal") ((equal type "internal")
@ -3250,7 +3267,10 @@ lang=\"%s\" xml:lang=\"%s\">
(if (and (or (eq t org-export-html-inline-images) (if (and (or (eq t org-export-html-inline-images)
(and org-export-html-inline-images (not descp))) (and org-export-html-inline-images (not descp)))
(org-file-image-p path)) (org-file-image-p path))
(setq rpl (concat "<img src=\"" type ":" path "\"" attr "/>")) (setq rpl (concat "<img src=\"" type ":" path "\""
(if (string-match "\\<alt=" attr)
attr (concat attr " alt=\"" path "\""))
"/>"))
(setq link (concat type ":" path)) (setq link (concat type ":" path))
(setq rpl (concat "<a href=\"" (setq rpl (concat "<a href=\""
(org-export-html-format-href link) (org-export-html-format-href link)
@ -3308,7 +3328,11 @@ lang=\"%s\" xml:lang=\"%s\">
(or (eq t org-export-html-inline-images) (or (eq t org-export-html-inline-images)
(and org-export-html-inline-images (and org-export-html-inline-images
(not descp)))) (not descp))))
(concat "<img src=\"" thefile "\"" attr "/>") (concat "<img src=\"" thefile "\""
(if (string-match "alt=" attr)
attr
(concat attr " alt=\""
thefile "\"")) "/>")
(concat "<a href=\"" thefile "\"" attr ">" (concat "<a href=\"" thefile "\"" attr ">"
(org-export-html-format-desc desc) (org-export-html-format-desc desc)
"</a>"))) "</a>")))
@ -3503,7 +3527,7 @@ lang=\"%s\" xml:lang=\"%s\">
(and org-export-with-toc (<= level umax)) (and org-export-with-toc (<= level umax))
head-count) head-count)
;; the </div> to close the last text-... div. ;; the </div> to close the last text-... div.
(insert "</div>\n") (when (and (> umax 0) first-heading-pos) (insert "</div>\n"))
(save-excursion (save-excursion
(goto-char (point-min)) (goto-char (point-min))
@ -3604,7 +3628,7 @@ lang=\"%s\" xml:lang=\"%s\">
(defun org-export-html-format-desc (s) (defun org-export-html-format-desc (s)
"Make sure the S is valid as a description in a link." "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 (save-match-data
(org-html-do-expand s)) (org-html-do-expand s))
s)) s))
@ -4143,9 +4167,15 @@ stacked delimiters is N. Escaping delimiters is not possible."
"Insert a new level in HTML export. "Insert a new level in HTML export.
When TITLE is nil, just close all open levels." When TITLE is nil, just close all open levels."
(org-close-par-maybe) (org-close-par-maybe)
(let ((target (and title (org-get-text-property-any 0 'target title))) (let* ((target (and title (org-get-text-property-any 0 'target title)))
(l org-level-max) (extra-targets
snumber) (mapconcat (lambda (x)
(format "<a name=\"%s\" id=\"%s\"></a>"
x x))
(cdr (assoc target org-export-target-aliases))
""))
(l org-level-max)
snumber)
(while (>= l level) (while (>= l level)
(if (aref org-levels-open (1- l)) (if (aref org-levels-open (1- l))
(progn (progn
@ -4173,13 +4203,13 @@ When TITLE is nil, just close all open levels."
(progn (progn
(org-close-li) (org-close-li)
(if target (if target
(insert (format "<li id=\"%s\">" target) title "<br/>\n") (insert (format "<li id=\"%s\">" target) extra-targets title "<br/>\n")
(insert "<li>" title "<br/>\n"))) (insert "<li>" title "<br/>\n")))
(aset org-levels-open (1- level) t) (aset org-levels-open (1- level) t)
(org-close-par-maybe) (org-close-par-maybe)
(if target (if target
(insert (format "<ul>\n<li id=\"%s\">" target) (insert (format "<ul>\n<li id=\"%s\">" target)
title "<br/>\n") extra-targets title "<br/>\n")
(insert "<ul>\n<li>" title "<br/>\n")))) (insert "<ul>\n<li>" title "<br/>\n"))))
(aset org-levels-open (1- level) t) (aset org-levels-open (1- level) t)
(setq snumber (org-section-number level)) (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 title (concat snumber " " title)))
(setq level (+ level org-export-html-toplevel-hlevel -1)) (setq level (+ level org-export-html-toplevel-hlevel -1))
(unless (= head-count 1) (insert "\n</div>\n")) (unless (= head-count 1) (insert "\n</div>\n"))
(insert (format "\n<div id=\"outline-container-%s\" class=\"outline-%d\">\n<h%d id=\"sec-%s\">%s</h%d>\n<div id=\"text-%s\">\n" (insert (format "\n<div id=\"outline-container-%s\" class=\"outline-%d\">\n<h%d id=\"sec-%s\">%s%s</h%d>\n<div id=\"text-%s\">\n"
snumber level level snumber title level snumber)) snumber level level snumber extra-targets title level snumber))
(org-open-par))))) (org-open-par)))))
(defun org-get-text-property-any (pos prop &optional object) (defun org-get-text-property-any (pos prop &optional object)
@ -4523,10 +4553,10 @@ characters."
(while (string-match "\\([,;]\\)" s start) (while (string-match "\\([,;]\\)" s start)
(setq start (+ (match-beginning 0) 2) (setq start (+ (match-beginning 0) 2)
s (replace-match "\\\\\\1" nil nil s)))) s (replace-match "\\\\\\1" nil nil s))))
(setq s (org-trim s))
(when is-body (when is-body
(while (string-match "[ \t]*\n[ \t]*" s) (while (string-match "[ \t]*\n[ \t]*" s)
(setq s (replace-match "\\n" t t s)))) (setq s (replace-match "\\n" t t s))))
(setq s (org-trim s))
(if is-body (if is-body
(if maxlength (if maxlength
(if (and (numberp maxlength) (if (and (numberp maxlength)
@ -4534,6 +4564,32 @@ characters."
(setq s (substring s 0 maxlength))))) (setq s (substring s 0 maxlength)))))
s)) 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 () (defun org-get-entry ()
"Clean-up description string." "Clean-up description string."
(save-excursion (save-excursion

View file

@ -4,7 +4,7 @@
;; ;;
;; Emacs Lisp Archive Entry ;; Emacs Lisp Archive Entry
;; Filename: org-export-latex.el ;; Filename: org-export-latex.el
;; Version: 6.12a ;; Version: 6.13
;; Author: Bastien Guerry <bzg AT altern DOT org> ;; Author: Bastien Guerry <bzg AT altern DOT org>
;; Maintainer: Bastien Guerry <bzg AT altern DOT org> ;; Maintainer: Bastien Guerry <bzg AT altern DOT org>
;; Keywords: org, wp, tex ;; Keywords: org, wp, tex
@ -613,7 +613,9 @@ If NUM, export sections as numerical sections."
(occur (number-to-string (cdr (assoc 'occur subcontent)))) (occur (number-to-string (cdr (assoc 'occur subcontent))))
(content (cdr (assoc 'content subcontent))) (content (cdr (assoc 'content subcontent)))
(subcontent (cadr (assoc 'subcontent 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 (cond
;; Normal conversion ;; Normal conversion
((<= level org-export-latex-sectioning-depth) ((<= level org-export-latex-sectioning-depth)
@ -624,7 +626,9 @@ If NUM, export sections as numerical sections."
end (nth (if num 1 3) sec)) end (nth (if num 1 3) sec))
(setq start (if num (car sec) (cdr sec)))) (setq start (if num (car sec) (cdr sec))))
(insert (format start heading) "\n") (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)) (insert (org-export-latex-content content))
(cond ((stringp subcontent) (insert subcontent)) (cond ((stringp subcontent) (insert subcontent))
((listp subcontent) (org-export-latex-sub subcontent))) ((listp subcontent) (org-export-latex-sub subcontent)))

View file

@ -5,7 +5,7 @@
;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Author: Carsten Dominik <carsten at orgmode dot org>
;; Keywords: outlines, hypermedia, calendar, wp ;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org ;; Homepage: http://orgmode.org
;; Version: 6.12a ;; Version: 6.13
;; ;;
;; This file is part of GNU Emacs. ;; 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) :height (face-attribute 'default :height)
:family (face-attribute 'default :family))) :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 (defface org-warning
(org-compatible-face 'font-lock-warning-face (org-compatible-face 'font-lock-warning-face
'((((class color) (min-colors 16) (background light)) (:foreground "Red1" :bold t)) '((((class color) (min-colors 16) (background light)) (:foreground "Red1" :bold t))

View file

@ -3,9 +3,10 @@
;; Copyright (C) 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. ;; Copyright (C) 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Author: Carsten Dominik <carsten at orgmode dot org>
;; Tassilo Horn <tassilo at member dot fsf dot org>
;; Keywords: outlines, hypermedia, calendar, wp ;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org ;; Homepage: http://orgmode.org
;; Version: 6.12a ;; Version: 6.13
;; ;;
;; This file is part of GNU Emacs. ;; This file is part of GNU Emacs.
;; ;;
@ -37,7 +38,11 @@
;; Customization variables ;; 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. "Non-nil means, `org-store-link' will create web links to Google groups.
When nil, Gnus will be used for such links. When nil, Gnus will be used for such links.
Using a prefix arg to the command \\[org-store-link] (`org-store-link') 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) (add-hook 'org-store-link-functions 'org-gnus-store-link)
;; Implementation ;; 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 () (defun org-gnus-store-link ()
"Store a link to a Gnus folder or message." "Store a link to a Gnus folder or message."
(cond (cond
((eq major-mode 'gnus-group-mode) ((eq major-mode 'gnus-group-mode)
(let ((group (cond ((fboundp 'gnus-group-group-name) ; depending on Gnus (let* ((group (cond ((fboundp 'gnus-group-group-name) ; depending on Gnus
(gnus-group-group-name)) ; version (gnus-group-group-name)) ; version
((fboundp 'gnus-group-name) ((fboundp 'gnus-group-name)
(gnus-group-name)) (gnus-group-name))
(t "???"))) (t "???")))
desc link) desc link)
(unless group (error "Not on a group")) (unless group (error "Not on a group"))
(org-store-link-props :type "gnus" :group group) (org-store-link-props :type "gnus" :group group)
(setq desc (concat (setq desc (org-gnus-group-link group)
(if (org-xor current-prefix-arg
org-usenet-links-prefer-google)
"http://groups.google.com/groups?group="
"gnus:")
group)
link (org-make-link desc)) link (org-make-link desc))
(org-add-link-props :link link :description desc) (org-add-link-props :link link :description desc)
link)) link))
((memq major-mode '(gnus-summary-mode gnus-article-mode)) ((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) (let* ((group gnus-newsgroup-name)
(article (gnus-summary-article-number)) (header (with-current-buffer gnus-article-buffer
(header (gnus-summary-article-header article)) (gnus-summary-toggle-header 1)
(from (mail-header-from header)) (goto-char (point-min))
(message-id (mail-header-id header)) (mail-header-extract-no-properties)))
(date (mail-header-date header)) (from (mail-header 'from header))
(extra (mail-header-extra header)) (message-id (mail-header 'message-id header))
(to (cdr (assoc 'To extra))) (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)) (subject (gnus-summary-subject-string))
desc link) desc link)
(org-store-link-props :type "gnus" :from from :subject subject (org-store-link-props :type "gnus" :from from :subject subject
:message-id message-id :group group :to to) :message-id message-id :group group :to to)
(setq desc (org-email-link-description)) (setq desc (org-email-link-description)
(if (org-xor current-prefix-arg org-usenet-links-prefer-google) link (org-gnus-article-link group newsgroups message-id x-no-archive))
(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)))))
(org-add-link-props :link link :description desc) (org-add-link-props :link link :description desc)
link)))) link))))

View file

@ -4,7 +4,7 @@
;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Author: Carsten Dominik <carsten at orgmode dot org>
;; Keywords: outlines, hypermedia, calendar, wp ;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org ;; Homepage: http://orgmode.org
;; Version: 6.12a ;; Version: 6.13
;; ;;
;; This file is part of GNU Emacs. ;; 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) (defun org-id-add-location (id file)
"Add the ID with location FILE to the database of ID loations." "Add the ID with location FILE to the database of ID loations."
(unless org-id-locations (org-id-locations-load)) (when (and id file) ; don't error when called from a buffer with no file
(catch 'exit (unless org-id-locations (org-id-locations-load))
(let ((locs org-id-locations) list) (catch 'exit
(while (setq list (pop locs)) (let ((locs org-id-locations) list)
(when (equal (file-truename file) (file-truename (car list))) (while (setq list (pop locs))
(setcdr list (cons id (cdr list))) (when (equal (file-truename file) (file-truename (car list)))
(throw 'exit t)))) (setcdr list (cons id (cdr list)))
(push (list file id) org-id-locations)) (throw 'exit t))))
(org-id-locations-save)) (push (list file id) org-id-locations))
(org-id-locations-save)))
;; Finding entries with specified id ;; Finding entries with specified id

View file

@ -5,7 +5,7 @@
;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Author: Carsten Dominik <carsten at orgmode dot org>
;; Keywords: outlines, hypermedia, calendar, wp ;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org ;; Homepage: http://orgmode.org
;; Version: 6.12a ;; Version: 6.13
;; ;;
;; This file is part of GNU Emacs. ;; This file is part of GNU Emacs.
;; ;;

View file

@ -4,7 +4,7 @@
;; ;;
;; Author: Philip Jackson <emacs@shellarchive.co.uk> ;; Author: Philip Jackson <emacs@shellarchive.co.uk>
;; Keywords: erc, irc, link, org ;; Keywords: erc, irc, link, org
;; Version: 6.12a ;; Version: 6.13
;; ;;
;; This file is part of GNU Emacs. ;; 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, ;; Org-mode loads this module by default - if this is not what you want,
;; configure the variable `org-modules'. ;; 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 ;; extensions you would like to use, and to deselect those which you don't
;; want. ;; want.
;; ;;

View file

@ -5,7 +5,7 @@
;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Author: Carsten Dominik <carsten at orgmode dot org>
;; Keywords: outlines, hypermedia, calendar, wp ;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org ;; Homepage: http://orgmode.org
;; Version: 6.12a ;; Version: 6.13
;; ;;
;; This file is part of GNU Emacs. ;; This file is part of GNU Emacs.
;; ;;

View file

@ -6,7 +6,7 @@
;; Bastien Guerry <bzg AT altern DOT org> ;; Bastien Guerry <bzg AT altern DOT org>
;; Keywords: outlines, hypermedia, calendar, wp ;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org ;; Homepage: http://orgmode.org
;; Version: 6.12a ;; Version: 6.13
;; ;;
;; This file is part of GNU Emacs. ;; This file is part of GNU Emacs.
;; ;;
@ -72,6 +72,18 @@ the safe choice."
(const :tag "paren like in \"2)\"" ?\)) (const :tag "paren like in \"2)\"" ?\))
(const :tab "both" t))) (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 (defcustom org-empty-line-terminates-plain-lists nil
"Non-nil means, an empty line ends all plain list levels. "Non-nil means, an empty line ends all plain list levels.
When nil, empty lines are part of the preceeding item." When nil, empty lines are part of the preceeding item."
@ -259,7 +271,7 @@ the whole buffer."
(save-excursion (save-excursion
(let* ((buffer-invisibility-spec (org-inhibit-invisibility)) ; Emacs 21 (let* ((buffer-invisibility-spec (org-inhibit-invisibility)) ; Emacs 21
(beg (condition-case nil (beg (condition-case nil
(progn (outline-back-to-heading) (point)) (progn (org-back-to-heading) (point))
(error (point-min)))) (error (point-min))))
(end (move-marker (make-marker) (end (move-marker (make-marker)
(progn (outline-next-heading) (point)))) (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) (beginning-of-line 1)
(let ((current (match-string 0)) (let ((current (match-string 0))
(prevp (eq which 'previous)) (prevp (eq which 'previous))
new) new old)
(setq new (cond (setq new (cond
((and (numberp which) ((and (numberp which)
(nth (1- which) '("-" "+" "*" "1." "1)")))) (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) ((string-match "\\+" current)
(if prevp "-" (if (looking-at "\\S-") "1." "*"))) (if prevp "-" (if (looking-at "\\S-") "1." "*")))
((string-match "\\*" current) (if prevp "+" "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." "-")) ((string-match ")" current) (if prevp "1." "-"))
(t (error "This should not happen")))) (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-fix-bullet-type)
(org-maybe-renumber-ordered-list)))) (org-maybe-renumber-ordered-list))))
@ -629,7 +645,7 @@ with something like \"1.\" or \"2)\"."
(buffer-substring (point-at-bol) (match-beginning 3)))) (buffer-substring (point-at-bol) (match-beginning 3))))
;; (term (substring (match-string 3) -1)) ;; (term (substring (match-string 3) -1))
ind1 (n (1- arg)) ind1 (n (1- arg))
fmt bobp) fmt bobp old new)
;; find where this list begins ;; find where this list begins
(org-beginning-of-item-list) (org-beginning-of-item-list)
(setq bobp (bobp)) (setq bobp (bobp))
@ -647,26 +663,32 @@ with something like \"1.\" or \"2)\"."
(if (> ind1 ind) (throw 'next t)) (if (> ind1 ind) (throw 'next t))
(if (< ind1 ind) (throw 'exit t)) (if (< ind1 ind) (throw 'exit t))
(if (not (org-at-item-p)) (throw 'exit nil)) (if (not (org-at-item-p)) (throw 'exit nil))
(setq old (match-string 2))
(delete-region (match-beginning 2) (match-end 2)) (delete-region (match-beginning 2) (match-end 2))
(goto-char (match-beginning 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) (goto-line line)
(org-move-to-column col))) (org-move-to-column col)))
(defun org-fix-bullet-type () (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) (interactive)
(unless (org-at-item-p) (error "This is not a list")) (unless (org-at-item-p) (error "This is not a list"))
(let ((line (org-current-line)) (let ((line (org-current-line))
(col (current-column)) (col (current-column))
(ind (current-indentation)) (ind (current-indentation))
ind1 bullet) ind1 bullet oldbullet)
;; find where this list begins ;; find where this list begins
(org-beginning-of-item-list) (org-beginning-of-item-list)
(beginning-of-line 1) (beginning-of-line 1)
;; find out what the bullet type is ;; find out what the bullet type is
(looking-at "[ \t]*\\(\\S-+\\)") (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 ;; walk forward and replace these numbers
(beginning-of-line 0) (beginning-of-line 0)
(catch 'exit (catch 'exit
@ -680,13 +702,31 @@ with something like \"1.\" or \"2)\"."
(if (< ind1 ind) (throw 'exit t)) (if (< ind1 ind) (throw 'exit t))
(if (not (org-at-item-p)) (throw 'exit nil)) (if (not (org-at-item-p)) (throw 'exit nil))
(skip-chars-forward " \t") (skip-chars-forward " \t")
(looking-at "\\S-+") (looking-at "\\S-+ *")
(replace-match bullet)))) (setq oldbullet (match-string 0))
(replace-match bullet)
(org-shift-item-indentation (- (length bullet) (length oldbullet))))))
(goto-line line) (goto-line line)
(org-move-to-column col) (org-move-to-column col)
(if (string-match "[0-9]" bullet) (if (string-match "[0-9]" bullet)
(org-renumber-ordered-list 1)))) (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 () (defun org-beginning-of-item-list ()
"Go to the beginning of the current item list. "Go to the beginning of the current item list.
I.e. to the first item in this list." I.e. to the first item in this list."

View file

@ -3,7 +3,7 @@
;; Copyright (C) 2008 Free Software Foundation, Inc. ;; Copyright (C) 2008 Free Software Foundation, Inc.
;; Author: John Wiegley <johnw@gnu.org> ;; Author: John Wiegley <johnw@gnu.org>
;; Version: 6.12a ;; Version: 6.13
;; Keywords: outlines, hypermedia, calendar, wp ;; Keywords: outlines, hypermedia, calendar, wp
;; This file is part of GNU Emacs. ;; This file is part of GNU Emacs.

View file

@ -5,7 +5,7 @@
;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Author: Carsten Dominik <carsten at orgmode dot org>
;; Keywords: outlines, hypermedia, calendar, wp ;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org ;; Homepage: http://orgmode.org
;; Version: 6.12a ;; Version: 6.13
;; ;;
;; This file is part of GNU Emacs. ;; This file is part of GNU Emacs.
;; ;;

View file

@ -5,7 +5,7 @@
;; Author: Tokuya Kameshima <kames at fa2 dot so-net dot ne dot jp> ;; Author: Tokuya Kameshima <kames at fa2 dot so-net dot ne dot jp>
;; Keywords: outlines, hypermedia, calendar, wp ;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org ;; Homepage: http://orgmode.org
;; Version: 6.12a ;; Version: 6.13
;; This file is part of GNU Emacs. ;; This file is part of GNU Emacs.
@ -34,21 +34,23 @@
(require 'org) (require 'org)
(defgroup org-mew nil (defgroup org-mew nil
"Options concerning the Mew link." "Options concerning the Mew link."
:tag "Org Startup" :tag "Org Startup"
:group 'org-link) :group 'org-link)
(defcustom org-mew-link-to-refile-destination t (defcustom org-mew-link-to-refile-destination t
"Create a link to the refile destination if the message is marked as refile." "Create a link to the refile destination if the message is marked as refile."
:group 'org-mew :group 'org-mew
:type 'boolean) :type 'boolean)
;; Declare external functions and variables ;; Declare external functions and variables
(declare-function mew-cache-hit "ext:mew-cache" (fld msg &optional must-hit)) (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" (declare-function mew-header-get-value "ext:mew-header"
(field &optional as-list)) (field &optional as-list))
(declare-function mew-init "ext:mew" ()) (declare-function mew-init "ext:mew" ())
(declare-function mew-refile-get "ext:mew-refile" (msg)) (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-display "ext:mew-summary2" (&optional redisplay))
(declare-function mew-summary-folder-name "ext:mew-syntax" (&optional ext)) (declare-function mew-summary-folder-name "ext:mew-syntax" (&optional ext))
(declare-function mew-summary-get-mark "ext:mew-mark" ()) (declare-function mew-summary-get-mark "ext:mew-mark" ())
@ -69,17 +71,18 @@
;; Implementation ;; Implementation
(defun org-mew-store-link () (defun org-mew-store-link ()
"Store a link to a Mew folder or message." "Store a link to a Mew folder or message."
(when (memq major-mode '(mew-summary-mode mew-virtual-mode)) (when (memq major-mode '(mew-summary-mode mew-virtual-mode))
(let* ((msgnum (mew-summary-message-number2)) (let* ((msgnum (mew-summary-message-number2))
(mark-info (mew-summary-get-mark)) (mark-info (mew-summary-get-mark))
(folder-name (folder-name
(if (and org-mew-link-to-refile-destination (if (and org-mew-link-to-refile-destination
(eq mark-info ?o)) ; marked as refile (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))) (mew-summary-folder-name)))
message-id from to subject desc link) message-id from to subject desc link)
(save-window-excursion (save-window-excursion
(if (fboundp 'mew-summary-set-message-buffer) (if (fboundp 'mew-summary-set-message-buffer)
(mew-summary-set-message-buffer folder-name msgnum) (mew-summary-set-message-buffer folder-name msgnum)
(set-buffer (mew-cache-hit folder-name msgnum t))) (set-buffer (mew-cache-hit folder-name msgnum t)))
@ -87,35 +90,35 @@
(setq from (mew-header-get-value "From:")) (setq from (mew-header-get-value "From:"))
(setq to (mew-header-get-value "To:")) (setq to (mew-header-get-value "To:"))
(setq subject (mew-header-get-value "Subject:"))) (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) :subject subject :message-id message-id)
(setq message-id (org-remove-angle-brackets message-id)) (setq message-id (org-remove-angle-brackets message-id))
(setq desc (org-email-link-description)) (setq desc (org-email-link-description))
(setq link (org-make-link "mew:" folder-name (setq link (org-make-link "mew:" folder-name
"#" message-id)) "#" message-id))
(org-add-link-props :link link :description desc) (org-add-link-props :link link :description desc)
link))) link)))
(defun org-mew-open (path) (defun org-mew-open (path)
"Follow the Mew message link specified by PATH." "Follow the Mew message link specified by PATH."
(let (folder msgnum) (let (folder msgnum)
(cond ((string-match "\\`\\(+.*\\)+\\+\\([0-9]+\\)\\'" path) ; for Bastien's (cond ((string-match "\\`\\(+.*\\)+\\+\\([0-9]+\\)\\'" path) ; for Bastien's
(setq folder (match-string 1 path)) (setq folder (match-string 1 path))
(setq msgnum (match-string 2 path))) (setq msgnum (match-string 2 path)))
((string-match "\\`\\(\\(%#\\)?[^#]+\\)\\(#\\(.*\\)\\)?" path) ((string-match "\\`\\(\\(%#\\)?[^#]+\\)\\(#\\(.*\\)\\)?" path)
(setq folder (match-string 1 path)) (setq folder (match-string 1 path))
(setq msgnum (match-string 4 path))) (setq msgnum (match-string 4 path)))
(t (error "Error in Mew link"))) (t (error "Error in Mew link")))
(require 'mew) (require 'mew)
(mew-window-push) (mew-window-push)
(unless mew-init-p (mew-init)) (unless mew-init-p (mew-init))
(mew-summary-visit-folder folder) (mew-summary-visit-folder folder)
(when msgnum (when msgnum
(if (not (string-match "\\`[0-9]+\\'" msgnum)) (if (not (string-match "\\`[0-9]+\\'" msgnum))
(let* ((pattern (concat "message-id=" msgnum)) (let* ((pattern (concat "message-id=" msgnum))
(msgs (mew-summary-pick-with-mewl pattern folder nil))) (msgs (mew-summary-pick-with-mewl pattern folder nil)))
(setq msgnum (car msgs)))) (setq msgnum (car msgs))))
(if (mew-summary-search-msg msgnum) (if (mew-summary-search-msg msgnum)
(if mew-summary-goto-line-then-display (if mew-summary-goto-line-then-display
(mew-summary-display)) (mew-summary-display))
(error "Message not found"))))) (error "Message not found")))))

View file

@ -5,7 +5,7 @@
;; Author: Thomas Baumann <thomas dot baumann at ch dot tum dot de> ;; Author: Thomas Baumann <thomas dot baumann at ch dot tum dot de>
;; Keywords: outlines, hypermedia, calendar, wp ;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org ;; Homepage: http://orgmode.org
;; Version: 6.12a ;; Version: 6.13
;; ;;
;; This file is part of GNU Emacs. ;; This file is part of GNU Emacs.
;; ;;

View file

@ -4,7 +4,7 @@
;; ;;
;; Author: Piotr Zielinski <piotr dot zielinski at gmail dot com> ;; Author: Piotr Zielinski <piotr dot zielinski at gmail dot com>
;; Maintainer: Carsten Dominik <carsten at orgmode dot org> ;; Maintainer: Carsten Dominik <carsten at orgmode dot org>
;; Version: 6.12a ;; Version: 6.13
;; ;;
;; This file is part of GNU Emacs. ;; This file is part of GNU Emacs.
;; ;;
@ -144,7 +144,7 @@
(defvar org-agenda-undo-list) (defvar org-agenda-undo-list)
(defvar org-agenda-custom-commands) (defvar org-agenda-custom-commands)
(declare-function org-agenda-change-all-lines "org-agenda" (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)) (declare-function org-verify-change-for-undo "org-agenda" (l1 l2))
(defvar org-mouse-plain-list-regexp "\\([ \t]*\\)\\([-+*]\\|[0-9]+[.)]\\) " (defvar org-mouse-plain-list-regexp "\\([ \t]*\\)\\([-+*]\\|[0-9]+[.)]\\) "
@ -584,7 +584,7 @@ SCHEDULED: or DEADLINE: or ANYTHINGLIKETHIS:"
(beginning-of-line) (beginning-of-line)
(looking-at "[ \t]*") (looking-at "[ \t]*")
(open-line 1) (open-line 1)
(indent-to (- (match-end 0) (match-beginning 0))) (org-indent-to-column (- (match-end 0) (match-beginning 0)))
(insert "+ ")) (insert "+ "))
(:middle ; insert after (:middle ; insert after

View file

@ -5,7 +5,7 @@
;; Author: Eric Schulte <schulte dot eric at gmail dot com> ;; Author: Eric Schulte <schulte dot eric at gmail dot com>
;; Keywords: tables, plotting ;; Keywords: tables, plotting
;; Homepage: http://orgmode.org ;; Homepage: http://orgmode.org
;; Version: 6.12a ;; Version: 6.13
;; ;;
;; This file is part of GNU Emacs. ;; This file is part of GNU Emacs.
;; ;;

View file

@ -4,7 +4,7 @@
;; Author: David O'Toole <dto@gnu.org> ;; Author: David O'Toole <dto@gnu.org>
;; Maintainer: Bastien Guerry <bzg AT altern DOT org> ;; Maintainer: Bastien Guerry <bzg AT altern DOT org>
;; Keywords: hypermedia, outlines, wp ;; Keywords: hypermedia, outlines, wp
;; Version: 6.12a ;; Version: 6.13
;; This file is part of GNU Emacs. ;; This file is part of GNU Emacs.
;; ;;
@ -626,7 +626,7 @@ Default for INDEX-FILENAME is 'index.org'."
(if index-buffer (if index-buffer
(kill-buffer index-buffer)) (kill-buffer index-buffer))
(with-temp-buffer (with-temp-buffer
(insert (concat "* " index-title "\n\n")) (insert (concat "#+TITLE: " index-title "\n\n"))
(while (setq file (pop files)) (while (setq file (pop files))
(let ((fn (file-name-nondirectory file)) (let ((fn (file-name-nondirectory file))
(link (file-relative-name file dir)) (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))) (if force nil org-publish-use-timestamps-flag)))
(org-publish-projects (org-publish-projects
(list (or project (list (or project
(assoc (completing-read (assoc (org-ido-completing-read
"Publish project: " "Publish project: "
org-publish-project-alist nil t) org-publish-project-alist nil t)
org-publish-project-alist))))))) org-publish-project-alist)))))))

View file

@ -5,7 +5,7 @@
;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Author: Carsten Dominik <carsten at orgmode dot org>
;; Keywords: outlines, hypermedia, calendar, wp ;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org ;; Homepage: http://orgmode.org
;; Version: 6.12a ;; Version: 6.13
;; ;;
;; This file is part of GNU Emacs. ;; This file is part of GNU Emacs.
;; ;;
@ -54,7 +54,7 @@
(defcustom org-remember-store-without-prompt t (defcustom org-remember-store-without-prompt t
"Non-nil means, `C-c C-c' stores remember note without further prompts. "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 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 and `org-remember-default-headline'. To force prompting anyway, use
`C-u C-c C-c' to file the note. `C-u C-c C-c' to file the note.
@ -195,6 +195,26 @@ calendar | %:type %:date"
(symbol :tag "Major mode")) (symbol :tag "Major mode"))
(function :tag "Perform a check against function"))))) (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 (defcustom org-remember-clock-out-on-exit 'query
"Non-nil means, stop the clock when exiting a clocking remember buffer. "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 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-a))
(v-n user-full-name) (v-n user-full-name)
(v-k (if (marker-buffer org-clock-marker) (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) (v-K (if (marker-buffer org-clock-marker)
(org-make-link-string (org-make-link-string
(buffer-file-name (marker-buffer org-clock-marker)) (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)))) (replace-match x t t))))
;; Turn on org-mode in the remember buffer, set local variables ;; Turn on org-mode in the remember buffer, set local variables
(let ((org-inhibit-startup t)) (org-mode)) (let ((org-inhibit-startup t)) (org-mode) (org-remember-mode 1))
(org-set-local 'org-finish-function 'org-remember-finalize)
(if (and file (string-match "\\S-" file) (not (file-directory-p file))) (if (and file (string-match "\\S-" file) (not (file-directory-p file)))
(org-set-local 'org-default-notes-file file)) (org-set-local 'org-default-notes-file file))
(if headline (if headline
@ -474,7 +493,7 @@ to be run from that hook to function properly."
(org-global-tags-completion-table (org-global-tags-completion-table
(if (equal char "G") (org-agenda-files) (and file (list file))))) (if (equal char "G") (org-agenda-files) (and file (list file)))))
(org-add-colon-after-tag-completion t) (org-add-colon-after-tag-completion t)
(ins (completing-read (ins (org-ido-completing-read
(if prompt (concat prompt ": ") "Tags: ") (if prompt (concat prompt ": ") "Tags: ")
'org-tags-completion-function nil nil nil 'org-tags-completion-function nil nil nil
'org-tags-history))) 'org-tags-history)))
@ -501,17 +520,23 @@ to be run from that hook to function properly."
(car clipboards)))))) (car clipboards))))))
((equal char "p") ((equal char "p")
(let* (let*
((prop (substring-no-properties prompt)) ((prop (org-substring-no-properties prompt))
(allowed (with-current-buffer (pall (concat prop "_ALL"))
(get-buffer (file-name-nondirectory file)) (allowed
(org-property-get-allowed-values nil prop 'table))) (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 (existing (with-current-buffer
(get-buffer (file-name-nondirectory file)) (get-buffer (file-name-nondirectory file))
(mapcar 'list (org-property-values prop)))) (mapcar 'list (org-property-values prop))))
(propprompt (concat "Value for " prop ": ")) (propprompt (concat "Value for " prop ": "))
(val (if allowed (val (if allowed
(org-completing-read propprompt allowed nil (org-completing-read
'req-match) propprompt
(mapcar 'list (org-split-string allowed "[ \t]+"))
nil 'req-match)
(org-completing-read propprompt existing nil nil (org-completing-read propprompt existing nil nil
"" nil "")))) "" nil ""))))
(org-set-property prop val))) (org-set-property prop val)))
@ -524,17 +549,17 @@ to be run from that hook to function properly."
(member char '("u" "U")) (member char '("u" "U"))
nil nil (list org-end-time-was-given))) nil nil (list org-end-time-was-given)))
(t (t
(insert (org-completing-read (let (org-completion-use-ido)
(concat (if prompt prompt "Enter string") (insert (org-completing-read
(if default (concat " [" default "]")) (concat (if prompt prompt "Enter string")
": ") (if default (concat " [" default "]"))
completions nil nil nil histvar default))))) ": ")
completions nil nil nil histvar default))))))
(goto-char (point-min)) (goto-char (point-min))
(if (re-search-forward "%\\?" nil t) (if (re-search-forward "%\\?" nil t)
(replace-match "") (replace-match "")
(and (re-search-forward "^[^#\n]" nil t) (backward-char 1)))) (and (re-search-forward "^[^#\n]" nil t) (backward-char 1))))
(let ((org-inhibit-startup t)) (org-mode)) (let ((org-inhibit-startup t)) (org-mode) (org-remember-mode 1)))
(org-set-local 'org-finish-function 'org-remember-finalize))
(when (save-excursion (when (save-excursion
(goto-char (point-min)) (goto-char (point-min))
(re-search-forward "%&" nil t)) (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 This should be run in `post-command-hook' and will remove itself
from that hook." from that hook."
(remove-hook 'post-command-hook 'org-remember-finish-immediately) (remove-hook 'post-command-hook 'org-remember-finish-immediately)
(when org-finish-function (org-remember-finalize))
(funcall org-finish-function)))
(defun org-remember-visit-immediately () (defun org-remember-visit-immediately ()
"File remember note immediately. "File remember note immediately.
@ -572,6 +596,10 @@ from that hook."
(defvar org-clock-marker) ; Defined in org.el (defvar org-clock-marker) ; Defined in org.el
(defun org-remember-finalize () (defun org-remember-finalize ()
"Finalize the remember process." "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) (unless (fboundp 'remember-finalize)
(defalias 'remember-finalize 'remember-buffer)) (defalias 'remember-finalize 'remember-buffer))
(when (and org-clock-marker (when (and org-clock-marker
@ -587,6 +615,12 @@ from that hook."
(setq buffer-file-name nil)) (setq buffer-file-name nil))
(remember-finalize)) (remember-finalize))
(defun org-remember-kill ()
"Abort the current remember process."
(interactive)
(let ((org-note-abort t))
(org-remember-finalize)))
;;;###autoload ;;;###autoload
(defun org-remember (&optional goto org-force-remember-template-char) (defun org-remember (&optional goto org-force-remember-template-char)
"Call `remember'. If this is already a remember buffer, re-apply template. "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' ;; `org-select-remember-template'
(setq org-select-template-temp-major-mode major-mode) (setq org-select-template-temp-major-mode major-mode)
(setq org-select-template-original-buffer (current-buffer)) (setq org-select-template-original-buffer (current-buffer))
(if (eq org-finish-function 'org-remember-finalize) (if org-remember-mode
(progn (progn
(when (< (length org-remember-templates) 2) (when (< (length org-remember-templates) 2)
(error "No other template available")) (error "No other template available"))
@ -769,6 +803,10 @@ See also the variable `org-reverse-note-order'."
(not fastp)) (not fastp))
(org-refile nil (or visiting (find-file-noselect file))) (org-refile nil (or visiting (find-file-noselect file)))
(and visitp (run-with-idle-timer 0.01 nil 'org-remember-visit-immediately)) (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)) (throw 'quit t))
;; Find the file ;; Find the file
(if (not visiting) (find-file-noselect file)) (if (not visiting) (find-file-noselect file))

View file

@ -5,7 +5,7 @@
;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Author: Carsten Dominik <carsten at orgmode dot org>
;; Keywords: outlines, hypermedia, calendar, wp ;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org ;; Homepage: http://orgmode.org
;; Version: 6.12a ;; Version: 6.13
;; ;;
;; This file is part of GNU Emacs. ;; This file is part of GNU Emacs.
;; ;;

View file

@ -5,7 +5,7 @@
;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Author: Carsten Dominik <carsten at orgmode dot org>
;; Keywords: outlines, hypermedia, calendar, wp ;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org ;; Homepage: http://orgmode.org
;; Version: 6.12a ;; Version: 6.13
;; ;;
;; This file is part of GNU Emacs. ;; This file is part of GNU Emacs.
;; ;;

View file

@ -5,7 +5,7 @@
;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Author: Carsten Dominik <carsten at orgmode dot org>
;; Keywords: outlines, hypermedia, calendar, wp ;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org ;; Homepage: http://orgmode.org
;; Version: 6.12a ;; Version: 6.13
;; ;;
;; This file is part of GNU Emacs. ;; This file is part of GNU Emacs.
;; ;;
@ -111,6 +111,7 @@
(funcall (cdr (assq 'vm org-link-frame-setup)) folder readonly) (funcall (cdr (assq 'vm org-link-frame-setup)) folder readonly)
(sit-for 0.1) (sit-for 0.1)
(when article (when article
(require 'vm-search)
(vm-select-folder-buffer) (vm-select-folder-buffer)
(widen) (widen)
(let ((case-fold-search t)) (let ((case-fold-search t))

View file

@ -5,7 +5,7 @@
;; Author: Tokuya Kameshima <kames at fa2 dot so-net dot ne dot jp> ;; Author: Tokuya Kameshima <kames at fa2 dot so-net dot ne dot jp>
;; Keywords: outlines, hypermedia, calendar, wp ;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org ;; Homepage: http://orgmode.org
;; Version: 6.12a ;; Version: 6.13
;; ;;
;; This file is part of GNU Emacs. ;; This file is part of GNU Emacs.
;; ;;

View file

@ -5,7 +5,7 @@
;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Author: Carsten Dominik <carsten at orgmode dot org>
;; Keywords: outlines, hypermedia, calendar, wp ;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org ;; Homepage: http://orgmode.org
;; Version: 6.12a ;; Version: 6.13
;; ;;
;; This file is part of GNU Emacs. ;; This file is part of GNU Emacs.
;; ;;
@ -92,7 +92,7 @@
;;; Version ;;; Version
(defconst org-version "6.12a" (defconst org-version "6.13"
"The version number of the file org.el.") "The version number of the file org.el.")
(defun org-version (&optional here) (defun org-version (&optional here)
@ -125,7 +125,7 @@ With prefix arg HERE, insert it at point."
"Have the modules been loaded already?") "Have the modules been loaded already?")
(defun org-load-modules-maybe (&optional force) (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)) (when (or force (not org-modules-loaded))
(mapc (lambda (ext) (mapc (lambda (ext)
(condition-case nil (require 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 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 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: 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 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 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 interactive-query: Interactive modification of tags query" org-interactive-query)
(const :tag "C mairix: Hook mairix search into Org for different MUAs" org-mairix) (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]] [[linkkey:tag][description]]
If REPLACE is a string, the tag will simply be appended to create the link. 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 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. only argument to create the link, which should be returned as a string.
@ -979,6 +983,20 @@ more efficient."
:tag "Org Follow Link" :tag "Org Follow Link"
:group 'org-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 (defcustom org-follow-link-hook nil
"Hook that is run after a link has been followed." "Hook that is run after a link has been followed."
:group 'org-link-follow :group 'org-link-follow
@ -1304,11 +1322,11 @@ are used, equivalent to the value `((nil . (:level . 1))'."
(const :tag "Current buffer" nil) (const :tag "Current buffer" nil)
(function) (variable) (file)) (function) (variable) (file))
(choice :tag "Identify target headline by" (choice :tag "Identify target headline by"
(cons :tag "Specific tag" (const :tag) (string)) (cons :tag "Specific tag" (const :value :tag) (string))
(cons :tag "TODO keyword" (const :todo) (string)) (cons :tag "TODO keyword" (const :value :todo) (string))
(cons :tag "Regular expression" (const :regexp) (regexp)) (cons :tag "Regular expression" (const :value :regexp) (regexp))
(cons :tag "Level number" (const :level) (integer)) (cons :tag "Level number" (const :value :level) (integer))
(cons :tag "Max Level number" (const :maxlevel) (integer)))))) (cons :tag "Max Level number" (const :value :maxlevel) (integer))))))
(defcustom org-refile-use-outline-path nil (defcustom org-refile-use-outline-path nil
"Non-nil means, provide refile targets as paths. "Non-nil means, provide refile targets as paths.
@ -1699,7 +1717,7 @@ end of the second format."
org-mode generates a time duration." org-mode generates a time duration."
:group 'org-time :group 'org-time
:type 'string) :type 'string)
(defcustom org-deadline-warning-days 14 (defcustom org-deadline-warning-days 14
"No. of days before expiration during which a deadline becomes active. "No. of days before expiration during which a deadline becomes active.
This variable governs the display in sparse trees and in the agenda. 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 (defcustom org-global-properties nil
"List of property/value pairs that can be inherited by any entry. "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" #+PROPERTY: NAME VALUE"
:group 'org-properties :group 'org-properties
@ -2319,6 +2338,11 @@ Use customize to modify this, or restart Emacs after changing it."
:tag "Org Completion" :tag "Org Completion"
:group 'org) :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 (defcustom org-completion-fallback-command 'hippie-expand
"The expansion command called by \\[org-complete] in normal context. "The expansion command called by \\[org-complete] in normal context.
Normal means, no org-mode-specific 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)) (extra txt &optional category tags dotime noprefix remove-re))
(declare-function org-agenda-new-marker "org-agenda" (&optional pos)) (declare-function org-agenda-new-marker "org-agenda" (&optional pos))
(declare-function org-agenda-change-all-lines "org-agenda" (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-set-restriction-lock "org-agenda" (&optional type))
(declare-function org-agenda-maybe-redo "org-agenda" ()) (declare-function org-agenda-maybe-redo "org-agenda" ())
(declare-function org-agenda-save-markers-for-cut-and-paste "org-agenda" (declare-function org-agenda-save-markers-for-cut-and-paste "org-agenda"
(beg end)) (beg end))
(declare-function org-agenda-copy-local-variable "org-agenda" (var))
(declare-function parse-time-string "parse-time" (string)) (declare-function parse-time-string "parse-time" (string))
(declare-function remember "remember" (&optional initial)) (declare-function remember "remember" (&optional initial))
(declare-function remember-buffer-desc "remember" ()) (declare-function remember-buffer-desc "remember" ())
@ -2565,7 +2590,7 @@ Otherwise, return nil."
(<= org-clock-marker (point-at-eol))) (<= org-clock-marker (point-at-eol)))
;; The clock is running here ;; The clock is running here
(setq org-clock-start-time (setq org-clock-start-time
(apply 'encode-time (apply 'encode-time
(org-parse-time-string (match-string 1)))) (org-parse-time-string (match-string 1))))
(org-update-mode-line))) (org-update-mode-line)))
(t (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::" (defcustom org-archive-location "%s_archive::"
"The location where subtrees should be archived. "The location where subtrees should be archived.
Otherwise, the value of this variable is a string, consisting of two The value of this variable is a string, consisting of two parts,
parts, separated by a double-colon. 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 When the filename is omitted, archiving happens in the same file.
file. %s will be replaced by the current file name (without directory part). %s in the filename will be replaced by the current file
Archiving to a different file is useful to keep archived entries from name (without the directory part). Archiving to a different file
contributing to the Org-mode Agenda. 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 The archived entries will be filed as subtrees of the specified
filed under that headline. When omitted, the subtrees are simply filed away headline. When the headline is omitted, the subtrees are simply
at the end of the file, as top-level entries. filed away at the end of the file, as top-level entries.
Here are a few examples: Here are a few examples:
\"%s_archive::\" \"%s_archive::\"
@ -2738,8 +2765,8 @@ collapsed state."
;; Autoload ID code ;; Autoload ID code
(org-autoload "org-id" (org-autoload "org-id"
'(org-id-get-create org-id-new org-id-copy org-id-get '(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-path-completion
org-id-get-with-outline-drilling org-id-get-with-outline-drilling
org-id-goto org-id-find)) 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.") "Matches a link with spaces, optional angular brackets around it.")
(defvar org-link-re-with-space2 nil (defvar org-link-re-with-space2 nil
"Matches a link with spaces, optional angular brackets around it.") "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 (defvar org-angle-link-re nil
"Matches link with angular brackets, spaces are allowed.") "Matches link with angular brackets, spaces are allowed.")
(defvar org-plain-link-re nil (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 " ]" "\\([^" org-non-link-chars " ]"
"[^\t\n\r]*" "[^\t\n\r]*"
"[^" org-non-link-chars " ]\\)>?") "[^" org-non-link-chars " ]\\)>?")
org-link-re-with-space3
(concat
"<?\\(" (mapconcat 'identity org-link-types "\\|") "\\):"
"\\([^" org-non-link-chars " ]"
"[^\t\n\r]*\\)")
org-angle-link-re org-angle-link-re
(concat (concat
"<\\(" (mapconcat 'identity org-link-types "\\|") "\\):" "<\\(" (mapconcat 'identity org-link-types "\\|") "\\):"
@ -4915,7 +4949,7 @@ would end up with no indentation after the change, nothing at all is done."
(goto-char (match-end 0)) (goto-char (match-end 0))
(setq col (current-column)) (setq col (current-column))
(if (< diff 0) (replace-match "")) (if (< diff 0) (replace-match ""))
(indent-to (+ diff col)))) (org-indent-to-column (+ diff col))))
(move-marker end nil)))) (move-marker end nil))))
(defun org-convert-to-odd-levels () (defun org-convert-to-odd-levels ()
@ -5094,7 +5128,7 @@ useful if the caller implements cut-and-paste as copy-then-paste-then-cut."
(defun org-paste-subtree (&optional level tree for-yank) (defun org-paste-subtree (&optional level tree for-yank)
"Paste the clipboard as a subtree, with modification of headline level. "Paste the clipboard as a subtree, with modification of headline level.
The entire subtree is promoted or demoted in order to match a new headline The entire subtree is promoted or demoted in order to match a new headline
level. level.
If the cursor is at the beginning of a headline, the same level as If the cursor is at the beginning of a headline, the same level as
that headline is used to paste the tree that headline is used to paste the tree
@ -5369,13 +5403,13 @@ WITH-CASE, the sorting considers case as well."
(and (= (downcase sorting-type) ?f) (and (= (downcase sorting-type) ?f)
(setq getkey-func (setq getkey-func
(completing-read "Sort using function: " (org-ido-completing-read "Sort using function: "
obarray 'fboundp t nil nil)) obarray 'fboundp t nil nil))
(setq getkey-func (intern getkey-func))) (setq getkey-func (intern getkey-func)))
(and (= (downcase sorting-type) ?r) (and (= (downcase sorting-type) ?r)
(setq property (setq property
(completing-read "Property: " (org-ido-completing-read "Property: "
(mapcar 'list (org-buffer-property-keys t)) (mapcar 'list (org-buffer-property-keys t))
nil t)))) nil t))))
@ -5585,8 +5619,8 @@ exit by killing the buffer with \\[org-edit-src-exit]."
(beginning-of-line 1) (beginning-of-line 1)
(if (looking-at "[ \t]*[^:\n \t]") (if (looking-at "[ \t]*[^:\n \t]")
nil nil
(if (looking-at "[ \t]*\\(\n\\|\\'\\)]") (if (looking-at "[ \t]*\\(\n\\|\\'\\)")
(setq beg (point) end (match-end 0)) (setq beg (point) end beg)
(save-excursion (save-excursion
(if (re-search-backward "^[ \t]*[^:]" nil 'move) (if (re-search-backward "^[ \t]*[^:]" nil 'move)
(setq beg (point-at-bol 2)) (setq beg (point-at-bol 2))
@ -5595,32 +5629,32 @@ exit by killing the buffer with \\[org-edit-src-exit]."
(if (re-search-forward "^[ \t]*[^:]" nil 'move) (if (re-search-forward "^[ \t]*[^:]" nil 'move)
(setq end (1- (match-beginning 0))) (setq end (1- (match-beginning 0)))
(setq end (point)))) (setq end (point))))
(goto-line line) (goto-line line))
(if (get-buffer "*Org Edit Picture*") (if (get-buffer "*Org Edit Picture*")
(kill-buffer "*Org Edit Picture*")) (kill-buffer "*Org Edit Picture*"))
(switch-to-buffer (make-indirect-buffer (current-buffer) (switch-to-buffer (make-indirect-buffer (current-buffer)
"*Org Edit Picture*")) "*Org Edit Picture*"))
(narrow-to-region beg end) (narrow-to-region beg end)
(remove-text-properties beg end '(display nil invisible nil (remove-text-properties beg end '(display nil invisible nil
intangible nil)) intangible nil))
(when (fboundp 'font-lock-unfontify-region) (when (fboundp 'font-lock-unfontify-region)
(font-lock-unfontify-region (point-min) (point-max))) (font-lock-unfontify-region (point-min) (point-max)))
(cond (cond
((eq org-edit-fixed-width-region-mode 'artist-mode) ((eq org-edit-fixed-width-region-mode 'artist-mode)
(fundamental-mode) (fundamental-mode)
(artist-mode 1)) (artist-mode 1))
(t (funcall org-edit-fixed-width-region-mode))) (t (funcall org-edit-fixed-width-region-mode)))
(set (make-local-variable 'org-edit-src-force-single-line) nil) (set (make-local-variable 'org-edit-src-force-single-line) nil)
(set (make-local-variable 'org-edit-src-from-org-mode) org-mode-p) (set (make-local-variable 'org-edit-src-from-org-mode) org-mode-p)
(set (make-local-variable 'org-edit-src-picture) t) (set (make-local-variable 'org-edit-src-picture) t)
(goto-char (point-min)) (goto-char (point-min))
(while (re-search-forward "^[ \t]*: " nil t) (while (re-search-forward "^[ \t]*: ?" nil t)
(replace-match "")) (replace-match ""))
(goto-line line) (goto-line line)
(org-exit-edit-mode) (org-exit-edit-mode)
(org-set-local 'header-line-format msg) (org-set-local 'header-line-format msg)
(message "%s" msg) (message "%s" msg)
t)))) t)))
(defun org-edit-src-find-region-and-lang () (defun org-edit-src-find-region-and-lang ()
@ -5684,7 +5718,7 @@ the language, a switch telling of the content should be in a single line."
(string-match "\\<style=\"\\([^ \t\n\"]+\\)\"" m)) (string-match "\\<style=\"\\([^ \t\n\"]+\\)\"" m))
(match-string 1 m)) (match-string 1 m))
(t "fundamental")))) (t "fundamental"))))
(defun org-edit-src-exit () (defun org-edit-src-exit ()
"Exit special edit and protect problematic lines." "Exit special edit and protect problematic lines."
(interactive) (interactive)
@ -5711,6 +5745,7 @@ the language, a switch telling of the content should be in a single line."
(font-lock-unfontify-region (point-min) (point-max))) (font-lock-unfontify-region (point-min) (point-max)))
(put-text-property (point-min) (point-max) 'font-lock-fontified t)) (put-text-property (point-min) (point-max) 'font-lock-fontified t))
(when (org-bound-and-true-p org-edit-src-picture) (when (org-bound-and-true-p org-edit-src-picture)
(untabify (point-min) (point-max))
(goto-char (point-min)) (goto-char (point-min))
(while (re-search-forward "^" nil t) (while (re-search-forward "^" nil t)
(replace-match ": ")) (replace-match ": "))
@ -5819,6 +5854,8 @@ off orgstruct-mode will *not* remove these additional settings."
'([(meta shift right)] org-shiftmetaright) '([(meta shift right)] org-shiftmetaright)
'([(shift up)] org-shiftup) '([(shift up)] org-shiftup)
'([(shift down)] org-shiftdown) '([(shift down)] org-shiftdown)
'([(shift left)] org-shiftleft)
'([(shift right)] org-shiftright)
'("\C-c\C-c" org-ctrl-c-ctrl-c) '("\C-c\C-c" org-ctrl-c-ctrl-c)
'("\M-q" fill-paragraph) '("\M-q" fill-paragraph)
'("\C-c^" org-sort) '("\C-c^" org-sort)
@ -5975,6 +6012,8 @@ Possible values in the list of contexts are `table', `headline', and `item'."
(cond (cond
((symbolp rpl) (funcall rpl tag)) ((symbolp rpl) (funcall rpl tag))
((string-match "%s" rpl) (replace-match (or tag "") t t rpl)) ((string-match "%s" rpl) (replace-match (or tag "") t t rpl))
((string-match "%h" rpl)
(replace-match (url-hexify-string (or tag "")) t t rpl))
(t (concat rpl tag))))) (t (concat rpl tag)))))
link)) link))
@ -6049,7 +6088,7 @@ This link is added to `org-stored-links' and can later be inserted
into an org-buffer with \\[org-insert-link]. into an org-buffer with \\[org-insert-link].
For some link types, a prefix arg is interpreted: For some link types, a prefix arg is interpreted:
For links to usenet articles, arg negates `org-usenet-links-prefer-google'. For links to usenet articles, arg negates `org-gnus-prefer-web-links'.
For file links, arg negates `org-context-in-file-links'." For file links, arg negates `org-context-in-file-links'."
(interactive "P") (interactive "P")
(org-load-modules-maybe) (org-load-modules-maybe)
@ -6287,7 +6326,7 @@ This is the list that is used for internal purposes.")
This is the list that is used before handing over to the browser.") This is the list that is used before handing over to the browser.")
(defun org-link-escape (text &optional table) (defun org-link-escape (text &optional table)
"Escape characters in TEXT that are problematic for links." "Escape charaters in TEXT that are problematic for links."
(setq table (or table org-link-escape-chars)) (setq table (or table org-link-escape-chars))
(when text (when text
(let ((re (mapconcat (lambda (x) (regexp-quote (let ((re (mapconcat (lambda (x) (regexp-quote
@ -6485,7 +6524,7 @@ used as the link location instead of reading one interactively."
;; Check if we are linking to the current file with a search option ;; Check if we are linking to the current file with a search option
;; If yes, simplify the link by using only the search option. ;; If yes, simplify the link by using only the search option.
(when (and buffer-file-name (when (and buffer-file-name
(string-match "\\<file:\\(.+?\\)::\\([^>]+\\)" link)) (string-match "^file:\\(.+?\\)::\\([^>]+\\)" link))
(let* ((path (match-string 1 link)) (let* ((path (match-string 1 link))
(case-fold-search nil) (case-fold-search nil)
(search (match-string 2 link))) (search (match-string 2 link)))
@ -6495,7 +6534,7 @@ used as the link location instead of reading one interactively."
(setq link search))))) (setq link search)))))
;; Check if we can/should use a relative path. If yes, simplify the link ;; Check if we can/should use a relative path. If yes, simplify the link
(when (string-match "\\<file:\\(.*\\)" link) (when (string-match "^file:\\(.*\\)" link)
(let* ((path (match-string 1 link)) (let* ((path (match-string 1 link))
(origpath path) (origpath path)
(case-fold-search nil)) (case-fold-search nil))
@ -6534,6 +6573,15 @@ used as the link location instead of reading one interactively."
(let ((minibuffer-local-completion-map (let ((minibuffer-local-completion-map
(copy-keymap minibuffer-local-completion-map))) (copy-keymap minibuffer-local-completion-map)))
(org-defkey minibuffer-local-completion-map " " 'self-insert-command) (org-defkey minibuffer-local-completion-map " " 'self-insert-command)
(apply 'org-ido-completing-read args)))
(defun org-ido-completing-read (&rest args)
"Completing-read using `ido-mode' speedups if available"
(if (and org-completion-use-ido
(fboundp 'ido-completing-read)
(boundp 'ido-mode) ido-mode
(listp (second args)))
(apply 'ido-completing-read (concat (car args)) (cdr args))
(apply 'completing-read args))) (apply 'completing-read args)))
(defun org-extract-attributes (s) (defun org-extract-attributes (s)
@ -6601,6 +6649,39 @@ If the link is in hidden text, expose it."
(setq org-link-search-failed t) (setq org-link-search-failed t)
(error "No further link found")))) (error "No further link found"))))
(defun org-translate-link (s)
"Translate a link string if a translation function has been defined."
(if (and org-link-translation-function
(fboundp org-link-translation-function)
(string-match "\\([a-zA-Z0-9]+\\):\\(.*\\)" s))
(progn
(setq s (funcall org-link-translation-function
(match-string 1) (match-string 2)))
(concat (car s) ":" (cdr s)))
s))
(defun org-translate-link-from-planner (type path)
"Translate a link from Emacs Planner syntax so that Org can follow it.
This is still an experimental function, your mileage may vary."
(cond
((member type '("http" "https" "news" "ftp"))
;; standard Internet links are the same.
nil)
((and (equal type "irc") (string-match "^//" path))
;; Planner has two / at the beginning of an irc link, we have 1.
;; We should have zero, actually....
(setq path (substring path 1)))
((and (equal type "lisp") (string-match "^/" path))
;; Planner has a slash, we do not.
(setq type "elisp" path (substring path 1)))
((string-match "^//\\(.?*\\)/\\(<.*>\\)$" path)
;; A typical message link. Planner has the id after the fina slash,
;; we separate it with a hash mark
(setq path (concat (match-string 1 path) "#"
(org-remove-angle-brackets (match-string 2 path)))))
)
(cons type path))
(defun org-find-file-at-mouse (ev) (defun org-find-file-at-mouse (ev)
"Open file link or URL at mouse." "Open file link or URL at mouse."
(interactive "e") (interactive "e")
@ -6611,6 +6692,8 @@ If the link is in hidden text, expose it."
"Open file link or URL at mouse." "Open file link or URL at mouse."
(interactive "e") (interactive "e")
(mouse-set-point ev) (mouse-set-point ev)
(if (eq major-mode 'org-agenda-mode)
(org-agenda-copy-local-variable 'org-link-abbrev-alist-local))
(org-open-at-point)) (org-open-at-point))
(defvar org-window-config-before-follow-link nil (defvar org-window-config-before-follow-link nil
@ -6668,7 +6751,7 @@ application the system uses for this file type."
((or (file-name-absolute-p link) ((or (file-name-absolute-p link)
(string-match "^\\.\\.?/" link)) (string-match "^\\.\\.?/" link))
(setq type "file" path link)) (setq type "file" path link))
((string-match org-link-re-with-space2 link) ((string-match org-link-re-with-space3 link)
(setq type (match-string 1 link) path (match-string 2 link))) (setq type (match-string 1 link) path (match-string 2 link)))
(t (setq type "thisfile" path link))) (t (setq type "thisfile" path link)))
(throw 'match t))) (throw 'match t)))
@ -6703,6 +6786,11 @@ application the system uses for this file type."
;; Remove any trailing spaces in path ;; Remove any trailing spaces in path
(if (string-match " +\\'" path) (if (string-match " +\\'" path)
(setq path (replace-match "" t t path))) (setq path (replace-match "" t t path)))
(if (and org-link-translation-function
(fboundp org-link-translation-function))
;; Check if we need to translate the link
(let ((tmp (funcall org-link-translation-function type path)))
(setq type (car tmp) path (cdr tmp))))
(cond (cond
@ -6787,7 +6875,10 @@ application the system uses for this file type."
(format "Execute \"%s\" as elisp? " (format "Execute \"%s\" as elisp? "
(org-add-props cmd nil (org-add-props cmd nil
'face 'org-warning)))) 'face 'org-warning))))
(message "%s => %s" cmd (eval (read cmd))) (message "%s => %s" cmd
(if (equal (string-to-char cmd) ?\()
(eval (read cmd))
(call-interactively (read cmd))))
(error "Abort")))) (error "Abort"))))
(t (t
@ -7311,7 +7402,7 @@ on the system \"/user@host:\"."
(while (string-match "/" s) (while (string-match "/" s)
(setq s (replace-match "\\" t t s))) (setq s (replace-match "\\" t t s)))
s) s)
(defun org-get-outline-path () (defun org-get-outline-path ()
"Return the outline path to the current entry, as a list." "Return the outline path to the current entry, as a list."
(let (rtn) (let (rtn)
@ -7415,7 +7506,7 @@ operation has put the subtree."
(let* ((cbuf (current-buffer)) (let* ((cbuf (current-buffer))
(cfunc (if org-refile-use-outline-path (cfunc (if org-refile-use-outline-path
'org-olpath-completing-read 'org-olpath-completing-read
'completing-read)) 'org-ido-completing-read))
(extra (if org-refile-use-outline-path "/" "")) (extra (if org-refile-use-outline-path "/" ""))
(filename (buffer-file-name (buffer-base-buffer cbuf))) (filename (buffer-file-name (buffer-base-buffer cbuf)))
(fname (and filename (file-truename filename))) (fname (and filename (file-truename filename)))
@ -7434,8 +7525,8 @@ operation has put the subtree."
(defun org-olpath-completing-read (prompt collection &rest args) (defun org-olpath-completing-read (prompt collection &rest args)
"Read an outline path like a file name." "Read an outline path like a file name."
(let ((thetable collection)) (let ((thetable collection))
(apply (apply
'completing-read prompt 'org-ido-completing-read prompt
(lambda (string predicate &optional flag) (lambda (string predicate &optional flag)
(let (rtn r s f (l (length string))) (let (rtn r s f (l (length string)))
(cond (cond
@ -7591,7 +7682,7 @@ This function can be used in a hook."
(defcustom org-structure-template-alist (defcustom org-structure-template-alist
'( '(
("s" "#+begin_src ?\n\n#+end_src" ("s" "#+begin_src ?\n\n#+end_src"
"<src lang=\"?\">\n\n</src>") "<src lang=\"?\">\n\n</src>")
("e" "#+begin_example\n?\n#+end_example" ("e" "#+begin_example\n?\n#+end_example"
"<example>\n?\n</example>") "<example>\n?\n</example>")
@ -7620,7 +7711,7 @@ for the file uning completion.
There are two templates for each key, the first uses the original Org syntax, There are two templates for each key, the first uses the original Org syntax,
the second uses Emacs Muse-like syntax tags. These Muse-like tags become the second uses Emacs Muse-like syntax tags. These Muse-like tags become
the default when the /org-mtags.el/ module has been loaded. See also the the default when the /org-mtags.el/ module has been loaded. See also the
variable `org-mtags-prefere-muse-templates'. variable `org-mtags-prefer-muse-templates'.
This is an experimental feature, it is undecided if it is going to stay in." This is an experimental feature, it is undecided if it is going to stay in."
:group 'org-completion :group 'org-completion
:type '(repeat :type '(repeat
@ -7643,7 +7734,7 @@ expands them."
(defun org-complete-expand-structure-template (start cell) (defun org-complete-expand-structure-template (start cell)
"Expand a structure template." "Expand a structure template."
(let* ((musep (org-bound-and-true-p org-mtags-prefere-muse-templates)) (let* ((musep (org-bound-and-true-p org-mtags-prefer-muse-templates))
(rpl (nth (if musep 2 1) cell))) (rpl (nth (if musep 2 1) cell)))
(delete-region start (point)) (delete-region start (point))
(when (string-match "\\`#\\+" rpl) (when (string-match "\\`#\\+" rpl)
@ -7654,7 +7745,7 @@ expands them."
(t (newline)))) (t (newline))))
(setq start (point)) (setq start (point))
(if (string-match "%file" rpl) (if (string-match "%file" rpl)
(setq rpl (replace-match (setq rpl (replace-match
(concat (concat
"\"" "\""
(save-match-data (save-match-data
@ -7663,7 +7754,7 @@ expands them."
t t rpl))) t t rpl)))
(insert rpl) (insert rpl)
(if (re-search-backward "\\?" start t) (delete-char 1)))) (if (re-search-backward "\\?" start t) (delete-char 1))))
(defun org-complete (&optional arg) (defun org-complete (&optional arg)
"Perform completion on word at point. "Perform completion on word at point.
@ -7919,7 +8010,7 @@ For calling through lisp, arg is also interpreted in the following way:
(or (not org-use-fast-todo-selection) (or (not org-use-fast-todo-selection)
(not org-todo-key-trigger))) (not org-todo-key-trigger)))
;; Read a state with completion ;; Read a state with completion
(completing-read "State: " (mapcar (lambda(x) (list x)) (org-ido-completing-read "State: " (mapcar (lambda(x) (list x))
org-todo-keywords-1) org-todo-keywords-1)
nil t)) nil t))
((eq arg 'right) ((eq arg 'right)
@ -8069,7 +8160,7 @@ For calling through lisp, arg is also interpreted in the following way:
(condition-case nil (condition-case nil
(org-forward-same-level 1) (org-forward-same-level 1)
(error (end-of-line 1))))) (error (end-of-line 1)))))
(replace-match (replace-match
(if is-percent (if is-percent
(format "[%d%%]" (/ (* 100 cnt-done) (max 1 cnt-all))) (format "[%d%%]" (/ (* 100 cnt-done) (max 1 cnt-all)))
(format "[%d/%d]" cnt-done cnt-all))) (format "[%d/%d]" cnt-done cnt-all)))
@ -8106,7 +8197,7 @@ when there is a statistics cookie in the headline!
(setq changes (append changes (cdr (assoc 'done l))))) (setq changes (append changes (cdr (assoc 'done l)))))
(dolist (c changes) (dolist (c changes)
(org-toggle-tag (car c) (if (cdr c) 'on 'off))))) (org-toggle-tag (car c) (if (cdr c) 'on 'off)))))
(defun org-local-logging (value) (defun org-local-logging (value)
"Get logging settings from a property VALUE." "Get logging settings from a property VALUE."
(let* (words w a) (let* (words w a)
@ -8329,7 +8420,7 @@ of `org-todo-keywords-1'."
(kwd-re (kwd-re
(cond ((null arg) org-not-done-regexp) (cond ((null arg) org-not-done-regexp)
((equal arg '(4)) ((equal arg '(4))
(let ((kwd (completing-read "Keyword (or KWD1|KWD2|...): " (let ((kwd (org-ido-completing-read "Keyword (or KWD1|KWD2|...): "
(mapcar 'list org-todo-keywords-1)))) (mapcar 'list org-todo-keywords-1))))
(concat "\\(" (concat "\\("
(mapconcat 'identity (org-split-string kwd "|") "\\|") (mapconcat 'identity (org-split-string kwd "|") "\\|")
@ -8507,7 +8598,7 @@ EXTRA is additional text that will be inserted into the notes buffer."
(save-excursion (save-excursion
(when findpos (when findpos
(org-back-to-heading t) (org-back-to-heading t)
(narrow-to-region (point) (save-excursion (narrow-to-region (point) (save-excursion
(outline-next-heading) (point))) (outline-next-heading) (point)))
(looking-at (concat outline-regexp "\\( *\\)[^\r\n]*" (looking-at (concat outline-regexp "\\( *\\)[^\r\n]*"
"\\(\n[^\r\n]*?" org-keyword-time-not-clock-regexp "\\(\n[^\r\n]*?" org-keyword-time-not-clock-regexp
@ -8641,9 +8732,9 @@ d Show deadlines due within `org-deadline-warning-days'."
((equal ans ?T) ((equal ans ?T)
(call-interactively 'org-tags-sparse-tree)) (call-interactively 'org-tags-sparse-tree))
((member ans '(?p ?P)) ((member ans '(?p ?P))
(setq kwd (completing-read "Property: " (setq kwd (org-ido-completing-read "Property: "
(mapcar 'list (org-buffer-property-keys)))) (mapcar 'list (org-buffer-property-keys))))
(setq value (completing-read "Value: " (setq value (org-ido-completing-read "Value: "
(mapcar 'list (org-property-values kwd)))) (mapcar 'list (org-property-values kwd))))
(unless (string-match "\\`{.*}\\'" value) (unless (string-match "\\`{.*}\\'" value)
(setq value (concat "\"" value "\""))) (setq value (concat "\"" value "\"")))
@ -8991,10 +9082,10 @@ only lines with a TODO keyword are included in the output."
(defvar todo-only) ;; dynamically scoped (defvar todo-only) ;; dynamically scoped
(defun org-tags-sparse-tree (&optional todo-only match) (defun org-tags-sparse-tree (&optional todo-only match)
"Create a sparse tree according to tags string MATCH. "Create a sparse tree according to tags string MATCH.
MATCH can contain positive and negative selection of tags, like MATCH can contain positive and negative selection of tags, like
\"+WORK+URGENT-WITHBOSS\". \"+WORK+URGENT-WITHBOSS\".
If optional argument TODO-ONLY is non-nil, only select lines that are If optional argument TODO_ONLY is non-nil, only select lines that are
also TODO lines." also TODO lines."
(interactive "P") (interactive "P")
(org-prepare-agenda-buffers (list (current-buffer))) (org-prepare-agenda-buffers (list (current-buffer)))
@ -9039,7 +9130,7 @@ also TODO lines."
;; Get a new match request, with completion ;; Get a new match request, with completion
(let ((org-last-tags-completion-table (let ((org-last-tags-completion-table
(org-global-tags-completion-table))) (org-global-tags-completion-table)))
(setq match (completing-read (setq match (org-ido-completing-read
"Match: " 'org-tags-completion-function nil nil nil "Match: " 'org-tags-completion-function nil nil nil
'org-tags-history)))) 'org-tags-history))))
@ -9187,11 +9278,19 @@ it as a time string and apply `float-time' to it. f S is nil, just return 0."
(error 0.))) (error 0.)))
(t 0.))) (t 0.)))
(defun org-time-today ()
"Time in seconds today at 0:00.
Returns the float number of seconds since the beginning of the
epoch to the beginning of today (00:00)."
(float-time (apply 'encode-time
(append '(0 0 0) (nthcdr 3 (decode-time))))))
(defun org-matcher-time (s) (defun org-matcher-time (s)
(cond (cond
((equal s "<now>") (float-time)) ((string= s "<now>") (float-time))
((equal s "<today>") ((string= s "<today>") (org-time-today))
(float-time (append '(0 0 0) (nthcdr 3 (decode-time))))) ((string= s "<tomorrow>") (+ 86400.0 (org-time-today)))
((string= s "<yesterday>") (- (org-time-today) 86400.0))
(t (org-2ft s)))) (t (org-2ft s))))
(defun org-match-any-p (re list) (defun org-match-any-p (re list)
@ -9349,7 +9448,7 @@ With prefix ARG, realign all tags in headings in the current buffer."
(let ((org-add-colon-after-tag-completion t)) (let ((org-add-colon-after-tag-completion t))
(org-trim (org-trim
(org-without-partial-completion (org-without-partial-completion
(completing-read "Tags: " 'org-tags-completion-function (org-ido-completing-read "Tags: " 'org-tags-completion-function
nil nil current 'org-tags-history))))))) nil nil current 'org-tags-history)))))))
(while (string-match "[-+&]+" tags) (while (string-match "[-+&]+" tags)
;; No boolean logic, just a list ;; No boolean logic, just a list
@ -9392,7 +9491,7 @@ This works in the agenda, and also in an org-mode buffer."
(if (org-mode-p) (if (org-mode-p)
(org-get-buffer-tags) (org-get-buffer-tags)
(org-global-tags-completion-table)))) (org-global-tags-completion-table))))
(completing-read (org-ido-completing-read
"Tag: " 'org-tags-completion-function nil nil nil "Tag: " 'org-tags-completion-function nil nil nil
'org-tags-history)) 'org-tags-history))
(progn (progn
@ -9603,7 +9702,7 @@ Returns the new tags string, or nil to not change the current settings."
(if exit-after-next (setq exit-after-next 'now))) (if exit-after-next (setq exit-after-next 'now)))
((= c ?\t) ((= c ?\t)
(condition-case nil (condition-case nil
(setq tg (completing-read (setq tg (org-ido-completing-read
"Tag: " "Tag: "
(or buffer-tags (or buffer-tags
(with-current-buffer buf (with-current-buffer buf
@ -9738,12 +9837,12 @@ the scanner. The following items can be given here:
((eq match t) (setq matcher t)) ((eq match t) (setq matcher t))
((eq match nil) (setq matcher t)) ((eq match nil) (setq matcher t))
(t (setq matcher (if match (org-make-tags-matcher match) t)))) (t (setq matcher (if match (org-make-tags-matcher match) t))))
(when (eq scope 'tree) (when (eq scope 'tree)
(org-back-to-heading t) (org-back-to-heading t)
(org-narrow-to-subtree) (org-narrow-to-subtree)
(setq scope nil)) (setq scope nil))
(if (not scope) (if (not scope)
(progn (progn
(org-prepare-agenda-buffers (org-prepare-agenda-buffers
@ -10078,7 +10177,7 @@ is set.")
(move-marker org-entry-property-inherited-from (point)) (move-marker org-entry-property-inherited-from (point))
(throw 'ex tmp)) (throw 'ex tmp))
(or (org-up-heading-safe) (throw 'ex nil))))) (or (org-up-heading-safe) (throw 'ex nil)))))
(or tmp (or tmp
(cdr (assoc property org-file-properties)) (cdr (assoc property org-file-properties))
(cdr (assoc property org-global-properties)) (cdr (assoc property org-global-properties))
(cdr (assoc property org-global-properties-fixed)))))) (cdr (assoc property org-global-properties-fixed))))))
@ -10239,7 +10338,7 @@ in the current file."
(interactive (interactive
(let* ((completion-ignore-case t) (let* ((completion-ignore-case t)
(keys (org-buffer-property-keys nil t t)) (keys (org-buffer-property-keys nil t t))
(prop0 (completing-read "Property: " (mapcar 'list keys))) (prop0 (org-ido-completing-read "Property: " (mapcar 'list keys)))
(prop (if (member prop0 keys) (prop (if (member prop0 keys)
prop0 prop0
(or (cdr (assoc (downcase prop0) (or (cdr (assoc (downcase prop0)
@ -10264,7 +10363,7 @@ in the current file."
"In the current entry, delete PROPERTY." "In the current entry, delete PROPERTY."
(interactive (interactive
(let* ((completion-ignore-case t) (let* ((completion-ignore-case t)
(prop (completing-read (prop (org-ido-completing-read
"Property: " (org-entry-properties nil 'standard)))) "Property: " (org-entry-properties nil 'standard))))
(list prop))) (list prop)))
(message "Property %s %s" property (message "Property %s %s" property
@ -10276,7 +10375,7 @@ in the current file."
"Remove PROPERTY globally, from all entries." "Remove PROPERTY globally, from all entries."
(interactive (interactive
(let* ((completion-ignore-case t) (let* ((completion-ignore-case t)
(prop (completing-read (prop (org-ido-completing-read
"Globally remove property: " "Globally remove property: "
(mapcar 'list (org-buffer-property-keys))))) (mapcar 'list (org-buffer-property-keys)))))
(list prop))) (list prop)))
@ -11129,7 +11228,7 @@ days in order to avoid rounding problems."
"Convert a time stamp to an absolute day number. "Convert a time stamp to an absolute day number.
If there is a specifyer for a cyclic time stamp, get the closest date to If there is a specifyer for a cyclic time stamp, get the closest date to
DAYNR. DAYNR.
PREFER and SHOW-ALL are passed through to `org-closest-date'." PREFER and SHOW_ALL are passed through to `org-closest-date'."
(cond (cond
((and daynr (string-match "\\`%%\\((.*)\\)" s)) ((and daynr (string-match "\\`%%\\((.*)\\)" s))
(if (org-diary-sexp-entry (match-string 1 s) "" date) (if (org-diary-sexp-entry (match-string 1 s) "" date)
@ -11149,8 +11248,8 @@ PREFER and SHOW-ALL are passed through to `org-closest-date'."
(defun org-small-year-to-year (year) (defun org-small-year-to-year (year)
"Convert 2-digit years into 4-digit years. "Convert 2-digit years into 4-digit years.
38-99 are mapped into 1938-1999. 1-37 are mapped into 2001-2007. 38-99 are mapped into 1938-1999. 1-37 are mapped into 2001-2007.
The year 2000 cannot be abbreviated. Any year larger than 99 The year 2000 cannot be abbreviated. Any year lager than 99
is returned unchanged." is retrned unchanged."
(if (< year 38) (if (< year 38)
(setq year (+ 2000 year)) (setq year (+ 2000 year))
(if (< year 100) (if (< year 100)
@ -11600,11 +11699,11 @@ If EXCLUDE-TMP is non-nil, ignore temporary buffers."
(lambda (b) (string-match "\*Org .*Export" (buffer-name b)))) (lambda (b) (string-match "\*Org .*Export" (buffer-name b))))
((eq predicate 'agenda) ((eq predicate 'agenda)
(lambda (b) (lambda (b)
(with-current-buffer b (with-current-buffer b
(and (eq major-mode 'org-mode) (and (eq major-mode 'org-mode)
(setq bfn (buffer-file-name b)) (setq bfn (buffer-file-name b))
(member (file-truename bfn) agenda-files))))) (member (file-truename bfn) agenda-files)))))
(t (lambda (b) (with-current-buffer b (t (lambda (b) (with-current-buffer b
(or (eq major-mode 'org-mode) (or (eq major-mode 'org-mode)
(string-match "\*Org .*Export" (string-match "\*Org .*Export"
(buffer-name b))))))))) (buffer-name b)))))))))
@ -11822,7 +11921,7 @@ When a buffer is unmodified, it is just killed. When modified, it is saved
(append org-done-keywords-for-agenda org-done-keywords)) (append org-done-keywords-for-agenda org-done-keywords))
(setq org-todo-keyword-alist-for-agenda (setq org-todo-keyword-alist-for-agenda
(append org-todo-keyword-alist-for-agenda org-todo-key-alist)) (append org-todo-keyword-alist-for-agenda org-todo-key-alist))
(setq org-tag-alist-for-agenda (setq org-tag-alist-for-agenda
(append org-tag-alist-for-agenda org-tag-alist)) (append org-tag-alist-for-agenda org-tag-alist))
(save-excursion (save-excursion
@ -12574,7 +12673,14 @@ depending on context. See the individual commands for more information."
(t (call-interactively 'org-next-item)))) (t (call-interactively 'org-next-item))))
(defun org-shiftright (&optional arg) (defun org-shiftright (&optional arg)
"Next TODO keyword or timestamp one day later, depending on context." "Cycle the thing at point or in the current line, depending on context.
Depending on context, this does one of the following:
- switch a timestamp at point one day into the future
- on a headline, switch to the next TODO keyword.
- on an item, switch entire list to the next bullet type
- on a property line, switch to the next allowed value
- on a clocktable definition line, move time block into the future"
(interactive "P") (interactive "P")
(cond (cond
((org-at-timestamp-p t) (call-interactively 'org-timestamp-up-day)) ((org-at-timestamp-p t) (call-interactively 'org-timestamp-up-day))
@ -12585,7 +12691,14 @@ depending on context. See the individual commands for more information."
(t (org-shiftcursor-error)))) (t (org-shiftcursor-error))))
(defun org-shiftleft (&optional arg) (defun org-shiftleft (&optional arg)
"Previous TODO keyword or timestamp one day earlier, depending on context." "Cycle the thing at point or in the current line, depending on context.
Depending on context, this does one of the following:
- switch a timestamp at point one day into the past
- on a headline, switch to the previous TODO keyword.
- on an item, switch entire list to the previous bullet type
- on a property line, switch to the previous allowed value
- on a clocktable definition line, move time block into the past"
(interactive "P") (interactive "P")
(cond (cond
((org-at-timestamp-p t) (call-interactively 'org-timestamp-down-day)) ((org-at-timestamp-p t) (call-interactively 'org-timestamp-down-day))
@ -13845,7 +13958,7 @@ work correctly."
(goto-char (+ (match-beginning 1) 5)) (goto-char (+ (match-beginning 1) 5))
(goto-char (match-end 0))) (goto-char (match-end 0)))
(make-string (current-column) ?\ ))) (make-string (current-column) ?\ )))
((looking-at "[ \t]*\\([-*+] \\|[0-9]+[.)] \\)?") ((looking-at "[ \t]*\\([-*+] \\|[0-9]+[.)] ?\\)?")
(save-excursion (save-excursion
(goto-char (match-end 0)) (goto-char (match-end 0))
(make-string (current-column) ?\ ))) (make-string (current-column) ?\ )))
@ -14011,13 +14124,14 @@ plainly yank the text as it is.
\[1] Basically, the test checks if the first non-white line is a heading \[1] Basically, the test checks if the first non-white line is a heading
and if there are no other headings with fewer stars." and if there are no other headings with fewer stars."
(interactive "P") (interactive "P")
(setq this-command 'yank)
(if arg (if arg
(call-interactively 'yank) (call-interactively 'yank)
(let ((subtreep ; is kill a subtree, and the yank position appropriate? (let ((subtreep ; is kill a subtree, and the yank position appropriate?
(and (org-kill-is-subtree-p) (and (org-kill-is-subtree-p)
(or (bolp) (or (bolp)
(and (looking-at "[ \t]*$") (and (looking-at "[ \t]*$")
(string-match (string-match
"\\`\\*+\\'" "\\`\\*+\\'"
(buffer-substring (point-at-bol) (point))))))) (buffer-substring (point-at-bol) (point)))))))
swallowp) swallowp)
@ -14046,12 +14160,15 @@ plainly yank the text as it is.
"Yanked text not folded because that would swallow text")) "Yanked text not folded because that would swallow text"))
(goto-char end) (goto-char end)
(skip-chars-forward " \t\n\r") (skip-chars-forward " \t\n\r")
(beginning-of-line 1))) (beginning-of-line 1)
(push-mark beg 'nomsg)))
((and subtreep org-yank-adjusted-subtrees) ((and subtreep org-yank-adjusted-subtrees)
(org-paste-subtree nil nil 'for-yank)) (let ((beg (point-at-bol)))
(org-paste-subtree nil nil 'for-yank)
(push-mark beg 'nomsg)))
(t (t
(call-interactively 'yank)))))) (call-interactively 'yank))))))
(defun org-yank-folding-would-swallow-text (beg end) (defun org-yank-folding-would-swallow-text (beg end)
"Would hide-subtree at BEG swallow any text after END?" "Would hide-subtree at BEG swallow any text after END?"
(let (level) (let (level)
@ -14086,7 +14203,13 @@ plainly yank the text as it is.
(outline-invisible-p) (outline-invisible-p)
(get-char-property (point) 'invisible)))) (get-char-property (point) 'invisible))))
(defalias 'org-back-to-heading 'outline-back-to-heading) (defun org-back-to-heading (&optional invisible-ok)
"Call `outline-back-to-heading', but provide a better error message."
(condition-case nil
(outline-back-to-heading invisible-ok)
(error (error "Before first headline at position %d in buffer %s"
(point) (current-buffer)))))
(defalias 'org-on-heading-p 'outline-on-heading-p) (defalias 'org-on-heading-p 'outline-on-heading-p)
(defalias 'org-at-heading-p 'outline-on-heading-p) (defalias 'org-at-heading-p 'outline-on-heading-p)
(defun org-at-heading-or-item-p () (defun org-at-heading-or-item-p ()
@ -14111,7 +14234,7 @@ headline found, or nil if no higher level is found."
(let ((pos (point)) start-level level (let ((pos (point)) start-level level
(re (concat "^" outline-regexp))) (re (concat "^" outline-regexp)))
(catch 'exit (catch 'exit
(outline-back-to-heading t) (org-back-to-heading t)
(setq start-level (funcall outline-level)) (setq start-level (funcall outline-level))
(if (equal start-level 1) (throw 'exit nil)) (if (equal start-level 1) (throw 'exit nil))
(while (re-search-backward re nil t) (while (re-search-backward re nil t)
@ -14187,7 +14310,7 @@ When ENTRY is non-nil, show the entire entry."
Stop at the first and last subheadings of a superior heading. Stop at the first and last subheadings of a superior heading.
This is like outline-forward-same-level, but invisible headings are ok." This is like outline-forward-same-level, but invisible headings are ok."
(interactive "p") (interactive "p")
(outline-back-to-heading t) (org-back-to-heading t)
(while (> arg 0) (while (> arg 0)
(let ((point-to-move-to (save-excursion (let ((point-to-move-to (save-excursion
(org-get-next-sibling)))) (org-get-next-sibling))))