From: Luca Ferrari <fluca1978@infinito.it>
To: help-gnu-emacs@gnu.org
Subject: Re: emacs mylin-like tool ?
Date: Wed, 2 Jan 2013 14:53:00 +0100 [thread overview]
Message-ID: <CAKoxK+6i+H2PbSnmTK8RuPpnmtcN=j1G15k3_2NBMqx5nXXzBQ@mail.gmail.com> (raw)
In-Reply-To: <87wqvz5fla.fsf@bzg.ath.cx>
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
prev parent reply other threads:[~2013-01-02 13:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
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 message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAKoxK+6i+H2PbSnmTK8RuPpnmtcN=j1G15k3_2NBMqx5nXXzBQ@mail.gmail.com' \
--to=fluca1978@infinito.it \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.