changeset 66088:b63142efae15

* longlines.el (longlinges-search-function) (longlines-search-forward, longlines-search-backward): New functions. (longlines-mode): Set isearch-search-fun-function to longlinges-search-function.
author Chong Yidong <cyd@stupidchicken.com>
date Fri, 14 Oct 2005 19:56:38 +0000
parents 88d998016498
children 9e3c435d42e0
files lisp/ChangeLog lisp/longlines.el
diffstat 2 files changed, 30 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Fri Oct 14 17:15:40 2005 +0000
+++ b/lisp/ChangeLog	Fri Oct 14 19:56:38 2005 +0000
@@ -1,5 +1,11 @@
 2005-10-14  Chong Yidong  <cyd@stupidchicken.com>
 
+	* longlines.el (longlinges-search-function)
+	(longlines-search-forward, longlines-search-backward): New
+	functions.
+	(longlines-mode): Set isearch-search-fun-function to
+	longlinges-search-function.
+
 	* mouse.el (mouse-drag-region-1): Handle the case where a
 	double-click event is bound to an arbitrary function.
 
--- a/lisp/longlines.el	Fri Oct 14 17:15:40 2005 +0000
+++ b/lisp/longlines.el	Fri Oct 14 19:56:38 2005 +0000
@@ -109,6 +109,8 @@
         (add-to-list 'buffer-file-format 'longlines)
         (add-hook 'change-major-mode-hook 'longlines-mode-off nil t)
         (make-local-variable 'buffer-substring-filters)
+	(set (make-local-variable 'isearch-search-fun-function)
+	     'longlinges-search-function)
         (add-to-list 'buffer-substring-filters 'longlines-encode-string)
         (when longlines-wrap-follows-window-size
           (set (make-local-variable 'fill-column)
@@ -148,6 +150,7 @@
                  'longlines-window-change-function t)
     (when longlines-wrap-follows-window-size
       (kill-local-variable 'fill-column))
+    (kill-local-variable 'isearch-search-fun-function)
     (kill-local-variable 'require-final-newline)
     (kill-local-variable 'buffer-substring-filters)
     (kill-local-variable 'use-hard-newlines)))
@@ -381,6 +384,27 @@
       (longlines-wrap-region (point-min) (point-max))
       (set-buffer-modified-p mod))))
 
+;; Isearch
+
+(defun longlinges-search-function ()
+  (cond
+   (isearch-word
+    (if isearch-forward 'word-search-forward 'word-search-backward))
+   (isearch-regexp
+    (if isearch-forward 're-search-forward 're-search-backward))
+   (t
+    (if isearch-forward
+	'longlines-search-forward
+      'longlines-search-backward))))
+
+(defun longlines-search-forward (string &optional bound noerror count)
+  (let ((search-spaces-regexp "[ \n]"))
+    (re-search-forward (regexp-quote string) bound noerror count)))
+
+(defun longlines-search-backward (string &optional bound noerror count)
+  (let ((search-spaces-regexp "[ \n]"))
+    (re-search-backward (regexp-quote string) bound noerror count)))
+
 ;; Loading and saving
 
 (add-to-list