changeset 53551:fadd740b9db3

(mode-line-change-eol): Add EVENT parameter. Temporarily select EVENT's window for changing eol type.
author John Paul Wallington <jpw@pobox.com>
date Sat, 10 Jan 2004 01:19:53 +0000
parents 3f95b362dd1b
children bf35ae17f543
files lisp/bindings.el
diffstat 1 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/bindings.el	Thu Jan 08 23:35:07 2004 +0000
+++ b/lisp/bindings.el	Sat Jan 10 01:19:53 2004 +0000
@@ -135,12 +135,14 @@
   "Local keymap for the coding-system part of the mode line.")
 
 
-(defun mode-line-change-eol ()
+(defun mode-line-change-eol (event)
   "Cycle through the various possible kinds of end-of-line styles."
-  (interactive)
-  (let ((eol (coding-system-eol-type buffer-file-coding-system)))
-    (set-buffer-file-coding-system
-     (cond ((eq eol 0) 'dos) ((eq eol 1) 'mac) (t 'unix)))))
+  (interactive "e")
+  (save-selected-window
+    (select-window (posn-window (event-start event)))
+    (let ((eol (coding-system-eol-type buffer-file-coding-system)))
+      (set-buffer-file-coding-system
+       (cond ((eq eol 0) 'dos) ((eq eol 1) 'mac) (t 'unix))))))
 
 (defvar mode-line-eol-desc-cache nil)