emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] [PATCH] Bug: org-ageda-bulk-mark-regexp bugs [7.7]


From: Andrew Stribblehill
Subject: [O] [PATCH] Bug: org-ageda-bulk-mark-regexp bugs [7.7]
Date: Mon, 17 Oct 2011 14:51:56 +0100

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 via email to

[Prev in Thread] Current Thread [Next in Thread]