]> code.delx.au - gnu-emacs/blobdiff - lisp/electric.el
Add 2010 to copyright years.
[gnu-emacs] / lisp / electric.el
index 60a551291a736f95c71cc8d43d14e8a709724ca6..db53b5fa84ef756b60d93dacd1e82c2416fd9c6b 100644 (file)
@@ -1,7 +1,7 @@
 ;;; electric.el --- window maker and Command loop for `electric' modes
 
 ;; Copyright (C) 1985, 1986, 1995, 2001, 2002, 2003, 2004,
-;;   2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+;;   2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 
 ;; Author: K. Shane Hartman
 ;; Maintainer: FSF
               (setq prompt-string nil)
             (setq prompt-string "->")))
       (setq cmd (read-key-sequence prompt-string))
-      (setq last-command-char (aref cmd (1- (length cmd)))
+      (setq last-command-event (aref cmd (1- (length cmd)))
            this-command (key-binding cmd t)
            cmd this-command)
       ;; This makes universal-argument-other-key work.
       (setq universal-argument-num-events 0)
       (if (or (prog1 quit-flag (setq quit-flag nil))
-             (eq last-input-char ?\C-g))
+             (eq last-input-event ?\C-g))
          (progn (setq unread-command-events nil
                       prefix-arg nil)
                 ;; If it wasn't cancelling a prefix character, then quit.
@@ -87,7 +87,7 @@
              (progn (command-execute cmd)
                     (setq last-command this-command)
                     (if (or (prog1 quit-flag (setq quit-flag nil))
-                            (eq last-input-char ?\C-g))
+                            (eq last-input-event ?\C-g))
                         (progn (setq unread-command-events nil)
                                (if (not inhibit-quit)
                                    (progn (ding)
             (setq win (selected-window)))
            (t
             (switch-to-buffer buf)))
-      (fit-window-to-buffer win max-height)
+      ;; Don't shrink the window, but expand it if necessary.
       (goto-char (point-min))
+      (unless (= (point-max) (window-end win t))
+       (fit-window-to-buffer win max-height))
       win)))
 
 (provide 'electric)