emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: netty hacky <netty.hacky@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re-marking agenda entries, with advice on org-agenda-bulk-action in .emacs
Date: Sun, 2 Oct 2011 02:13:38 -0700	[thread overview]
Message-ID: <CADvi8RdFn6z=9B9UYKNSaj+AFrU_2RYpkcvB+CyGctre_Mob1Q@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1743 bytes --]

Hello,

The issue of re-marking agenda entries has been raised before:
http://lists.gnu.org/archive/html/emacs-orgmode/2011-02/msg00200.html

I am facing the same problem.  I always do more than one bulk actions on the
same set of agenda entries, so having to re-mark them manually has been a
pain.  The org-agenda-bulk-mark-regexp command sort of helped, but I still
prefer the Dired behavior of retaining the mark after action is performed,
(typing one 'U' is much less keystroke than any manual re-marking).

Anyway, I put the following piece of code in .emacs to give me the Dired
like behavior.  It seems to work for me.  Since I'm new to Emacs Lisp and
this is the 2nd day I'm hacking Org-mode code, could anyone help spot
anything I did stupid here that may shoot me in the foot?  Much appreciated.

(eval-after-load 'org-agenda
  '(defadvice org-agenda-bulk-action (around bulk-re-mark
                                             (&optional arg)
                                             activate)
     "Re-mark entries marked before action."
     (let ((entries (copy-sequence org-agenda-bulk-marked-entries)))
       ad-do-it
       (let (pos (cnt 0) (cntskip 0) (msg (current-message)))
         (dolist (e entries)
           (setq pos (text-property-any (point-min) (point-max)
'org-hd-marker e))
           (if (not pos)
               (setq cntskip (1+ cntskip))
             (goto-char pos)
             (call-interactively 'org-agenda-bulk-mark)
             (setq cnt (1+ cnt))))
         (message "%s (%d entries re-marked, %d skipped)" msg cnt
cntskip)))))

Cheers,
Net
P.S. I would like to express my sincere gratitude to all who helped make
Org-mode such a beautiful piece of software and a life-changing experience.

[-- Attachment #2: Type: text/html, Size: 2004 bytes --]

             reply	other threads:[~2011-10-02  9:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-02  9:13 netty hacky [this message]
2011-10-02  9:28 ` Re-marking agenda entries, with advice on org-agenda-bulk-action in .emacs netty hacky
2012-04-24 22:07 ` Bastien
2015-03-03 18:12   ` Robert Pluim
2015-03-06 10:54     ` Nicolas Goaziou

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='CADvi8RdFn6z=9B9UYKNSaj+AFrU_2RYpkcvB+CyGctre_Mob1Q@mail.gmail.com' \
    --to=netty.hacky@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /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).