help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: emacs mylin-like tool ?


From: Luca Ferrari
Subject: Re: emacs mylin-like tool ?
Date: Wed, 2 Jan 2013 14:53:00 +0100

Hi Bastien,
thank you for this nice piece of code, I'll try it out for a few days
to see how I feel it and report back on it.

Luca

On Sun, Dec 30, 2012 at 11:40 PM, Bastien <address@hidden> wrote:
> Hi Luca,
>
> Luca Ferrari <address@hidden> writes:
>
>> I'm curious to know if there is some tool like Eclipse Mylin
>> (http://www.eclipse.org/mylyn/) that "records" which files have been
>> visited when working about a specific task. And in the case it would
>> be great to get it tied to org mode tasks...any suggestion?
>
> Here is a small hack.  It empty the list of recent files when you
> clock in a task, and it write it as a dynamic block when you clock out.
> I don't use recentf-mode myself, so this may need more testing.
>
> Feedback welcome!
>
> (defun org-recentf-save-and-empty ()
>   "Save and empty recentf"
>   (if (not recentf-mode)
>       (recentf-mode)
>     (recentf-save-list)
>     (setq recentf-list nil)
>     (message "Recentf list reinitialized")))
>
> (defun org-recentf-dblock-update ()
>   "Insert and/or update #+BEGIN: recentf block"
>   (save-excursion
>     (org-back-to-heading)
>     (if (search-forward "#+BEGIN: recentf")
>         (org-dblock-update)
>       (outline-next-heading)
>       (insert "#+BEGIN: recentf\n#+END:\n")
>       (search-backward "#+BEGIN")
>       (org-dblock-update))))
>
> (defun org-dblock-write:recentf (params)
>   "Write the RECENTF dblock."
>   (interactive)
>   (let* ((rf "(setq recentf-list %s)")
>          (rfl (format rf (prin1-to-string recentf-list))))
>     (insert "#+begin_src emacs-lisp\n" rfl
>             "\n(recentf-load-list)\n#+end_src")))
>
> (add-hook 'org-clock-in-hook 'org-recentf-save-and-empty)
> (add-hook 'org-clock-out-hook 'org-recentf-dblock-update)
>
> HTH,
>
> --
>  Bastien



reply via email to

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