diff options
| author | Kenichi Handa | 2002-11-13 07:06:07 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2002-11-13 07:06:07 +0000 |
| commit | 5cb4031d8f4101d80e936a9a13839ea1820db938 (patch) | |
| tree | 87cf9a310f7147534eb5dfdabfa15a785bf7ec2c /lisp/replace.el | |
| parent | f79043bdb521a9bd4e9469cb07b5fcaef46f96c1 (diff) | |
| download | emacs-5cb4031d8f4101d80e936a9a13839ea1820db938.tar.gz emacs-5cb4031d8f4101d80e936a9a13839ea1820db938.zip | |
(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.el | 13 |
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'." | |||
| 773 | title-face prefix-face match-face keep-props) | 773 | title-face prefix-face match-face keep-props) |
| 774 | (with-current-buffer out-buf | 774 | (with-current-buffer out-buf |
| 775 | (setq buffer-read-only nil) | 775 | (setq buffer-read-only nil) |
| 776 | (let ((globalcount 0)) | 776 | (let ((globalcount 0) |
| 777 | (coding nil)) | ||
| 777 | ;; Map over all the buffers | 778 | ;; Map over all the buffers |
| 778 | (dolist (buf buffers) | 779 | (dolist (buf buffers) |
| 779 | (when (buffer-live-p buf) | 780 | (when (buffer-live-p buf) |
| @@ -789,6 +790,11 @@ See also `multi-occur'." | |||
| 789 | (headerpt (with-current-buffer out-buf (point)))) | 790 | (headerpt (with-current-buffer out-buf (point)))) |
| 790 | (save-excursion | 791 | (save-excursion |
| 791 | (set-buffer buf) | 792 | (set-buffer buf) |
| 793 | (or coding | ||
| 794 | ;; Set CODING only if the current buffer locally | ||
| 795 | ;; binds buffer-file-coding-system. | ||
| 796 | (not (local-variable-p 'buffer-file-coding-system)) | ||
| 797 | (setq coding buffer-file-coding-system)) | ||
| 792 | (save-excursion | 798 | (save-excursion |
| 793 | (goto-char (point-min)) ;; begin searching in the buffer | 799 | (goto-char (point-min)) ;; begin searching in the buffer |
| 794 | (while (not (eobp)) | 800 | (while (not (eobp)) |
| @@ -878,6 +884,11 @@ See also `multi-occur'." | |||
| 878 | `(font-lock-face ,title-face)) | 884 | `(font-lock-face ,title-face)) |
| 879 | `(occur-title ,buf)))) | 885 | `(occur-title ,buf)))) |
| 880 | (goto-char (point-min))))))) | 886 | (goto-char (point-min))))))) |
| 887 | (if coding | ||
| 888 | ;; CODING is buffer-file-coding-system of the first buffer | ||
| 889 | ;; that locally binds it. Let's use it also for the output | ||
| 890 | ;; buffer. | ||
| 891 | (set-buffer-file-coding-system coding)) | ||
| 881 | ;; Return the number of matches | 892 | ;; Return the number of matches |
| 882 | globalcount))) | 893 | globalcount))) |
| 883 | 894 | ||