[Top][All Lists]

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

occur patch

From: Nathaniel Flath
Subject: occur patch
Date: Wed, 10 Nov 2010 20:44:39 -0800

I found it useful to have occur default to the current word instead of
the last regexp, so I modified replace.el to support this.  The patch
is below, if it should be installed into emacs itself - let me know of
any issues.

Nathaniel Flath

diff --git a/lisp/replace.el b/lisp/replace.el
index baea282..12c95cf 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -1006,9 +1006,17 @@ which means to discard all text properties."
   :group 'matching
   :version "22.1")

+(defcustom occur-read-method 'history
+  "Method that Occur uses to prompt for a regex."
+  :type '(choice (const :tag "Last regex" 'history)
+                (const :tag "Current word" 'current-word))
+  :group 'matching)
 (defun occur-read-primary-args ()
   (list (read-regexp "List lines matching regexp"
-                    (car regexp-history))
+                    (if (eq occur-read-method 'history)
+                        (car regexp-history)
+                      (current-word)))
        (when current-prefix-arg
          (prefix-numeric-value current-prefix-arg))))

reply via email to

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