# HG changeset patch # User Chong Yidong # Date 1212784270 0 # Node ID e9435fc29a561a6a0f2df288762d8b31061b3a60 # Parent 12be2f7984b934919fd58b901d1bfdb82a63ecad (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. diff -r 12be2f7984b9 -r e9435fc29a56 lisp/longlines.el --- 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 ()