瀏覽代碼

(org-occur): Sends an error when the user inputs an empty string.

Patch by Bernt Hansen.
Bastien Guerry 15 年之前
父節點
當前提交
052f6e334d
共有 2 個文件被更改,包括 3 次插入0 次删除
  1. 1 0
      lisp/ChangeLog
  2. 2 0
      lisp/org.el

+ 1 - 0
lisp/ChangeLog

@@ -1,6 +1,7 @@
 2009-08-02  Bastien Guerry  <bzg@altern.org>
 
 	* org.el (org-adapt-indentation): Slightly improve the docstring.
+	(org-occur): Sends an error when the user inputs an empty string.
 
 	* org-exp.el (org-export-as-org): Use file-source.org format
 	instead of file.org-source.

+ 2 - 0
lisp/org.el

@@ -10138,6 +10138,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)