]> code.delx.au - gnu-emacs/blobdiff - lisp/isearch.el
Merge branch 'master' into cairo
[gnu-emacs] / lisp / isearch.el
index 191ec8270eb6e7bca6dcdadfd5c298aa1b0e136a..dc10502309f10b808d1262863b440cefeb9abad7 100644 (file)
@@ -452,7 +452,7 @@ This is like `describe-bindings', but displays only Isearch keys."
     (define-key map "\M-\C-s" 'isearch-repeat-forward)
     (define-key map "\M-\C-r" 'isearch-repeat-backward)
     (define-key map "\177" 'isearch-delete-char)
-    (define-key map [backspace] 'isearch-delete-char)
+    (define-key map [backspace] 'undefined) ;bug#20466.
     (define-key map "\C-g" 'isearch-abort)
 
     ;; This assumes \e is the meta-prefix-char.
@@ -578,7 +578,7 @@ variable by the command `isearch-toggle-lax-whitespace'.")
   "Stack of search status elements.
 Each element is an `isearch--state' struct where the slots are
  [STRING MESSAGE POINT SUCCESS FORWARD OTHER-END WORD
-  INVALID-REGEXP WRAPPED BARRIER WITHIN-BRACKETS CASE-FOLD-SEARCH]")
+  ERROR WRAPPED BARRIER CASE-FOLD-SEARCH]")
 
 (defvar isearch-string "")  ; The current search string.
 (defvar isearch-message "") ; text-char-description version of isearch-string
@@ -657,8 +657,7 @@ Each element is an `isearch--state' struct where the slots are
     (nconc minor-mode-alist
           (list '(isearch-mode isearch-mode))))
 
-(defvar isearch-mode nil) ;; Name of the minor mode, if non-nil.
-(make-variable-buffer-local 'isearch-mode)
+(defvar-local isearch-mode nil) ;; Name of the minor mode, if non-nil.
 
 (define-key global-map "\C-s" 'isearch-forward)
 (define-key esc-map "\C-s" 'isearch-forward-regexp)
@@ -826,6 +825,7 @@ See the command `isearch-forward-symbol' for more information."
       (isearch-update)))))
 
 \f
+(defvar cursor-sensor-inhibit)
 ;; isearch-mode only sets up incremental search for the minor mode.
 ;; All the work is done by the isearch-mode commands.
 
@@ -932,6 +932,12 @@ convert the search string to a regexp used by regexp search functions."
   (add-hook 'post-command-hook 'isearch-post-command-hook)
   (add-hook 'mouse-leave-buffer-hook 'isearch-done)
   (add-hook 'kbd-macro-termination-hook 'isearch-done)
+  (make-local-variable 'cursor-sensor-inhibit)
+  (unless (boundp 'cursor-sensor-inhibit)
+    (setq cursor-sensor-inhibit nil))
+  ;; Suspend things like cursor-intangible during Isearch so we can search even
+  ;; within intangible text.
+  (push 'isearch cursor-sensor-inhibit)
 
   ;; isearch-mode can be made modal (in the sense of not returning to
   ;; the calling function until searching is completed) by entering
@@ -1020,6 +1026,7 @@ NOPUSH is t and EDIT is t."
   (remove-hook 'mouse-leave-buffer-hook 'isearch-done)
   (remove-hook 'kbd-macro-termination-hook 'isearch-done)
   (setq isearch-lazy-highlight-start nil)
+  (setq cursor-sensor-inhibit (delq 'isearch cursor-sensor-inhibit))
 
   ;; Called by all commands that terminate isearch-mode.
   ;; If NOPUSH is non-nil, we don't push the string on the search ring.
@@ -1917,8 +1924,8 @@ If search string is empty, just beep."
 (defun isearch-yank-x-selection ()
   "Pull current X selection into search string."
   (interactive)
-  (isearch-yank-string (x-get-selection))
-  ;; If `x-get-selection' returned the text from the active region,
+  (isearch-yank-string (gui-get-selection))
+  ;; If `gui-get-selection' returned the text from the active region,
   ;; then it "used" the mark which we should hence deactivate.
   (when select-active-regions (deactivate-mark)))
 
@@ -2349,6 +2356,8 @@ With argument, add COUNT copies of the character."
       (isearch-process-search-char char count))))
 
 (defun isearch-process-search-char (char &optional count)
+  "Add CHAR to the search string, COUNT times.
+Search is updated accordingly."
   ;; * and ? are special in regexps when not preceded by \.
   ;; } and | are special in regexps when preceded by \.
   ;; Nothing special for + because it matches at least once.
@@ -2715,17 +2724,12 @@ update the match data, and return point."
       ;; isearch in their own way, they should set the
       ;; `isearch-open-invisible-temporary' to a function doing this.
       (funcall  (overlay-get ov 'isearch-open-invisible-temporary)  ov nil)
-    ;; Store the values for the `invisible' and `intangible'
-    ;; properties, and then set them to nil. This way the text hidden
-    ;; by this overlay becomes visible.
+    ;; Store the values for the `invisible' property, and then set it to nil.
+    ;; This way the text hidden by this overlay becomes visible.
 
-    ;; Do we really need to set the `intangible' property to t? Can we
-    ;; have the point inside an overlay with an `intangible' property?
     ;; In 19.34 this does not exist so I cannot test it.
     (overlay-put ov 'isearch-invisible (overlay-get ov 'invisible))
-    (overlay-put ov 'isearch-intangible (overlay-get ov 'intangible))
-    (overlay-put ov 'invisible nil)
-    (overlay-put ov 'intangible nil)))
+    (overlay-put ov 'invisible nil)))
 
 
 ;; This is called at the end of isearch.  It will open the overlays
@@ -2739,12 +2743,9 @@ update the match data, and return point."
        ;; this function, not by us tweaking the overlay properties.
        (fct-temp (overlay-get ov 'isearch-open-invisible-temporary)))
     (when (or inside-overlay (not fct-temp))
-      ;; restore the values for the `invisible' and `intangible'
-      ;; properties
+      ;; restore the values for the `invisible' properties.
       (overlay-put ov 'invisible (overlay-get ov 'isearch-invisible))
-      (overlay-put ov 'intangible (overlay-get ov 'isearch-intangible))
-      (overlay-put ov 'isearch-invisible nil)
-      (overlay-put ov 'isearch-intangible nil))
+      (overlay-put ov 'isearch-invisible nil))
     (if inside-overlay
        (funcall (overlay-get ov 'isearch-open-invisible)  ov)
       (if fct-temp
@@ -2782,9 +2783,7 @@ update the match data, and return point."
              ;; properties.
              (funcall fct-temp ov t)
            (overlay-put ov 'invisible (overlay-get ov 'isearch-invisible))
-           (overlay-put ov 'intangible (overlay-get ov 'isearch-intangible))
-           (overlay-put ov 'isearch-invisible nil)
-           (overlay-put ov 'isearch-intangible nil)))))))
+           (overlay-put ov 'isearch-invisible nil)))))))
 
 
 (defun isearch-range-invisible (beg end)