summaryrefslogtreecommitdiff
path: root/lisp/longlines.el
diff options
context:
space:
mode:
authorChong Yidong <cyd@stupidchicken.com>2005-10-14 19:56:38 +0000
committerChong Yidong <cyd@stupidchicken.com>2005-10-14 19:56:38 +0000
commit930aae96d075460db9ca001a6f9d596074219122 (patch)
treeb87af9a5415540a69bfbc4c5c07489b8d8eb0cf2 /lisp/longlines.el
parentdeceef674f7f343d52c21095605bf55dc5822835 (diff)
downloademacs-930aae96d075460db9ca001a6f9d596074219122.tar.gz
* longlines.el (longlinges-search-function)
(longlines-search-forward, longlines-search-backward): New functions. (longlines-mode): Set isearch-search-fun-function to longlinges-search-function.
Diffstat (limited to 'lisp/longlines.el')
-rw-r--r--lisp/longlines.el24
1 files changed, 24 insertions, 0 deletions
diff --git a/lisp/longlines.el b/lisp/longlines.el
index 6ce5dfaebc4..9665931e046 100644
--- a/lisp/longlines.el
+++ b/lisp/longlines.el
@@ -109,6 +109,8 @@ are indicated with a symbol."
(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 @@ are indicated with a symbol."
'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 @@ This is called by `window-size-change-functions'."
(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