summaryrefslogtreecommitdiff
path: root/lisp/replace.el
diff options
context:
space:
mode:
authorKenichi Handa <handa@m17n.org>2002-11-13 07:06:07 +0000
committerKenichi Handa <handa@m17n.org>2002-11-13 07:06:07 +0000
commit5cb4031d8f4101d80e936a9a13839ea1820db938 (patch)
tree87cf9a310f7147534eb5dfdabfa15a785bf7ec2c /lisp/replace.el
parentf79043bdb521a9bd4e9469cb07b5fcaef46f96c1 (diff)
downloademacs-5cb4031d8f4101d80e936a9a13839ea1820db938.tar.gz
(occur-engine): Set buffer-file-coding-system of
OUT-BUF to that of one of BUFFERS if they locally bind that variable.
Diffstat (limited to 'lisp/replace.el')
-rw-r--r--lisp/replace.el13
1 files changed, 12 insertions, 1 deletions
diff --git a/lisp/replace.el b/lisp/replace.el
index 898fee41cd7..18817d39fc0 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -773,7 +773,8 @@ See also `multi-occur'."
title-face prefix-face match-face keep-props)
(with-current-buffer out-buf
(setq buffer-read-only nil)
- (let ((globalcount 0))
+ (let ((globalcount 0)
+ (coding nil))
;; Map over all the buffers
(dolist (buf buffers)
(when (buffer-live-p buf)
@@ -789,6 +790,11 @@ See also `multi-occur'."
(headerpt (with-current-buffer out-buf (point))))
(save-excursion
(set-buffer buf)
+ (or coding
+ ;; Set CODING only if the current buffer locally
+ ;; binds buffer-file-coding-system.
+ (not (local-variable-p 'buffer-file-coding-system))
+ (setq coding buffer-file-coding-system))
(save-excursion
(goto-char (point-min)) ;; begin searching in the buffer
(while (not (eobp))
@@ -878,6 +884,11 @@ See also `multi-occur'."
`(font-lock-face ,title-face))
`(occur-title ,buf))))
(goto-char (point-min)))))))
+ (if coding
+ ;; CODING is buffer-file-coding-system of the first buffer
+ ;; that locally binds it. Let's use it also for the output
+ ;; buffer.
+ (set-buffer-file-coding-system coding))
;; Return the number of matches
globalcount)))