emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Bug: org-ageda-bulk-mark-regexp bugs [7.7]
@ 2011-10-17 13:51 Andrew Stribblehill
  0 siblings, 0 replies; only message in thread
From: Andrew Stribblehill @ 2011-10-17 13:51 UTC (permalink / raw)
  To: emacs-orgmode

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 ()

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-10-17 13:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-17 13:51 [PATCH] Bug: org-ageda-bulk-mark-regexp bugs [7.7] Andrew Stribblehill

Code repositories for project(s) associated with this 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).