From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Stribblehill Subject: [PATCH] Bug: org-ageda-bulk-mark-regexp bugs [7.7] Date: Mon, 17 Oct 2011 14:51:56 +0100 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Return-path: Received: from eggs.gnu.org ([140.186.70.92]:44590) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RFnbj-0004Jk-W1 for emacs-orgmode@gnu.org; Mon, 17 Oct 2011 09:52:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RFnbj-0000B6-36 for emacs-orgmode@gnu.org; Mon, 17 Oct 2011 09:51:59 -0400 Received: from mail-gx0-f169.google.com ([209.85.161.169]:50660) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RFnbj-0000Ax-0d for emacs-orgmode@gnu.org; Mon, 17 Oct 2011 09:51:59 -0400 Received: by ggdk5 with SMTP id k5so3558939ggd.0 for ; Mon, 17 Oct 2011 06:51:57 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org 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 ()