Hi Nick,
  Ah, of course, you're right; it would result in a change in behavior.
  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.  If a user has gone 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.
  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.  Of course there could be folks relying on the current
behavior, but I'd be curious as to what they're looking to do.

Madan R.

On Mon, Apr 16, 2012 at 2:36 AM, Nick Dokos <nicholas.do...@hp.com> wrote:

> Madan Ramakrishnan <madan...@gmail.com> wrote:
>
> > * 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.  Change the max to an or and all is well.
> >
> > This is my first patch for org so apologies for any inadvertent missteps
> >
> > TINYCHANGE
> > ---
> >  lisp/org-agenda.el |    2 +-
> >  1 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'."
> >  (defun org-agenda-bulk-mark (&optional arg)
> >    "Mark the entry at point for future bulk action."
> >    (interactive "p")
> > -  (dotimes (i (max arg 1))
> > +  (dotimes (i (or arg 1))
> >      (unless (org-get-at-bol 'org-agenda-diary-link)
> >        (let* ((m (org-get-at-bol 'org-hd-marker))
> >       ov)
> > --
> > 1.7.9.2
> >
>
> I presume arg can be negative or zero.
>
> If arg is e.g. -3
>
> (max arg 1) -> 1
> (or arg 1)  -> -3
>
> so your patch changes the behavior of the function
> in these cases.
>
> Nick
>

Reply via email to