Commit 3c28248c authored by David Murray's avatar David Murray

Undo fundamental/basic breakage. Sorry. Also add

String Search, Reverse String Search, Word Search and
Reverse Word Search commands.
parent c59dfdb6
......@@ -745,6 +745,11 @@ containing WORD as a word or NIL if no such offset exists"
return i
finally (return nil))))
(defun search-word-backward (mark word)
(let ((offset (buffer-search-word-backward (buffer mark) (offset mark) word)))
(when offset
(setf (offset mark) offset))))
(defun buffer-search-word-forward (buffer offset word &key (test #'eql))
"Return the smallest offset of BUFFER >= OFFSET containing WORD as a
word or NIL if no such offset exists"
......@@ -757,5 +762,12 @@ word or NIL if no such offset exists"
(buffer-looking-at buffer i word :test test)
(not (and (< j blen)
(constituentp (buffer-object buffer j)))))
;; should this be (+ i wlen)? jqs 2006-05-14
return i
finally (return nil))))
(defun search-word-forward (mark word)
(let ((wlen (length word))
(offset (buffer-search-word-forward (buffer mark) (offset mark) word)))
(when offset
(setf (offset mark) (+ offset wlen)))))
\ No newline at end of file
......@@ -127,7 +127,7 @@
:test (lambda (x y)
(member x y :test #'string-equal))
:key #'climacs-syntax::syntax-description-pathname-types))
'fundamental-syntax))
'basic-syntax))
(defun evaluate-attributes (buffer options)
"Evaluate the attributes `options' and modify `buffer' as
......
......@@ -144,7 +144,7 @@
(defpackage :climacs-pane
(:use :clim-lisp :clim :climacs-buffer :climacs-base :climacs-abbrev
:climacs-syntax :flexichain :undo :climacs-fundamental-syntax)
:climacs-syntax :flexichain :undo)
(:export #:climacs-buffer #:needs-saving
#:filepath #:file-saved-p #:file-write-time
#:read-only-p #:buffer-read-only
......@@ -170,7 +170,7 @@
(defpackage :climacs-gui
(:use :clim-lisp :clim :climacs-buffer :climacs-base
:climacs-abbrev :climacs-syntax :climacs-fundamental-syntax
:climacs-abbrev :climacs-syntax
:climacs-kill-ring :climacs-pane :clim-extensions :undo :esa)
;;(:import-from :lisp-string)
(:export :climacs ; Main entry point.
......
......@@ -255,7 +255,7 @@ is made to alter a buffer which has been set read only."))
(declare (ignore args))
(with-slots (syntax point) buffer
(setf syntax (make-instance
'fundamental-syntax :buffer (implementation buffer))
'basic-syntax :buffer (implementation buffer))
point (clone-mark (low-mark buffer) :right))))
(defmethod (setf syntax) :after (syntax (buffer climacs-buffer))
......
......@@ -28,6 +28,46 @@
(in-package :climacs-gui)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; String search
(define-command (com-string-search :name t :command-table search-table)
((string 'string :prompt "Search string"))
"Prompt for a string and search forward for it.
If found, leaves point after string. If not, leaves point where it is."
(let* ((pane (current-window))
(point (point pane)))
(search-forward point string)))
(define-command (com-reverse-string-search :name t :command-table search-table)
((string 'string :prompt "Search string"))
"Prompt for a string and search backward for it.
If found, leaves point before string. If not, leaves point where it is."
(let* ((pane (current-window))
(point (point pane)))
(search-backward point string)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Word search
(define-command (com-word-search :name t :command-table search-table)
((word 'string :prompt "Search word"))
"Prompt for a whitespace delimited word and search forward for it.
If found, leaves point after the word. If not, leaves point where it is."
(let* ((pane (current-window))
(point (point pane)))
(climacs-base::search-word-forward point word)))
(define-command (com-reverse-word-search :name t :command-table search-table)
((word 'string :prompt "Search word"))
"Prompt for a whitespace delimited word and search backward for it.
If found, leaves point before the word. If not, leaves point where it is."
(let* ((pane (current-window))
(point (point pane)))
(climacs-base::search-word-backward point word)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Incremental search
......@@ -445,5 +485,3 @@ Entering an empty search string stops the prompting."
(multiple-query-replace-set-key '(#\q) 'com-query-replace-exit)
(multiple-query-replace-set-key '(#\y) 'com-multiple-query-replace-replace)
(multiple-query-replace-set-key '(#\n) 'com-multiple-query-replace-skip)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment