diff options
| author | Tom Tromey <tromey@redhat.com> | 2013-03-17 05:17:24 -0600 |
|---|---|---|
| committer | Tom Tromey <tromey@redhat.com> | 2013-03-17 05:17:24 -0600 |
| commit | 6bd488cd8d05aa3983ca55f70ee384732d8c0085 (patch) | |
| tree | 5645fc7b882638d6c0eb3f61fd55bde1a63fc190 /lisp/replace.el | |
| parent | 71f91792e3013b397996905224f387da5cc539a9 (diff) | |
| parent | 9c44569ea2a18099307e0571d523d8637000a153 (diff) | |
| download | emacs-6bd488cd8d05aa3983ca55f70ee384732d8c0085.tar.gz | |
merge from trunk
Diffstat (limited to 'lisp/replace.el')
| -rw-r--r-- | lisp/replace.el | 22 |
1 files changed, 21 insertions, 1 deletions
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." :group 'matching :version "22.1") +(defvar occur-read-regexp-defaults-function + 'occur-read-regexp-defaults + "Function that provides default regexp(s) for occur commands. +This function should take no arguments and return one of nil, a +regexp or a list of regexps for use with occur commands - +`occur', `multi-occur' and `multi-occur-in-matching-buffers'. +The return value of this function is used as DEFAULTS param of +`read-regexp' while executing the occur command. This function +is called only during interactive use. + +For example, to check for occurrence of symbol at point use + + \(setq occur-read-regexp-defaults-function + 'find-tag-default-as-regexp\).") + +(defun occur-read-regexp-defaults () + "Return the latest regexp from `regexp-history'. +See `occur-read-regexp-defaults-function' for details." + (car regexp-history)) + (defun occur-read-primary-args () (let* ((perform-collect (consp current-prefix-arg)) (regexp (read-regexp (if perform-collect "Collect strings matching regexp" "List lines matching regexp") - (car regexp-history)))) + (funcall occur-read-regexp-defaults-function)))) (list regexp (if perform-collect ;; Perform collect operation |
