aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/replace.el
diff options
context:
space:
mode:
authorDave Love2000-05-21 17:04:47 +0000
committerDave Love2000-05-21 17:04:47 +0000
commite730be7fbb147f2a5684b4a371e1842a4b8e180d (patch)
tree890b883358a3b7228e0f8b7a7d22a62ad745958c /lisp/replace.el
parent84469aeb4f556a48ea3ba964c90c905eb35a4049 (diff)
downloademacs-e730be7fbb147f2a5684b4a371e1842a4b8e180d.tar.gz
emacs-e730be7fbb147f2a5684b4a371e1842a4b8e180d.zip
Doc and error message fixes.
(replace-highlight): Use facep, not internal-find-face.
Diffstat (limited to 'lisp/replace.el')
-rw-r--r--lisp/replace.el56
1 files changed, 29 insertions, 27 deletions
diff --git a/lisp/replace.el b/lisp/replace.el
index 539c001dc8a..adf56293f51 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -176,9 +176,11 @@ Fourth and fifth arg START and END specify the region to operate on."
176 176
177(defun map-query-replace-regexp (regexp to-strings &optional n start end) 177(defun map-query-replace-regexp (regexp to-strings &optional n start end)
178 "Replace some matches for REGEXP with various strings, in rotation. 178 "Replace some matches for REGEXP with various strings, in rotation.
179The second argument TO-STRINGS contains the replacement strings, separated 179The second argument TO-STRINGS contains the replacement strings,
180by spaces. This command works like `query-replace-regexp' except 180separated by spaces. Third arg DELIMITED (prefix arg if interactive),
181that each successive replacement uses the next successive replacement string, 181if non-nil, means replace only matches surrounded by word boundaries.
182This command works like `query-replace-regexp' except that each
183successive replacement uses the next successive replacement string,
182wrapping around from the last such string to the first. 184wrapping around from the last such string to the first.
183 185
184In Transient Mark mode, if the mark is active, operate on the contents 186In Transient Mark mode, if the mark is active, operate on the contents
@@ -397,8 +399,8 @@ Alternatively, click \\[occur-mode-mouse-goto] on an item to go to it.
397 (make-local-variable 'occur-command-arguments) 399 (make-local-variable 'occur-command-arguments)
398 (run-hooks 'occur-mode-hook)) 400 (run-hooks 'occur-mode-hook))
399 401
400;; Handle revert-buffer for *Occur* buffers.
401(defun occur-revert-function (ignore1 ignore2) 402(defun occur-revert-function (ignore1 ignore2)
403 "Handle revert-buffer for *Occur* buffers."
402 (let ((args occur-command-arguments )) 404 (let ((args occur-command-arguments ))
403 (save-excursion 405 (save-excursion
404 (set-buffer occur-buffer) 406 (set-buffer occur-buffer)
@@ -446,7 +448,7 @@ Alternatively, click \\[occur-mode-mouse-goto] on an item to go to it.
446 (setq r (next-single-property-change (point) 'occur-point)) 448 (setq r (next-single-property-change (point) 'occur-point))
447 (if r 449 (if r
448 (goto-char r) 450 (goto-char r)
449 (error "no more matches")) 451 (error "No more matches"))
450 (setq n (1- n))))) 452 (setq n (1- n)))))
451 453
452 454
@@ -464,13 +466,13 @@ Alternatively, click \\[occur-mode-mouse-goto] on an item to go to it.
464 (setq r (previous-single-property-change (point) 'occur-point)) 466 (setq r (previous-single-property-change (point) 'occur-point))
465 (if r 467 (if r
466 (goto-char (- r 1)) 468 (goto-char (- r 1))
467 (error "no earlier matches")) 469 (error "No earlier matches"))
468 470
469 (setq n (1- n))))) 471 (setq n (1- n)))))
470 472
471(defcustom list-matching-lines-default-context-lines 0 473(defcustom list-matching-lines-default-context-lines 0
472 "*Default number of context lines to include around a `list-matching-lines' 474 "*Default number of context lines included around `list-matching-lines' matches.
473match. A negative number means to include that many lines before the match. 475A negative number means to include that many lines before the match.
474A positive number means to include that many lines both before and after." 476A positive number means to include that many lines both before and after."
475 :type 'integer 477 :type 'integer
476 :group 'matching) 478 :group 'matching)
@@ -478,7 +480,7 @@ A positive number means to include that many lines both before and after."
478(defalias 'list-matching-lines 'occur) 480(defalias 'list-matching-lines 'occur)
479 481
480(defvar list-matching-lines-face 'bold 482(defvar list-matching-lines-face 'bold
481 "*Face used by M-x list-matching-lines to show the text that matches. 483 "*Face used by \\[list-matching-lines] to show the text that matches.
482If the value is nil, don't highlight the matching portions specially.") 484If the value is nil, don't highlight the matching portions specially.")
483 485
484(defun occur (regexp &optional nlines) 486(defun occur (regexp &optional nlines)
@@ -519,7 +521,7 @@ the matching is case-sensitive."
519 (buffer (current-buffer)) 521 (buffer (current-buffer))
520 (dir default-directory) 522 (dir default-directory)
521 (linenum 1) 523 (linenum 1)
522 (prevpos 524 (prevpos
523 ;;position of most recent match 525 ;;position of most recent match
524 (point-min)) 526 (point-min))
525 (case-fold-search (and case-fold-search 527 (case-fold-search (and case-fold-search
@@ -574,10 +576,10 @@ the matching is case-sensitive."
574 nlines 576 nlines
575 (- nlines))) 577 (- nlines)))
576 (point))) 578 (point)))
577 (end 579 (end
578 ;; end point of text in source buffer to be put 580 ;; end point of text in source buffer to be put
579 ;; into *Occur* 581 ;; into *Occur*
580 (save-excursion 582 (save-excursion
581 (goto-char (match-end 0)) 583 (goto-char (match-end 0))
582 (if (> nlines 0) 584 (if (> nlines 0)
583 (forward-line (1+ nlines)) 585 (forward-line (1+ nlines))
@@ -586,21 +588,21 @@ the matching is case-sensitive."
586 (match-beg 588 (match-beg
587 ;; Amount of context before matching text 589 ;; Amount of context before matching text
588 (- (match-beginning 0) start)) 590 (- (match-beginning 0) start))
589 (match-len 591 (match-len
590 ;; Length of matching text 592 ;; Length of matching text
591 (- (match-end 0) (match-beginning 0))) 593 (- (match-end 0) (match-beginning 0)))
592 (tag (format "%5d" linenum)) 594 (tag (format "%5d" linenum))
593 (empty (make-string (length tag) ?\ )) 595 (empty (make-string (length tag) ?\ ))
594 tem 596 tem
595 insertion-start 597 insertion-start
596 ;; Number of lines of context to show for current match. 598 ;; Number of lines of context to show for current match.
597 occur-marker 599 occur-marker
598 ;; Marker pointing to end of match in source buffer. 600 ;; Marker pointing to end of match in source buffer.
599 (text-beg 601 (text-beg
600 ;; Marker pointing to start of text for one 602 ;; Marker pointing to start of text for one
601 ;; match in *Occur*. 603 ;; match in *Occur*.
602 (make-marker)) 604 (make-marker))
603 (text-end 605 (text-end
604 ;; Marker pointing to end of text for one match 606 ;; Marker pointing to end of text for one match
605 ;; in *Occur*. 607 ;; in *Occur*.
606 (make-marker)) 608 (make-marker))
@@ -623,7 +625,7 @@ the matching is case-sensitive."
623 (with-current-buffer buffer 625 (with-current-buffer buffer
624 (eq (char-before end) ?\n))) 626 (eq (char-before end) ?\n)))
625 (insert "\n")) 627 (insert "\n"))
626 (set-marker final-context-start 628 (set-marker final-context-start
627 (+ (- (point) (- end (match-end 0))) 629 (+ (- (point) (- end (match-end 0)))
628 (if (save-excursion 630 (if (save-excursion
629 (set-buffer buffer) 631 (set-buffer buffer)
@@ -755,15 +757,15 @@ The valid answers include `act', `skip', `act-and-show',
755(define-key query-replace-map [escape] 'exit-prefix) 757(define-key query-replace-map [escape] 'exit-prefix)
756 758
757(defun replace-match-string-symbols (n) 759(defun replace-match-string-symbols (n)
758 ;; Process a list (and any sub-lists), expanding certain symbols: 760 "Process a list (and any sub-lists), expanding certain symbols.
759 ;; Symbol Expands To 761Symbol Expands To
760 ;; N (match-string N) (where N is a string of digits) 762N (match-string N) (where N is a string of digits)
761 ;; #N (string-to-number (match-string N)) 763#N (string-to-number (match-string N))
762 ;; & (match-string 0) 764& (match-string 0)
763 ;; #& (string-to-number (match-string 0)) 765#& (string-to-number (match-string 0))
764 ;; 766
765 ;; Note that these symbols must be preceeded by a backslash in order to 767Note that these symbols must be preceeded by a backslash in order to
766 ;; type them. 768type them."
767 (while n 769 (while n
768 (cond 770 (cond
769 ((consp (car n)) 771 ((consp (car n))
@@ -1073,7 +1075,7 @@ which will run faster and probably do exactly what you want."
1073 (progn 1075 (progn
1074 (setq replace-overlay (make-overlay start end)) 1076 (setq replace-overlay (make-overlay start end))
1075 (overlay-put replace-overlay 'face 1077 (overlay-put replace-overlay 'face
1076 (if (internal-find-face 'query-replace) 1078 (if (facep 'query-replace)
1077 'query-replace 'region)))) 1079 'query-replace 'region))))
1078 (move-overlay replace-overlay start end (current-buffer))))) 1080 (move-overlay replace-overlay start end (current-buffer)))))
1079 1081