comparison lisp/replace.el @ 45176:2a245e4bdf59

(occur-unfontify-region-function): Delete. (occur-mode): Don't use it. (occur-engine): Respect `keep-props'. (occur-accumulate-lines): If we're moving forward, decrement; don't increment, and vice versa.
author Colin Walters <walters@gnu.org>
date Wed, 08 May 2002 03:53:19 +0000
parents bf76420e3297
children 20c79f08a7da
comparison
equal deleted inserted replaced
45175:bb718602e810 45176:2a245e4bdf59
466 (setq major-mode 'occur-mode) 466 (setq major-mode 'occur-mode)
467 (setq mode-name "Occur") 467 (setq mode-name "Occur")
468 (make-local-variable 'revert-buffer-function) 468 (make-local-variable 'revert-buffer-function)
469 (set (make-local-variable 'font-lock-defaults) 469 (set (make-local-variable 'font-lock-defaults)
470 '(nil t nil nil nil 470 '(nil t nil nil nil
471 (font-lock-fontify-region-function . occur-fontify-region-function) 471 (font-lock-fontify-region-function . occur-fontify-region-function)))
472 (font-lock-unfontify-region-function . occur-unfontify-region-function)))
473 (setq revert-buffer-function 'occur-revert-function) 472 (setq revert-buffer-function 'occur-revert-function)
474 (set (make-local-variable 'revert-buffer-function) 'occur-revert-function) 473 (set (make-local-variable 'revert-buffer-function) 'occur-revert-function)
475 (make-local-variable 'occur-revert-arguments) 474 (make-local-variable 'occur-revert-arguments)
476 (run-hooks 'occur-mode-hook)) 475 (run-hooks 'occur-mode-hook))
477 476
585 (result nil)) 584 (result nil))
586 (while (not (or (zerop count) 585 (while (not (or (zerop count)
587 (if forwardp 586 (if forwardp
588 (eobp) 587 (eobp)
589 (bobp)))) 588 (bobp))))
590 (setq count (+ count (if forwardp 1 -1))) 589 (setq count (+ count (if forwardp -1 1)))
591 (push 590 (push
592 (funcall (if no-props 591 (funcall (if no-props
593 #'buffer-substring-no-properties 592 #'buffer-substring-no-properties
594 #'buffer-substring) 593 #'buffer-substring)
595 (line-beginning-position) 594 (line-beginning-position)
801 ;; The complex multi-line display 800 ;; The complex multi-line display
802 ;; style. Generate a list of lines, 801 ;; style. Generate a list of lines,
803 ;; concatenate them all together. 802 ;; concatenate them all together.
804 (apply #'concat 803 (apply #'concat
805 (nconc 804 (nconc
806 (occur-engine-add-prefix (nreverse (cdr (occur-accumulate-lines (- (1+ nlines)) t)))) 805 (occur-engine-add-prefix (nreverse (cdr (occur-accumulate-lines (- (1+ nlines)) keep-props))))
807 (list out-line) 806 (list out-line)
808 (occur-engine-add-prefix (cdr (occur-accumulate-lines (1+ nlines) t)))))))) 807 (occur-engine-add-prefix (cdr (occur-accumulate-lines (1+ nlines) keep-props))))))))
809 ;; Actually insert the match display data 808 ;; Actually insert the match display data
810 (with-current-buffer out-buf 809 (with-current-buffer out-buf
811 (let ((beg (point)) 810 (let ((beg (point))
812 (end (progn (insert data) (point)))) 811 (end (progn (insert data) (point))))
813 (unless (= nlines 0) 812 (unless (= nlines 0)
860 (cdr e) 859 (cdr e)
861 (point) 860 (point)
862 end)) 861 end))
863 (goto-char change-end)))))) 862 (goto-char change-end))))))
864 (when verbose (message "Fontifying...done"))) 863 (when verbose (message "Fontifying...done")))
865
866 (defun occur-unfontify-region-function (beg end)
867 (let ((inhibit-read-only t))
868 (remove-text-properties beg end '(face nil))))
869 864
870 865
871 ;; It would be nice to use \\[...], but there is no reasonable way 866 ;; It would be nice to use \\[...], but there is no reasonable way
872 ;; to make that display both SPC and Y. 867 ;; to make that display both SPC and Y.
873 (defconst query-replace-help 868 (defconst query-replace-help