From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matt Lundin Subject: Re: [PATCH 2/3] Honour existing restrictions when clocking in from the agenda Date: Thu, 19 Jan 2012 07:43:12 -0600 Message-ID: <874nvr4xlb.fsf@fastmail.fm> References: <1325242149-22487-1-git-send-email-bernt@norang.ca> <1325242149-22487-3-git-send-email-bernt@norang.ca> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([140.186.70.92]:57677) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RnsH1-0002t6-C8 for emacs-orgmode@gnu.org; Thu, 19 Jan 2012 08:43:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RnsGs-0006lk-HB for emacs-orgmode@gnu.org; Thu, 19 Jan 2012 08:43:27 -0500 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:38683) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RnsGs-0006lQ-Bl for emacs-orgmode@gnu.org; Thu, 19 Jan 2012 08:43:18 -0500 Received: from compute1.internal (compute1.nyi.mail.srv.osa [10.202.2.41]) by gateway1.nyi.mail.srv.osa (Postfix) with ESMTP id B46FF215DB for ; Thu, 19 Jan 2012 08:43:16 -0500 (EST) In-Reply-To: <1325242149-22487-3-git-send-email-bernt@norang.ca> (Bernt Hansen's message of "Fri, 30 Dec 2011 05:49:08 -0500") 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: Bernt Hansen Cc: emacs-orgmode@gnu.org Hi Bernt, Bernt Hansen writes: > * lisp/org-agenda.el (org-agenda-clock-in): Save restriction when clocking in from the agenda > > Narrowed org buffers are now retained when clocking in from the agenda. > We only widen the buffer when the task to clock in is outside the existing > restriction. It seems that adding save-restriction to org-agenda-clock-in causes the following: When one clocks in from the agenda, all preexisting drawers in a buffer are aligned to org-tags-column (i.e., the right side of the file). I can confirm this using emacs -Q. Here's a sample file. Before clocking in it looks like this: --8<---------------cut here---------------start------------->8--- * A headline SCHEDULED: <2012-01-18 Wed +1d> :LOGBOOK: CLOCK: [2012-01-18 Wed 20:10]--[2012-01-19 Thu 07:18] => 11:08 :END: :PROPERTIES: :HELLO: there :END: * And another :PROPERTIES: :NOW: and again :END: --8<---------------cut here---------------end--------------->8--- After clocking in from the agenda -- (org-agenda-clock-in) -- the file looks like this: --8<---------------cut here---------------start------------->8--- * A headline SCHEDULED: <2012-01-18 Wed +1d> :LOGBOOK: CLOCK: [2012-01-19 Thu 07:19] CLOCK: [2012-01-18 Wed 20:10]--[2012-01-19 Thu 07:18] => 11:08 :END: :PROPERTIES: :HELLO: there :END: * And another :PROPERTIES: :NOW: and again :END: --8<---------------cut here---------------end--------------->8--- Strangely (though not demonstrated in the above example), all tags in the buffer are also realigned. Note: org-indent-mode is not on. My emacs version is: GNU Emacs 24.0.92.1 (i686-pc-linux-gnu, GTK+ Version 2.24.8) of 2012-01-18 on archeee Org-version: release_7.8.03-149-g46ff3 Org-mode version 7.8.03 (release_7.8.03.149.g46ff3) Best, Matt P.S. I hope all on the list are doing well. I look forward to participating more in the near future. Bernt Hansen writes: > * lisp/org-agenda.el (org-agenda-clock-in): Save restriction when clocking in from the agenda > > Narrowed org buffers are now retained when clocking in from the agenda. > We only widen the buffer when the task to clock in is outside the existing > restriction. > --- > lisp/org-agenda.el | 17 +++++++++-------- > 1 files changed, 9 insertions(+), 8 deletions(-) > > diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el > index 780794e..f240f5e 100644 > --- a/lisp/org-agenda.el > +++ b/lisp/org-agenda.el > @@ -7797,14 +7797,15 @@ The cursor may be at a date in the calendar, or in the Org agenda." > newhead) > (org-with-remote-undo (marker-buffer marker) > (with-current-buffer (marker-buffer marker) > - (widen) > - (goto-char pos) > - (org-show-context 'agenda) > - (org-show-entry) > - (org-cycle-hide-drawers 'children) > - (org-clock-in arg) > - (setq newhead (org-get-heading))) > - (org-agenda-change-all-lines newhead hdmarker))))) > + (save-restriction > + (widen) > + (goto-char pos) > + (org-show-context 'agenda) > + (org-show-entry) > + (org-cycle-hide-drawers 'children) > + (org-clock-in arg) > + (setq newhead (org-get-heading))) > + (org-agenda-change-all-lines newhead hdmarker)))))) > > (defun org-agenda-clock-out () > "Stop the currently running clock."