~ubuntu-branches/ubuntu/karmic/emacs-snapshot/karmic

« back to all changes in this revision

Viewing changes to lisp/electric.el

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2009-04-05 09:14:30 UTC
  • mto: This revision was merged to the branch mainline in revision 34.
  • Revision ID: james.westby@ubuntu.com-20090405091430-nw07lynn2arotjbe
Tags: upstream-20090320
ImportĀ upstreamĀ versionĀ 20090320

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
;;; electric.el --- window maker and Command loop for `electric' modes
2
2
 
3
3
;; Copyright (C) 1985, 1986, 1995, 2001, 2002, 2003, 2004,
4
 
;;   2005, 2006, 2007, 2008 Free Software Foundation, Inc.
 
4
;;   2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
5
5
 
6
6
;; Author: K. Shane Hartman
7
7
;; Maintainer: FSF
65
65
              (setq prompt-string nil)
66
66
            (setq prompt-string "->")))
67
67
      (setq cmd (read-key-sequence prompt-string))
68
 
      (setq last-command-char (aref cmd (1- (length cmd)))
 
68
      (setq last-command-event (aref cmd (1- (length cmd)))
69
69
            this-command (key-binding cmd t)
70
70
            cmd this-command)
71
71
      ;; This makes universal-argument-other-key work.
72
72
      (setq universal-argument-num-events 0)
73
73
      (if (or (prog1 quit-flag (setq quit-flag nil))
74
 
              (eq last-input-char ?\C-g))
 
74
              (eq last-input-event ?\C-g))
75
75
          (progn (setq unread-command-events nil
76
76
                       prefix-arg nil)
77
77
                 ;; If it wasn't cancelling a prefix character, then quit.
87
87
              (progn (command-execute cmd)
88
88
                     (setq last-command this-command)
89
89
                     (if (or (prog1 quit-flag (setq quit-flag nil))
90
 
                             (eq last-input-char ?\C-g))
 
90
                             (eq last-input-event ?\C-g))
91
91
                         (progn (setq unread-command-events nil)
92
92
                                (if (not inhibit-quit)
93
93
                                    (progn (ding)
153
153
             (setq win (selected-window)))
154
154
            (t
155
155
             (switch-to-buffer buf)))
156
 
      (fit-window-to-buffer win max-height)
 
156
      ;; Don't shrink the window, but expand it if necessary.
157
157
      (goto-char (point-min))
 
158
      (unless (= (point-max) (window-end win t))
 
159
        (fit-window-to-buffer win max-height))
158
160
      win)))
159
161
 
160
162
(provide 'electric)