diff options
| author | Juri Linkov | 2008-07-31 16:50:54 +0000 |
|---|---|---|
| committer | Juri Linkov | 2008-07-31 16:50:54 +0000 |
| commit | f1056735c790bcb73876916d9666b6044888e604 (patch) | |
| tree | c9717370f655d64a3a812cfc8c3fe57dfcd509a2 | |
| parent | 0467478ba85b74b761bd1674aa59fbbb471686bc (diff) | |
| download | emacs-f1056735c790bcb73876916d9666b6044888e604.tar.gz emacs-f1056735c790bcb73876916d9666b6044888e604.zip | |
(dired-isearch-filenames-toggle): New command.
(dired-isearch-filenames-setup): Bind "\M-sf" to
dired-isearch-filenames-toggle in isearch-mode-map.
(dired-isearch-filenames-end): Bind "\M-sf" to nil
in isearch-mode-map.
| -rw-r--r-- | lisp/dired-aux.el | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index 5feed9b2191..a55b0a70fbc 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el | |||
| @@ -2308,11 +2308,26 @@ Use \\[dired-hide-subdir] to (un)hide a particular subdirectory." | |||
| 2308 | 2308 | ||
| 2309 | (defvar dired-isearch-orig-success-function nil) | 2309 | (defvar dired-isearch-orig-success-function nil) |
| 2310 | 2310 | ||
| 2311 | (defun dired-isearch-filenames-toggle () | ||
| 2312 | "Toggle file names searching on or off. | ||
| 2313 | When on, Isearch checks the success of the current matching point | ||
| 2314 | using the function `dired-isearch-success-function' that matches only | ||
| 2315 | at file names. When off, it uses the default function | ||
| 2316 | `isearch-success-function-default'." | ||
| 2317 | (interactive) | ||
| 2318 | (setq isearch-success-function | ||
| 2319 | (if (eq isearch-success-function 'dired-isearch-success-function) | ||
| 2320 | 'isearch-success-function-default | ||
| 2321 | 'dired-isearch-success-function)) | ||
| 2322 | (setq isearch-success t isearch-adjusted t) | ||
| 2323 | (isearch-update)) | ||
| 2324 | |||
| 2311 | ;;;###autoload | 2325 | ;;;###autoload |
| 2312 | (defun dired-isearch-filenames-setup () | 2326 | (defun dired-isearch-filenames-setup () |
| 2313 | "Set up isearch to search in Dired file names. | 2327 | "Set up isearch to search in Dired file names. |
| 2314 | Intended to be added to `isearch-mode-hook'." | 2328 | Intended to be added to `isearch-mode-hook'." |
| 2315 | (when dired-isearch-filenames | 2329 | (when dired-isearch-filenames |
| 2330 | (define-key isearch-mode-map "\M-sf" 'dired-isearch-filenames-toggle) | ||
| 2316 | (setq dired-isearch-orig-success-function | 2331 | (setq dired-isearch-orig-success-function |
| 2317 | (default-value 'isearch-success-function)) | 2332 | (default-value 'isearch-success-function)) |
| 2318 | (setq-default isearch-success-function 'dired-isearch-success-function) | 2333 | (setq-default isearch-success-function 'dired-isearch-success-function) |
| @@ -2320,6 +2335,7 @@ Intended to be added to `isearch-mode-hook'." | |||
| 2320 | 2335 | ||
| 2321 | (defun dired-isearch-filenames-end () | 2336 | (defun dired-isearch-filenames-end () |
| 2322 | "Clean up the Dired file name search after terminating isearch." | 2337 | "Clean up the Dired file name search after terminating isearch." |
| 2338 | (define-key isearch-mode-map "\M-sf" nil) | ||
| 2323 | (setq-default isearch-success-function dired-isearch-orig-success-function) | 2339 | (setq-default isearch-success-function dired-isearch-orig-success-function) |
| 2324 | (remove-hook 'isearch-mode-end-hook 'dired-isearch-filenames-end t)) | 2340 | (remove-hook 'isearch-mode-end-hook 'dired-isearch-filenames-end t)) |
| 2325 | 2341 | ||