From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: [PATCH] Agenda: Fix org-agenda-bulk-toggle when point is at already marked item Date: Mon, 16 Apr 2012 10:07:28 -0400 Message-ID: <22387.1334585248@alphaville> References: <17813.1334558185@alphaville> Reply-To: nicholas.dokos@hp.com Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([208.118.235.92]:45176) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SJmah-0008Fq-Bm for emacs-orgmode@gnu.org; Mon, 16 Apr 2012 10:07:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SJmab-0007j8-D7 for emacs-orgmode@gnu.org; Mon, 16 Apr 2012 10:07:38 -0400 Received: from g1t0028.austin.hp.com ([15.216.28.35]:26600) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SJmab-0007hN-5q for emacs-orgmode@gnu.org; Mon, 16 Apr 2012 10:07:33 -0400 In-Reply-To: Message from Madan Ramakrishnan of "Mon\, 16 Apr 2012 08\:07\:04 EDT." 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: Madan Ramakrishnan Cc: emacs-orgmode@gnu.org Madan Ramakrishnan wrote: > Hi Nick, > =C2=A0 Ah, of course, you're right; it would result in a change in behavi= or. =C2=A0 > =C2=A0 While I can certainly tweak the patch to maintain the old behavior > in the case of a negative or zero arg, stepping back, I don't quite > understand the reasoning for the current behavior. =C2=A0If a user has go= ne > to the trouble of providing a negative arg, it doesn't seem intuitive > that org-agenda-bulk-mark just does the same thing as if no negative > arg was passed in. > =C2=A0 For what it's worth, the only caller that I see for this function = in > the codebase is the one in org-agenda-bulk-toggle that I was aiming to > fix with this patch. =C2=A0Of course there could be folks relying on the > current behavior, but I'd be curious as to what they're looking to do. You are probably right and there probably is nobody who depends on the current behavior, but you never know for sure: that's the tyranny of backward compatibility. I'm certainly not using it in any strange way, so it's fine with me either way: I just wanted to point out the possibility. Nick > Madan R. >=20 > On Mon, Apr 16, 2012 at 2:36 AM, Nick Dokos wrote: >=20 > Madan Ramakrishnan wrote: >=20=20=20=20 > > * lisp/org-agenda.el (org-agenda-bulk-mark): truly make arg optional > > as advertised by the function > > > > Problem here was that org-agenda-bulk-toggle calls org-agenda-bulk-= mark > > with no parameters; however, the (max arg 1) call inside > > org-agenda-bulk-mark > > will fail with no parameter. =C2=A0Change the max to an or and all = is well. > > > > This is my first patch for org so apologies for any inadvertent mis= steps > > > > TINYCHANGE > > --- > > =C2=A0lisp/org-agenda.el | =C2=A0 =C2=A02 +- > > =C2=A01 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el > > index 0ffaadb..4e9473d 100644 > > --- a/lisp/org-agenda.el > > +++ b/lisp/org-agenda.el > > @@ -8299,7 +8299,7 @@ This is a command that has to be installed in > > `calendar-mode-map'." > > =C2=A0(defun org-agenda-bulk-mark (&optional arg) > > =C2=A0 =C2=A0"Mark the entry at point for future bulk action." > > =C2=A0 =C2=A0(interactive "p") > > - =C2=A0(dotimes (i (max arg 1)) > > + =C2=A0(dotimes (i (or arg 1)) > > =C2=A0 =C2=A0 =C2=A0(unless (org-get-at-bol 'org-agenda-diary-link) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0(let* ((m (org-get-at-bol 'org-hd-marker= )) > > =C2=A0 =C2=A0 =C2=A0 ov) > > -- > > 1.7.9.2 > > >=20=20=20=20 > I presume arg can be negative or zero. >=20=20=20=20 > If arg is e.g. -3 >=20=20=20=20 > (max arg 1) -> 1 > (or arg 1) =C2=A0-> -3 >=20=20=20=20 > so your patch changes the behavior of the function > in these cases. >=20=20=20=20 > Nick >=20 >=20 > ---------------------------------------------------- > Alternatives: >=20 > ----------------------------------------------------