From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bernt Hansen Subject: [PATCH] org-occur requires a non-empty regexp for performance Date: Sat, 01 Aug 2009 20:51:37 -0400 Message-ID: <87skgb82cm.fsf@gimli.intra.norang.ca> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MXS2B-0001aF-PF for emacs-orgmode@gnu.org; Sat, 01 Aug 2009 23:46:55 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MXS28-0001Zh-0m for emacs-orgmode@gnu.org; Sat, 01 Aug 2009 23:46:55 -0400 Received: from [199.232.76.173] (port=41565 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MXS27-0001Zb-To for emacs-orgmode@gnu.org; Sat, 01 Aug 2009 23:46:51 -0400 Received: from mho-01-ewr.mailhop.org ([204.13.248.71]:56885) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MXS27-00033P-Gr for emacs-orgmode@gnu.org; Sat, 01 Aug 2009 23:46:51 -0400 Received: from cpe000102d0fe75-cm0012256ecbde.cpe.net.cable.rogers.com ([99.239.148.180] helo=mail.norang.ca) by mho-01-ewr.mailhop.org with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.68) (envelope-from ) id 1MXS24-0002Gh-Io for emacs-orgmode@gnu.org; Sun, 02 Aug 2009 03:46:48 +0000 Received: from gollum.intra.norang.ca (gollum.intra.norang.ca [192.168.1.5]) by mail.norang.ca (8.14.3/8.14.3/Debian-5) with ESMTP id n723kkSt022294 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Sat, 1 Aug 2009 23:46:47 -0400 Received: from gollum.intra.norang.ca (localhost [127.0.0.1]) by gollum.intra.norang.ca (8.14.3/8.14.3/Debian-5) with ESMTP id n723kkoS010961 for ; Sat, 1 Aug 2009 23:46:46 -0400 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org If a blank regexp is provided to org-occur the function goes away for a l-o-n-g time. We'll just bail out instead up front to prevent an infinite loop. --- I never actually let this run long enough to find out if it is an infinite loop -- or if it just takes forever to return results. I'm not that patient. This patch is available at git://git.norang.ca/org-mode.git for-carsten -Bernt lisp/org.el | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 942be39..9410dee 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -10127,6 +10127,8 @@ command. If CALLBACK is non-nil, it is a function which is called to confirm that the match should indeed be shown." (interactive "sRegexp: \nP") + (when (equal regexp "") + (error "Regexp cannot be empty")) (unless keep-previous (org-remove-occur-highlights nil nil t)) (push (cons regexp callback) org-occur-parameters) -- 1.6.2.rc1.1002.g6345