emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Andrew Stribblehill <ads@wompom.org>
To: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: [PATCH] Bug: org-ageda-bulk-mark-regexp bugs [7.7]
Date: Mon, 17 Oct 2011 14:51:56 +0100	[thread overview]
Message-ID: <CAJT8BhWv7HCTGrgOWYAE5tcv39-fiGGjo5KQyJgL5AD2MyvhLA@mail.gmail.com> (raw)

Emacs  : GNU Emacs 23.1.1 (x86_64-pc-linux-gnu, GTK+ Version 2.20.1)
 of 2011-03-04 on allspice, modified by Debian
Package: Org-mode version 7.7

I found a couple of bugs with org-agenda-bulk-mark-regexp:
 - it didn't work at all :)
 - once I fixed that, it didn't work for the empty regex (or, I guess,
for other expressions that match the emptiness at the end of the
buffer).

The first problem was solved by initializing entries-marked as 0. The
latter, by making sure there is text to match on before proceeding
down the while loop.

This patch is relative to HEAD as of 2011-10-17T13:46:48+0000

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 60e561c..bf03b68 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -8144,16 +8144,15 @@ This is a command that has to be installed in
`calendar-mode-map'."
 (defun org-agenda-bulk-mark-regexp (regexp)
   "Mark entries match REGEXP."
   (interactive "sMark entries matching regexp: ")
-  (let ((entries-marked 0))
+  (let (entries-marked)
     (save-excursion
       (goto-char (point-min))
       (goto-char (next-single-property-change (point) 'txt))
-      (while (and (re-search-forward regexp nil t)
-                 (get-text-property (point) 'txt))
+      (while (re-search-forward regexp nil t)
        (when (string-match regexp (get-text-property (point) 'txt))
          (setq entries-marked (+ entries-marked 1))
          (call-interactively 'org-agenda-bulk-mark))))
-    (if (zerop entries-marked)
+    (if (not entries-marked)
        (message "No entry matching this regexp."))))

 (defun org-agenda-bulk-unmark ()

                 reply	other threads:[~2011-10-17 13:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=CAJT8BhWv7HCTGrgOWYAE5tcv39-fiGGjo5KQyJgL5AD2MyvhLA@mail.gmail.com \
    --to=ads@wompom.org \
    --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).