emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nick Dokos <nicholas.dokos@hp.com>
To: Madan Ramakrishnan <madanr79@gmail.com>
Cc: emacs-orgmode@gnu.org
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	[thread overview]
Message-ID: <22387.1334585248@alphaville> (raw)
In-Reply-To: Message from Madan Ramakrishnan <madanr79@gmail.com> of "Mon\, 16 Apr 2012 08\:07\:04 EDT." <CAHhKTtGbQosRhChdE23wjG0CsaZi65176QtPUqe2T42G=DHHsQ@mail.gmail.com>

Madan Ramakrishnan <madanr79@gmail.com> wrote:

> 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.

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.
> 
> On Mon, Apr 16, 2012 at 2:36 AM, Nick Dokos <nicholas.dokos@hp.com> wrote:
> 
>     Madan Ramakrishnan <madanr79@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
> 
> 
> ----------------------------------------------------
> Alternatives:
> 
> ----------------------------------------------------

  reply	other threads:[~2012-04-16 14:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-16  2:29 [PATCH] Agenda: Fix org-agenda-bulk-toggle when point is at already marked item Madan Ramakrishnan
2012-04-16  6:36 ` Nick Dokos
2012-04-16 12:07   ` Madan Ramakrishnan
2012-04-16 14:07     ` Nick Dokos [this message]
2012-04-20 12:55 ` Bastien

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=22387.1334585248@alphaville \
    --to=nicholas.dokos@hp.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=madanr79@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).