Mercurial > emacs
comparison lisp/electric.el @ 54575:2a426019394d
(Electric-pop-up-window): Avoid popping up a new frame.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Fri, 26 Mar 2004 15:15:07 +0000 |
parents | 00aea832bb14 |
children | c5ee87e89147 |
comparison
equal
deleted
inserted
replaced
54574:76b831799f4d | 54575:2a426019394d |
---|---|
1 ;;; electric.el --- window maker and Command loop for `electric' modes | 1 ;;; electric.el --- window maker and Command loop for `electric' modes |
2 | 2 |
3 ;; Copyright (C) 1985, 1986, 1995 Free Software Foundation, Inc. | 3 ;; Copyright (C) 1985, 1986, 1995, 2004 Free Software Foundation, Inc. |
4 | 4 |
5 ;; Author: K. Shane Hartman | 5 ;; Author: K. Shane Hartman |
6 ;; Maintainer: FSF | 6 ;; Maintainer: FSF |
7 ;; Keywords: extensions | 7 ;; Keywords: extensions |
8 | 8 |
142 (defun Electric-pop-up-window (buffer &optional max-height) | 142 (defun Electric-pop-up-window (buffer &optional max-height) |
143 (let* ((win (or (get-buffer-window buffer) (selected-window))) | 143 (let* ((win (or (get-buffer-window buffer) (selected-window))) |
144 (buf (get-buffer buffer)) | 144 (buf (get-buffer buffer)) |
145 (one-window (one-window-p t)) | 145 (one-window (one-window-p t)) |
146 (pop-up-windows t) | 146 (pop-up-windows t) |
147 (pop-up-frames nil) | |
147 (target-height) | 148 (target-height) |
148 (lines)) | 149 (lines)) |
149 (if (not buf) | 150 (if (not buf) |
150 (error "Buffer %s does not exist" buffer) | 151 (error "Buffer %s does not exist" buffer) |
151 (save-excursion | 152 (with-current-buffer buf |
152 (set-buffer buf) | |
153 (setq lines (count-lines (point-min) (point-max))) | 153 (setq lines (count-lines (point-min) (point-max))) |
154 (setq target-height | 154 (setq target-height |
155 (min (max (if max-height (min max-height (1+ lines)) (1+ lines)) | 155 (min (max (if max-height (min max-height (1+ lines)) (1+ lines)) |
156 window-min-height) | 156 window-min-height) |
157 (save-window-excursion | 157 (save-window-excursion |