aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorJuri Linkov2008-11-22 20:40:28 +0000
committerJuri Linkov2008-11-22 20:40:28 +0000
commitb9d9c1596ed4e0b8721d93b2af58a69a9a8fa018 (patch)
treec8e2832aa5b263f100da83a6085f8e3742cffcf1 /lisp
parente1b867a0bc762a356697bdf69df5106dc3759d26 (diff)
downloademacs-b9d9c1596ed4e0b8721d93b2af58a69a9a8fa018.tar.gz
emacs-b9d9c1596ed4e0b8721d93b2af58a69a9a8fa018.zip
(dired-isearch-filenames): Add new context-dependent
option `dwim'. Change non-dwim option from `dired-filename' to `t'. Doc fix. (dired-isearch-filenames-setup): Run filename Isearch only when dired-isearch-filenames is t or dired-isearch-filenames is `dwim' and the text property `dired-filename' at point is non-nil. In this case also set isearch-message-prefix-add to "filename ". (dired-isearch-filenames-end): Set isearch-message-prefix-add to nil. (dired-isearch-filenames, dired-isearch-filenames-regexp): Don't let-bind isearch-message-prefix-add since this is done now in dired-isearch-filenames-setup.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/dired-aux.el20
1 files changed, 13 insertions, 7 deletions
diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index 1df5dc82dcf..358e852c3ae 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -2304,9 +2304,13 @@ Use \\[dired-hide-subdir] to (un)hide a particular subdirectory."
2304;; Search only in file names in the Dired buffer. 2304;; Search only in file names in the Dired buffer.
2305 2305
2306(defcustom dired-isearch-filenames nil 2306(defcustom dired-isearch-filenames nil
2307 "*If non-nil, Isearch in Dired matches only file names." 2307 "*Non-nil to Isearch in file names only.
2308If t, Isearch in Dired always matches only file names.
2309If `dwim', Isearch matches file names when initial point position is on
2310a file name. Otherwise, it searches the whole buffer without restrictions."
2308 :type '(choice (const :tag "No restrictions" nil) 2311 :type '(choice (const :tag "No restrictions" nil)
2309 (const :tag "Isearch only in file names" dired-filename)) 2312 (const :tag "When point is on a file name initially, search file names" dwim)
2313 (const :tag "Always search in file names" t))
2310 :group 'dired 2314 :group 'dired
2311 :version "23.1") 2315 :version "23.1")
2312 2316
@@ -2329,7 +2333,10 @@ When off, it uses the default predicate `isearch-filter-invisible'."
2329(defun dired-isearch-filenames-setup () 2333(defun dired-isearch-filenames-setup ()
2330 "Set up isearch to search in Dired file names. 2334 "Set up isearch to search in Dired file names.
2331Intended to be added to `isearch-mode-hook'." 2335Intended to be added to `isearch-mode-hook'."
2332 (when dired-isearch-filenames 2336 (when (or (eq dired-isearch-filenames t)
2337 (and (eq dired-isearch-filenames 'dwim)
2338 (get-text-property (point) 'dired-filename)))
2339 (setq isearch-message-prefix-add "filename ")
2333 (define-key isearch-mode-map "\M-sf" 'dired-isearch-filenames-toggle) 2340 (define-key isearch-mode-map "\M-sf" 'dired-isearch-filenames-toggle)
2334 (setq dired-isearch-filter-predicate-orig 2341 (setq dired-isearch-filter-predicate-orig
2335 (default-value 'isearch-filter-predicate)) 2342 (default-value 'isearch-filter-predicate))
@@ -2338,6 +2345,7 @@ Intended to be added to `isearch-mode-hook'."
2338 2345
2339(defun dired-isearch-filenames-end () 2346(defun dired-isearch-filenames-end ()
2340 "Clean up the Dired file name search after terminating isearch." 2347 "Clean up the Dired file name search after terminating isearch."
2348 (setq isearch-message-prefix-add nil)
2341 (define-key isearch-mode-map "\M-sf" nil) 2349 (define-key isearch-mode-map "\M-sf" nil)
2342 (setq-default isearch-filter-predicate dired-isearch-filter-predicate-orig) 2350 (setq-default isearch-filter-predicate dired-isearch-filter-predicate-orig)
2343 (remove-hook 'isearch-mode-end-hook 'dired-isearch-filenames-end t)) 2351 (remove-hook 'isearch-mode-end-hook 'dired-isearch-filenames-end t))
@@ -2354,16 +2362,14 @@ Intended to be added to `isearch-mode-hook'."
2354(defun dired-isearch-filenames () 2362(defun dired-isearch-filenames ()
2355 "Search for a string using Isearch only in file names in the Dired buffer." 2363 "Search for a string using Isearch only in file names in the Dired buffer."
2356 (interactive) 2364 (interactive)
2357 (let ((dired-isearch-filenames t) 2365 (let ((dired-isearch-filenames t))
2358 (isearch-message-prefix-add "filename "))
2359 (isearch-forward))) 2366 (isearch-forward)))
2360 2367
2361;;;###autoload 2368;;;###autoload
2362(defun dired-isearch-filenames-regexp () 2369(defun dired-isearch-filenames-regexp ()
2363 "Search for a regexp using Isearch only in file names in the Dired buffer." 2370 "Search for a regexp using Isearch only in file names in the Dired buffer."
2364 (interactive) 2371 (interactive)
2365 (let ((dired-isearch-filenames t) 2372 (let ((dired-isearch-filenames t))
2366 (isearch-message-prefix-add "filename "))
2367 (isearch-forward-regexp))) 2373 (isearch-forward-regexp)))
2368 2374
2369 2375