* emacs mylin-like tool ?
@ 2012-12-30 16:04 Luca Ferrari
2012-12-30 22:40 ` Bastien
0 siblings, 1 reply; 3+ messages in thread
From: Luca Ferrari @ 2012-12-30 16:04 UTC (permalink / raw)
To: help-gnu-emacs
Hi all,
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?
Thanks,
Luca
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: emacs mylin-like tool ?
2012-12-30 16:04 emacs mylin-like tool ? Luca Ferrari
@ 2012-12-30 22:40 ` Bastien
2013-01-02 13:53 ` Luca Ferrari
0 siblings, 1 reply; 3+ messages in thread
From: Bastien @ 2012-12-30 22:40 UTC (permalink / raw)
To: Luca Ferrari; +Cc: help-gnu-emacs
Hi Luca,
Luca Ferrari <fluca1978@infinito.it> 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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: emacs mylin-like tool ?
2012-12-30 22:40 ` Bastien
@ 2013-01-02 13:53 ` Luca Ferrari
0 siblings, 0 replies; 3+ messages in thread
From: Luca Ferrari @ 2013-01-02 13:53 UTC (permalink / raw)
To: help-gnu-emacs
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 <bzg@altern.org> wrote:
> Hi Luca,
>
> Luca Ferrari <fluca1978@infinito.it> 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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-01-02 13:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-30 16:04 emacs mylin-like tool ? Luca Ferrari
2012-12-30 22:40 ` Bastien
2013-01-02 13:53 ` Luca Ferrari
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).