emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Bernt Hansen <bernt@norang.ca>
To: emacs-orgmode@gnu.org
Subject: [PATCH] org-occur requires a non-empty regexp for performance
Date: Sat, 01 Aug 2009 20:51:37 -0400	[thread overview]
Message-ID: <87skgb82cm.fsf@gimli.intra.norang.ca> (raw)

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

             reply	other threads:[~2009-08-02  3:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-02  0:51 Bernt Hansen [this message]
2009-08-02 18:59 ` [PATCH] org-occur requires a non-empty regexp for performance Bastien

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=87skgb82cm.fsf@gimli.intra.norang.ca \
    --to=bernt@norang.ca \
    --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).