From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Luca Ferrari Newsgroups: gmane.emacs.help Subject: Re: emacs mylin-like tool ? Date: Wed, 2 Jan 2013 14:53:00 +0100 Message-ID: References: <87wqvz5fla.fsf@bzg.ath.cx> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: ger.gmane.org 1357134798 7886 80.91.229.3 (2 Jan 2013 13:53:18 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 2 Jan 2013 13:53:18 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Jan 02 14:53:35 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TqOlB-0008Qc-Mk for geh-help-gnu-emacs@m.gmane.org; Wed, 02 Jan 2013 14:53:33 +0100 Original-Received: from localhost ([::1]:53992 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TqOkw-0003Xc-Jd for geh-help-gnu-emacs@m.gmane.org; Wed, 02 Jan 2013 08:53:18 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:54633) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TqOkl-0003Wz-UN for help-gnu-emacs@gnu.org; Wed, 02 Jan 2013 08:53:12 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TqOkg-0008PR-5z for help-gnu-emacs@gnu.org; Wed, 02 Jan 2013 08:53:07 -0500 Original-Received: from mail-wi0-f175.google.com ([209.85.212.175]:61445) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TqOkf-0008Oh-Re for help-gnu-emacs@gnu.org; Wed, 02 Jan 2013 08:53:01 -0500 Original-Received: by mail-wi0-f175.google.com with SMTP id hm11so10242943wib.8 for ; Wed, 02 Jan 2013 05:53:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type; bh=LT8DT+0aFTgAFCWIf0vA1wpTy4N3+tGhbSW/hP1U7V4=; b=olmwOZyKRmrUNQk5ZHXHrBdPEHlNsV91lvxhF/iyR8Id/ZvkMoCnAv9lsHCg1WJcpu 5Kbr7isaH99WKiMVIMcgy1whSLNIJC5Edxa63WUNhzHJQd6avZovg4/mQAvTarRx6G4q bPYeFP+NhMCKazMeu0w1TVCfrHUAkf0o9ayhC0SHs+04qWzgWvv4wvmhzKWT1TeuzeUW 7OU0AJZraXcVOhSAGgFpFseELUWVFtNpP/T1YZ4Q5Dw2aMCIQoppKPFc6oxPu2WL356U BWBD7eukfhENahzjTul/KBEeN2R1blNg3b5qZc8eT3QsK/oIx6//NUqW1s6QnWzSIJOy vT4Q== Original-Received: by 10.180.73.202 with SMTP id n10mr71092255wiv.17.1357134780324; Wed, 02 Jan 2013 05:53:00 -0800 (PST) Original-Received: by 10.194.30.103 with HTTP; Wed, 2 Jan 2013 05:53:00 -0800 (PST) In-Reply-To: <87wqvz5fla.fsf@bzg.ath.cx> X-Google-Sender-Auth: 4Dljqzdgq0iP1UFjK9ehBmdZdRA X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.212.175 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:88391 Archived-At: 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 wrote: > Hi Luca, > > Luca Ferrari 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