Doc fix.
(isearch-message-prefix): Display text from the property
`isearch-message-prefix' of the currently active filters.
(isearch-search): Don't compare `isearch-filter-predicate' with
`isearch-filter-visible'. Call `run-hook-with-args-until-failure'
on `isearch-filter-predicates'. Also check `search-invisible' for t
or call `isearch-range-invisible'.
(isearch-filter-visible): Make obsolete.
(isearch-lazy-highlight-search):
Call `run-hook-with-args-until-failure' on
`isearch-filter-predicates' and use `isearch-range-invisible'.
* lisp/info.el (Info-search): Call `run-hook-with-args-until-failure' on
`isearch-filter-predicates' instead of `funcall'ing
`isearch-filter-predicate'.
(Info-mode): Set `Info-isearch-filter' to
`isearch-filter-predicates' instead of `isearch-filter-predicate'.
* lisp/dired-aux.el (dired-isearch-filter-predicate-orig): Remove variable.
(dired-isearch-filenames-toggle, dired-isearch-filenames-setup)
(dired-isearch-filenames-end): Add and remove
`dired-isearch-filter-filenames' in `isearch-filter-predicates'
instead of changing the value of `isearch-filter-predicate'.
Rebind `dired-isearch-filenames-toggle' from "\M-sf" to "\M-sff".
(dired-isearch-filter-filenames): Don't use `isearch-filter-visible'.
Put property `isearch-message-prefix' to "filename " on
`dired-isearch-filter-filenames'.
* lisp/wdired.el (wdired-change-to-wdired-mode):
Add `isearch-filter-predicates' to `wdired-isearch-filter-read-only'
locally instead of changing `isearch-filter-predicate'.
(wdired-isearch-filter-read-only): Don't use `isearch-filter-visible'.
Fixes: debbugs:11378
*** `lisp-complete-symbol'
*** `field-complete'
*** `minibuffer-completion-contents'
+*** `isearch-nonincremental-exit-minibuffer'
+*** `isearch-filter-visible'
** `with-wrapper-hook' is obsoleted by `add-function'.
The few hooks that used with-wrapper-hook are replaced as follows:
+2013-05-27 Juri Linkov <juri@jurta.org>
+
+ * isearch.el (isearch-filter-predicates): Rename from
+ `isearch-filter-predicate'. Doc fix. (Bug#11378)
+ (isearch-message-prefix): Display text from the property
+ `isearch-message-prefix' of the currently active filters.
+ (isearch-search): Don't compare `isearch-filter-predicate' with
+ `isearch-filter-visible'. Call `run-hook-with-args-until-failure'
+ on `isearch-filter-predicates'. Also check `search-invisible' for t
+ or call `isearch-range-invisible'.
+ (isearch-filter-visible): Make obsolete.
+ (isearch-lazy-highlight-search):
+ Call `run-hook-with-args-until-failure' on
+ `isearch-filter-predicates' and use `isearch-range-invisible'.
+
+ * info.el (Info-search): Call `run-hook-with-args-until-failure' on
+ `isearch-filter-predicates' instead of `funcall'ing
+ `isearch-filter-predicate'.
+ (Info-mode): Set `Info-isearch-filter' to
+ `isearch-filter-predicates' instead of `isearch-filter-predicate'.
+
+ * dired-aux.el (dired-isearch-filter-predicate-orig):
+ Remove variable.
+ (dired-isearch-filenames-toggle, dired-isearch-filenames-setup)
+ (dired-isearch-filenames-end): Add and remove
+ `dired-isearch-filter-filenames' in `isearch-filter-predicates'
+ instead of changing the value of `isearch-filter-predicate'.
+ Rebind `dired-isearch-filenames-toggle' from "\M-sf" to "\M-sff".
+ (dired-isearch-filter-filenames): Don't use `isearch-filter-visible'.
+ Put property `isearch-message-prefix' to "filename " on
+ `dired-isearch-filter-filenames'.
+
+ * wdired.el (wdired-change-to-wdired-mode):
+ Add `isearch-filter-predicates' to `wdired-isearch-filter-read-only'
+ locally instead of changing `isearch-filter-predicate'.
+ (wdired-isearch-filter-read-only): Don't use `isearch-filter-visible'.
+
2013-05-27 Stefan Monnier <monnier@iro.umontreal.ca>
* emacs-lisp/easy-mmode.el (define-minor-mode):
:group 'dired
:version "23.1")
-(defvar dired-isearch-filter-predicate-orig nil)
-
(defun dired-isearch-filenames-toggle ()
"Toggle file names searching on or off.
When on, Isearch skips matches outside file names using the predicate
`dired-isearch-filter-filenames' that matches only at file names.
When off, it uses the original predicate."
(interactive)
- (setq isearch-filter-predicate
- (if (eq isearch-filter-predicate 'dired-isearch-filter-filenames)
- dired-isearch-filter-predicate-orig
- 'dired-isearch-filter-filenames))
+ (setq isearch-filter-predicates
+ (if (memq 'dired-isearch-filter-filenames isearch-filter-predicates)
+ (delq 'dired-isearch-filter-filenames isearch-filter-predicates)
+ (cons 'dired-isearch-filter-filenames isearch-filter-predicates)))
(setq isearch-success t isearch-adjusted t)
(isearch-update))
(when (or (eq dired-isearch-filenames t)
(and (eq dired-isearch-filenames 'dwim)
(get-text-property (point) 'dired-filename)))
- (setq isearch-message-prefix-add "filename ")
- (define-key isearch-mode-map "\M-sf" 'dired-isearch-filenames-toggle)
- (setq dired-isearch-filter-predicate-orig
- (default-value 'isearch-filter-predicate))
- (setq-default isearch-filter-predicate 'dired-isearch-filter-filenames)
+ (define-key isearch-mode-map "\M-sff" 'dired-isearch-filenames-toggle)
+ (add-hook 'isearch-filter-predicates 'dired-isearch-filter-filenames nil t)
(add-hook 'isearch-mode-end-hook 'dired-isearch-filenames-end nil t)))
(defun dired-isearch-filenames-end ()
"Clean up the Dired file name search after terminating isearch."
(setq isearch-message-prefix-add nil)
- (define-key isearch-mode-map "\M-sf" nil)
- (setq-default isearch-filter-predicate dired-isearch-filter-predicate-orig)
+ (define-key isearch-mode-map "\M-sff" nil)
+ (remove-hook 'isearch-filter-predicates 'dired-isearch-filter-filenames t)
(remove-hook 'isearch-mode-end-hook 'dired-isearch-filenames-end t))
(defun dired-isearch-filter-filenames (beg end)
- "Test whether the current search hit is a visible file name.
+ "Test whether the current search hit is a file name.
Return non-nil if the text from BEG to END is part of a file
-name (has the text property `dired-filename') and is visible."
- (and (isearch-filter-visible beg end)
- (if dired-isearch-filenames
- (text-property-not-all (min beg end) (max beg end)
- 'dired-filename nil)
- t)))
+name (has the text property `dired-filename')."
+ (if dired-isearch-filenames
+ (text-property-not-all (min beg end) (max beg end)
+ 'dired-filename nil)
+ t))
+
+(put 'dired-isearch-filter-filenames 'isearch-message-prefix "filename ")
;;;###autoload
(defun dired-isearch-filenames ()
;;;;;; dired-run-shell-command dired-do-shell-command dired-do-async-shell-command
;;;;;; dired-clean-directory dired-do-print dired-do-touch dired-do-chown
;;;;;; dired-do-chgrp dired-do-chmod dired-compare-directories dired-backup-diff
-;;;;;; dired-diff) "dired-aux" "dired-aux.el" "d6a694b6d13fa948465fde52a9ffb3ba")
+;;;;;; dired-diff) "dired-aux" "dired-aux.el" "8f5af3aa4eee1b3448525896fa6f39a3")
;;; Generated autoloads from dired-aux.el
(autoload 'dired-diff "dired-aux" "\
(point-max)))
(while (and (not give-up)
(or (null found)
- (not (funcall isearch-filter-predicate beg-found found))))
+ (not (run-hook-with-args-until-failure
+ 'isearch-filter-predicates beg-found found))))
(let ((search-spaces-regexp Info-search-whitespace-regexp))
(if (if backward
(re-search-backward regexp bound t)
(setq give-up nil found nil)
(while (and (not give-up)
(or (null found)
- (not (funcall isearch-filter-predicate beg-found found))))
+ (not (run-hook-with-args-until-failure
+ 'isearch-filter-predicates beg-found found))))
(let ((search-spaces-regexp Info-search-whitespace-regexp))
(if (if backward
(re-search-backward regexp nil t)
'Info-isearch-wrap)
(set (make-local-variable 'isearch-push-state-function)
'Info-isearch-push-state)
- (set (make-local-variable 'isearch-filter-predicate)
- 'Info-isearch-filter)
+ (set (make-local-variable 'isearch-filter-predicates)
+ '(Info-isearch-filter))
(set (make-local-variable 'revert-buffer-function)
'Info-revert-buffer-function)
(Info-set-mode-line)
"Function to save a function restoring the mode-specific Isearch state
to the search status stack.")
-(defvar isearch-filter-predicate 'isearch-filter-visible
- "Predicate that filters the search hits that would normally be available.
-Search hits that dissatisfy the predicate are skipped. The function
-has two arguments: the positions of start and end of text matched by
-the search. If this function returns nil, continue searching without
-stopping at this match.")
+(defvar isearch-filter-predicates nil
+ "Predicates that filter the search hits that would normally be available.
+Search hits that dissatisfy the list of predicates are skipped.
+Each function in this list has two arguments: the positions of
+start and end of text matched by the search.
+The search loop uses `run-hook-with-args-until-failure' to call
+each predicate in order, and when one of the predicates returns nil,
+skips this match and continues searching for the next match.
+When the list of predicates is empty, `run-hook-with-args-until-failure'
+returns non-nil that means that the found match is accepted.
+The property `isearch-message-prefix' put on the predicate's symbol
+specifies the prefix string displyed in the search message.")
+(define-obsolete-variable-alias 'isearch-filter-predicate
+ 'isearch-filter-predicates
+ "24.4")
;; Search ring.
(< (point) isearch-opoint)))
"over")
(if isearch-wrapped "wrapped ")
+ (mapconcat (lambda (s)
+ (and (symbolp s)
+ (get s 'isearch-message-prefix)))
+ (if (consp isearch-filter-predicates)
+ isearch-filter-predicates
+ (list isearch-filter-predicates))
+ "")
(if isearch-word
(or (and (symbolp isearch-word)
(get isearch-word 'isearch-message-prefix))
(setq isearch-case-fold-search
(isearch-no-upper-case-p isearch-string isearch-regexp)))
(condition-case lossage
- (let ((inhibit-point-motion-hooks
- ;; FIXME: equality comparisons on functions is asking for trouble.
- (and (eq isearch-filter-predicate 'isearch-filter-visible)
- search-invisible))
+ (let ((inhibit-point-motion-hooks search-invisible)
(inhibit-quit nil)
(case-fold-search isearch-case-fold-search)
(retry t))
(if (or (not isearch-success)
(bobp) (eobp)
(= (match-beginning 0) (match-end 0))
- (funcall isearch-filter-predicate
- (match-beginning 0) (match-end 0)))
+ ;; When one of filter predicates returns nil,
+ ;; retry the search. Otherwise, act according
+ ;; to search-invisible (open overlays, etc.)
+ (and (run-hook-with-args-until-failure
+ 'isearch-filter-predicates
+ (match-beginning 0) (match-end 0))
+ (or (eq search-invisible t)
+ (not (isearch-range-invisible
+ (match-beginning 0) (match-end 0))))))
(setq retry nil)))
(setq isearch-just-started nil)
(if isearch-success
searched too when `search-invisible' is t."
(or (eq search-invisible t)
(not (isearch-range-invisible beg end))))
+(make-obsolete 'isearch-filter-visible 'search-invisible "24.4")
\f
;; General utilities
(if (or (not success)
(= (point) bound) ; like (bobp) (eobp) in `isearch-search'.
(= (match-beginning 0) (match-end 0))
- (funcall isearch-filter-predicate
- (match-beginning 0) (match-end 0)))
+ (and (run-hook-with-args-until-failure
+ 'isearch-filter-predicates
+ (match-beginning 0) (match-end 0))
+ (not (isearch-range-invisible
+ (match-beginning 0) (match-end 0)))))
(setq retry nil)))
success)
(error nil)))
(dired-remember-marks (point-min) (point-max)))
(set (make-local-variable 'wdired-old-point) (point))
(set (make-local-variable 'query-replace-skip-read-only) t)
- (set (make-local-variable 'isearch-filter-predicate)
- 'wdired-isearch-filter-read-only)
+ (add-hook 'isearch-filter-predicates 'wdired-isearch-filter-read-only nil t)
(use-local-map wdired-mode-map)
(force-mode-line-update)
(setq buffer-read-only nil)
(defun wdired-isearch-filter-read-only (beg end)
"Skip matches that have a read-only property."
- (and (isearch-filter-visible beg end)
- (not (text-property-not-all (min beg end) (max beg end)
- 'read-only nil))))
+ (not (text-property-not-all (min beg end) (max beg end)
+ 'read-only nil)))
;; Protect the buffer so only the filenames can be changed, and put
;; properties so filenames (old and new) can be easily found.