emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Refiling list items


From: Florian Beck
Subject: Re: [O] Refiling list items
Date: Mon, 08 Aug 2011 18:12:19 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

Jeff Horn <address@hidden> writes:

> Would someone throw me a bone? I couldn't find anything on gmane, but
> I my gmane-fu isn't the strongest. :D
>
> On Sat, Aug 6, 2011 at 14:54, Jeff Horn <address@hidden> wrote:
>> Should org-refile be able to refile list items? I suspect it would be
>> non-trivial to add this functionality if it isn't already there, but I
>> feel a bit overwhelmed keeping notes as headlines, particularly
>> because I like to leave soft wrapping off and have a hard wrap at 80
>> columns.

Here is a hack I use. It doesn't do any bookkeeping, doesn't check for
errors, (temporarily) moves the point during refiling and you might want
to set `org-refile-targets' to your liking. On the other hand, it might
just do the trick:

(defun org-copy-item (&optional kill)
  "Copy item at point to another location.
With prefix argument, move the item."
  (interactive "P")
  (org-get-item kill)
  (let ((org-refile-targets
         '((org-default-notes-file :maxlevel . 4))))
    (save-window-excursion
      (org-refile t)
      (outline-next-visible-heading 1)
      (skip-chars-backward " \t\n")
      (insert "\n")
      (yank))))

(defun org-get-item (&optional kill)
  "Copy the item at point to the kill ring.
Optionally, kill it."
  (save-excursion
    (let ((beg (org-in-item-p)))
      (org-end-of-item)
      (funcall (if kill
                   'kill-region
                 'copy-region-as-kill)
               beg (point)))))


-- 
Florian Beck



reply via email to

[Prev in Thread] Current Thread [Next in Thread]