From mboxrd@z Thu Jan 1 00:00:00 1970 From: Derek Feichtinger Subject: Re: Bug: org-resolve-clocks should not iterate over non-agenda org files [8.3.3 (8.3.3-elpaplus @ /home/dfeich/.emacs.d/elpa/org-plus-contrib-20160108/) Date: Thu, 21 Jan 2016 10:26:56 +0100 Message-ID: References: <87oacggzp5.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=089e013c6f5e356bce0529d4b472 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:54477) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aMBW7-00053i-4z for emacs-orgmode@gnu.org; Thu, 21 Jan 2016 04:27:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aMBW5-00027B-Q6 for emacs-orgmode@gnu.org; Thu, 21 Jan 2016 04:26:59 -0500 Received: from mail-ig0-x234.google.com ([2607:f8b0:4001:c05::234]:35170) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aMBW5-00026x-Iq for emacs-orgmode@gnu.org; Thu, 21 Jan 2016 04:26:57 -0500 Received: by mail-ig0-x234.google.com with SMTP id t15so121562224igr.0 for ; Thu, 21 Jan 2016 01:26:57 -0800 (PST) In-Reply-To: <87oacggzp5.fsf@nicolasgoaziou.fr> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Derek Feichtinger , emacs-orgmode@gnu.org --089e013c6f5e356bce0529d4b472 Content-Type: text/plain; charset=UTF-8 Hi Nicolas Ok, that makes sense, then. Probably there are other users who indeed will rely on clocking in non-agenda files. The thing which made it hard for me to identify the initial problem was that the test CLOCK lines I had in the testing file where placed there without a heading. When later in the day I wanted to clock in to my tasks, I then just ended up with a "outline-back-to-heading: before first heading" error, but with no indicator which of my ~60 open org files was the culprit. Maybe one could insert the file location in that error message? Since org is so extremely useful, and I almost spend 80% of my day in org files (also some of my collaborators are beginning to use it... it is viral), I often have >50 files with all kinds of purposes open: agenda, various notes, beamer, html-exports, wiki-authoring, project-organization, bookkeeping... the thing is just too useful. So, I think clashes between the many uses of org files probably are natural. This being emacs :-) I just decided to advise org-resolve-clocks. (defun dfeich/org-resolve-clocks (orig-function &optional only-dangling-p prompt-fn last-valid) (cl-letf (((symbol-function 'org-files-list) 'org-agenda-files)) (apply orig-function only-dangling-p prompt-fn last-valid))) (advice-add #'org-resolve-clocks :around #'dfeich/org-resolve-clocks) Thanks for maintaining and developing an environment which made my time in front of the keyboard so much more efficient. Derek On Wed, Jan 20, 2016 at 2:14 PM, Nicolas Goaziou wrote: > Hello, > > Derek Feichtinger writes: > > > org-resolve-clock loops over all open org buffers for detecting open > > clocks (using function org-files-list). Is this really intended? I think > > it should just loop over the org-agenda-files. > > > > I was working on an extension for clocking and was recording my testing > > results > > into a separate org file. I also had put there examples of > > various clock lines to test regexps against. The example clock lines > > effectively prevented me from clocking in to a task from my normal > > agenda files. > > > > Since org has so many usages, I think it should not be assumed that each > > org buffer is related to the agenda functionality. > > Clocking is not just an agenda functionality. Since every Org document > can contain clocks, it makes sense to use `org-files-list' instead of > `org-agenda-files'. > > You could test your extension in a dedicated Emacs process, with > `org-agenda-files' being nil and Org documents opened piece-wise. > > > Regards, > > -- > Nicolas Goaziou > --089e013c6f5e356bce0529d4b472 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi Nicolas

Ok, that makes sense, then. = Probably there are other users who indeed will rely on clocking in non-agen= da files.

The thing which made it hard for me to i= dentify the initial problem was that the test CLOCK lines I had in the test= ing file where placed there without a heading. When later in the day I want= ed to clock in to my tasks, =C2=A0I then just ended up with a "outline= -back-to-heading: before first heading" error, but with no indicator w= hich of my ~60 open org files was the culprit. Maybe one could insert the f= ile location in that error message?

Since org is s= o extremely useful, and I almost spend 80% of my day in org files (also som= e of my collaborators are beginning to use it... it is viral), I often have= >50 files with all kinds of purposes open: agenda, various notes, beame= r, html-exports, wiki-authoring, project-organization, bookkeeping... the t= hing is just too useful. So, I think clashes between the many uses of org f= iles probably are natural.

This being emacs =C2=A0= :-) I just decided to advise org-resolve-clocks.

<= div>(defun dfeich/org-resolve-clocks (orig-function &optional only-dang= ling-p prompt-fn last-valid)
=C2=A0 (cl-letf (((symbol-function &= #39;org-files-list) 'org-agenda-files))
=C2=A0 =C2=A0 (apply = orig-function only-dangling-p prompt-fn last-valid)))

<= div>(advice-add #'org-resolve-clocks :around #'dfeich/org-resolve-c= locks)

Thanks for maintaining and developing= an environment which made my time in front of the keyboard so much more ef= ficient.

Derek
--089e013c6f5e356bce0529d4b472--