Hi Xavier, At Sun, 16 Sep 2007 03:00:10 +0200, Xavier Maillard wrote: > > So let's say I have this organization: > > * Project 1 > ** TODO Ask foo about bar > > * Project 2 > ** TODO Write customer report > > * Project 3 > > How can I move the TODO from "Project 1" to "Project 3" directly > -i.e. move by "name"
I'm catching up on reading my mailing lists, therefore you may have already found a different way to do it, but just in case below is what I wrote for myself for same functionality that you asked for. Regards, Max ;;; Below code provides a function M-x org-quicky-refile which cuts a ;;; heading, then scans the file for the names of top level headings, ;;; and asks for the heading name to paste the item into (with ;;; standard Emacs completion) ;;; ;;; Simply bind org-quicky-refile to a key in org-mode-map. ;;; ;;; Bugs: leaves empty line sometimes, but this is a bug in ;; org-paste-subtree IMHO. ;;; ;;; Possible improvements: only collect headings with specific tags ;;; as targets, so that one can tag 3rd/4th level headings as target (defun org-quicky-get-heading (&optional no-props) (if (looking-at "^\\*+[ \t]+\\([^\r\n]*?\\)[ \t]*\\(:[a-zA-Z0-9:[EMAIL PROTECTED])?[ \t]*[\r\n]") (if no-props (org-match-string-no-properties 1) (match-string 1)) "")) (defun org-quicky-get-toplevel-headings () "Return a list of top level headings" (let (headings) (save-excursion (goto-char (point-min)) (while (not (eobp)) (when (and (looking-at outline-regexp) (= (org-outline-level) 1)) (push (cons (org-quicky-get-heading t) (point-marker)) headings)) (forward-line))) (nreverse headings))) (defmacro when* (expr &rest body) `(let ((it ,expr)) (when it ,@body))) (defvar org-quicky-refile-history nil) (defun org-quicky-refile (&optional arg) (interactive) (let* ((headings (org-quicky-get-toplevel-headings)) (completion-ignore-case t) pos) (when* (completing-read "Project: " (mapcar #'car headings) nil t nil 'org-quicky-refile-history) (setq pos (cdr (assoc it headings))) (org-cut-special) (save-excursion (goto-char pos) (setq pos (or (save-excursion (outline-get-next-sibling)) (point-max))) (goto-char pos) (org-paste-subtree 2))))) _______________________________________________ Emacs-orgmode mailing list Remember: use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode