changeset 95603:e9435fc29a56

(longlines-re-search-forward): New function. (longlines-mode): Bind replace-search-function and replace-re-search-function, to ensure that replacement commands treat newlines as spaces.
author Chong Yidong <cyd@stupidchicken.com>
date Fri, 06 Jun 2008 20:31:10 +0000
parents 12be2f7984b9
children 664723b81c00
files lisp/longlines.el
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/longlines.el	Fri Jun 06 20:30:54 2008 +0000
+++ b/lisp/longlines.el	Fri Jun 06 20:31:10 2008 +0000
@@ -119,6 +119,10 @@
         (make-local-variable 'longlines-auto-wrap)
 	(set (make-local-variable 'isearch-search-fun-function)
 	     'longlines-search-function)
+	(set (make-local-variable 'replace-search-function)
+	     'longlines-search-forward)
+	(set (make-local-variable 'replace-re-search-function)
+	     'longlines-re-search-forward)
         (add-to-list 'buffer-substring-filters 'longlines-encode-string)
         (when longlines-wrap-follows-window-size
 	  (let ((dw (if (and (integerp longlines-wrap-follows-window-size)
@@ -191,6 +195,8 @@
     (when longlines-wrap-follows-window-size
       (kill-local-variable 'fill-column))
     (kill-local-variable 'isearch-search-fun-function)
+    (kill-local-variable 'replace-search-function)
+    (kill-local-variable 'replace-re-search-function)
     (kill-local-variable 'require-final-newline)
     (kill-local-variable 'buffer-substring-filters)
     (kill-local-variable 'use-hard-newlines)))
@@ -465,6 +471,10 @@
   (let ((search-spaces-regexp "[ \n]+"))
     (re-search-backward (regexp-quote string) bound noerror count)))
 
+(defun longlines-re-search-forward (string &optional bound noerror count)
+  (let ((search-spaces-regexp "[ \n]"))
+    (re-search-forward string bound noerror count)))
+
 ;; Loading and saving
 
 (defun longlines-before-revert-hook ()