emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r112746: * lisp/isearch.el (isearch-f


From: Juri Linkov
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r112746: * lisp/isearch.el (isearch-filter-predicates): Rename from `isearch-filter-predicate'.
Date: Tue, 28 May 2013 01:42:11 +0300
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 112746
fixes bug: http://debbugs.gnu.org/11378
committer: Juri Linkov <address@hidden>
branch nick: trunk
timestamp: Tue 2013-05-28 01:42:11 +0300
message:
  * lisp/isearch.el (isearch-filter-predicates): Rename from 
`isearch-filter-predicate'.
  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'.
modified:
  etc/NEWS
  lisp/ChangeLog
  lisp/dired-aux.el
  lisp/dired.el
  lisp/info.el
  lisp/isearch.el
  lisp/wdired.el
=== modified file 'etc/NEWS'
--- a/etc/NEWS  2013-05-24 18:39:21 +0000
+++ b/etc/NEWS  2013-05-27 22:42:11 +0000
@@ -384,6 +384,8 @@
 *** `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:

=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-05-27 16:12:52 +0000
+++ b/lisp/ChangeLog    2013-05-27 22:42:11 +0000
@@ -1,3 +1,40 @@
+2013-05-27  Juri Linkov  <address@hidden>
+
+       * 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  <address@hidden>
 
        * emacs-lisp/easy-mmode.el (define-minor-mode):

=== modified file 'lisp/dired-aux.el'
--- a/lisp/dired-aux.el 2013-02-28 21:51:11 +0000
+++ b/lisp/dired-aux.el 2013-05-27 22:42:11 +0000
@@ -2491,18 +2491,16 @@
   :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))
 
@@ -2513,29 +2511,27 @@
   (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 ()

=== modified file 'lisp/dired.el'
--- a/lisp/dired.el     2013-02-28 21:51:11 +0000
+++ b/lisp/dired.el     2013-05-27 22:42:11 +0000
@@ -3864,7 +3864,7 @@
 ;;;;;;  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" "\

=== modified file 'lisp/info.el'
--- a/lisp/info.el      2013-05-22 03:13:56 +0000
+++ b/lisp/info.el      2013-05-27 22:42:11 +0000
@@ -1931,7 +1931,8 @@
                              (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)
@@ -2009,7 +2010,8 @@
                (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)
@@ -4275,8 +4277,8 @@
        '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)

=== modified file 'lisp/isearch.el'
--- a/lisp/isearch.el   2013-05-15 23:21:01 +0000
+++ b/lisp/isearch.el   2013-05-27 22:42:11 +0000
@@ -187,12 +187,21 @@
   "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.
 
@@ -2491,6 +2500,13 @@
                              (< (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))
@@ -2622,10 +2638,7 @@
       (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))
@@ -2638,8 +2651,15 @@
          (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
@@ -2816,6 +2836,7 @@
 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")
 
 
 ;; General utilities
@@ -3041,8 +3062,11 @@
          (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)))

=== modified file 'lisp/wdired.el'
--- a/lisp/wdired.el    2013-03-05 17:13:01 +0000
+++ b/lisp/wdired.el    2013-05-27 22:42:11 +0000
@@ -239,8 +239,7 @@
        (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)
@@ -268,9 +267,8 @@
 
 (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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]