aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/replace.el22
2 files changed, 27 insertions, 1 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index df4cf561588..20a3a6e1e50 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
12013-03-10 Jambunathan K <kjambunathan@gmail.com>
2
3 * replace.el (occur-read-regexp-defaults-function): New var.
4 (occur-read-regexp-defaults): New defun.
5 (occur-read-primary-args): Propagate above change (bug#13892).
6
12013-03-09 Stefan Monnier <monnier@iro.umontreal.ca> 72013-03-09 Stefan Monnier <monnier@iro.umontreal.ca>
2 8
3 * mouse.el (mouse-drag-track): Remove left-over debugging code. 9 * mouse.el (mouse-drag-track): Remove left-over debugging code.
diff --git a/lisp/replace.el b/lisp/replace.el
index ceb0fe4a63e..17eea19edd8 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -1135,12 +1135,32 @@ which means to discard all text properties."
1135 :group 'matching 1135 :group 'matching
1136 :version "22.1") 1136 :version "22.1")
1137 1137
1138(defvar occur-read-regexp-defaults-function
1139 'occur-read-regexp-defaults
1140 "Function that provides default regexp(s) for occur commands.
1141This function should take no arguments and return one of nil, a
1142regexp or a list of regexps for use with occur commands -
1143`occur', `multi-occur' and `multi-occur-in-matching-buffers'.
1144The return value of this function is used as DEFAULTS param of
1145`read-regexp' while executing the occur command. This function
1146is called only during interactive use.
1147
1148For example, to check for occurrence of symbol at point use
1149
1150 \(setq occur-read-regexp-defaults-function
1151 'find-tag-default-as-regexp\).")
1152
1153(defun occur-read-regexp-defaults ()
1154 "Return the latest regexp from `regexp-history'.
1155See `occur-read-regexp-defaults-function' for details."
1156 (car regexp-history))
1157
1138(defun occur-read-primary-args () 1158(defun occur-read-primary-args ()
1139 (let* ((perform-collect (consp current-prefix-arg)) 1159 (let* ((perform-collect (consp current-prefix-arg))
1140 (regexp (read-regexp (if perform-collect 1160 (regexp (read-regexp (if perform-collect
1141 "Collect strings matching regexp" 1161 "Collect strings matching regexp"
1142 "List lines matching regexp") 1162 "List lines matching regexp")
1143 (car regexp-history)))) 1163 (funcall occur-read-regexp-defaults-function))))
1144 (list regexp 1164 (list regexp
1145 (if perform-collect 1165 (if perform-collect
1146 ;; Perform collect operation 1166 ;; Perform collect operation