[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r111989: Provide for customizing defa
From: |
Jambunathan K |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r111989: Provide for customizing default regexp in occur commands (Bug#13892). |
Date: |
Sun, 10 Mar 2013 14:14:07 +0530 |
User-agent: |
Bazaar (2.5.0) |
------------------------------------------------------------
revno: 111989
committer: Jambunathan K <address@hidden>
branch nick: trunk
timestamp: Sun 2013-03-10 14:14:07 +0530
message:
Provide for customizing default regexp in occur commands (Bug#13892).
* lisp/replace.el (occur-read-regexp-defaults-function): New var.
(occur-read-regexp-defaults): New defun.
(occur-read-primary-args): Propagate above change.
modified:
lisp/ChangeLog
lisp/replace.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2013-03-09 17:14:24 +0000
+++ b/lisp/ChangeLog 2013-03-10 08:44:07 +0000
@@ -1,3 +1,9 @@
+2013-03-10 Jambunathan K <address@hidden>
+
+ * replace.el (occur-read-regexp-defaults-function): New var.
+ (occur-read-regexp-defaults): New defun.
+ (occur-read-primary-args): Propagate above change (bug#13892).
+
2013-03-09 Stefan Monnier <address@hidden>
* mouse.el (mouse-drag-track): Remove left-over debugging code.
=== modified file 'lisp/replace.el'
--- a/lisp/replace.el 2013-03-08 04:18:16 +0000
+++ b/lisp/replace.el 2013-03-10 08:44:07 +0000
@@ -1135,12 +1135,32 @@
: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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r111989: Provide for customizing default regexp in occur commands (Bug#13892).,
Jambunathan K <=