# HG changeset patch # User Kenichi Handa # Date 1037171167 0 # Node ID 3a5bc7e171a5a5eb63b0e6af39fd7d1cce7ce761 # Parent 481dbc5a687e6a1b534b806a385bdfde4f4164b4 (occur-engine): Set buffer-file-coding-system of OUT-BUF to that of one of BUFFERS if they locally bind that variable. diff -r 481dbc5a687e -r 3a5bc7e171a5 lisp/replace.el --- a/lisp/replace.el Wed Nov 13 07:05:47 2002 +0000 +++ b/lisp/replace.el Wed Nov 13 07:06:07 2002 +0000 @@ -773,7 +773,8 @@ 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 @@ (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 @@ `(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)))