Mercurial > hg > xemacs-beta
annotate lisp/buffer.el @ 5765:e88d026f3917
Include uname and configure arguments in stdout.
| author | Stephen J. Turnbull <stephen@xemacs.org> |
|---|---|
| date | Sun, 15 Sep 2013 23:50:20 +0900 |
| parents | 308d34e9f07d |
| children |
| rev | line source |
|---|---|
| 428 | 1 ;;; buffer.el --- buffer routines taken from C |
| 2 | |
| 3 ;; Copyright (C) 1985-1989, 1992-1995, 1997 Free Software Foundation, Inc. | |
| 4 ;; Copyright (C) 1995 Sun Microsystems. | |
| 5 ;; Copyright (C) 1995, 1996 Ben Wing. | |
| 6 | |
| 7 ;; Maintainer: XEmacs Development Team | |
| 8 ;; Keywords: internal, dumped | |
| 9 | |
| 10 ;; This file is part of XEmacs. | |
| 11 | |
|
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4734
diff
changeset
|
12 ;; XEmacs is free software: you can redistribute it and/or modify it |
|
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4734
diff
changeset
|
13 ;; under the terms of the GNU General Public License as published by the |
|
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4734
diff
changeset
|
14 ;; Free Software Foundation, either version 3 of the License, or (at your |
|
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4734
diff
changeset
|
15 ;; option) any later version. |
| 428 | 16 |
|
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4734
diff
changeset
|
17 ;; XEmacs is distributed in the hope that it will be useful, but WITHOUT |
|
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4734
diff
changeset
|
18 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4734
diff
changeset
|
19 ;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4734
diff
changeset
|
20 ;; for more details. |
| 428 | 21 |
| 22 ;; You should have received a copy of the GNU General Public License | |
|
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4734
diff
changeset
|
23 ;; along with XEmacs. If not, see <http://www.gnu.org/licenses/>. |
| 428 | 24 |
| 25 ;;; Synched up with: FSF 19.30 buffer.c. | |
| 26 | |
| 27 ;;; Commentary: | |
| 28 | |
| 29 ;; This file is dumped with XEmacs. | |
| 30 | |
| 31 ;;; Code: | |
| 32 | |
| 33 (defun switch-to-buffer (bufname &optional norecord) | |
| 34 "Select buffer BUFNAME in the current window. | |
| 35 BUFNAME may be a buffer or a buffer name and is created if it did not exist. | |
| 36 Optional second arg NORECORD non-nil means do not put this buffer at the | |
| 37 front of the list of recently selected ones. | |
| 38 | |
| 39 WARNING: This is NOT the way to work on another buffer temporarily | |
| 40 within a Lisp program! Use `set-buffer' instead. That avoids messing with | |
| 41 the window-buffer correspondences." | |
|
4734
74a5eaa67982
Make switch-to-buffer completion avoid current buffer.
Didier Verna <didier@xemacs.org>
parents:
2590
diff
changeset
|
42 (interactive |
|
74a5eaa67982
Make switch-to-buffer completion avoid current buffer.
Didier Verna <didier@xemacs.org>
parents:
2590
diff
changeset
|
43 (list (read-buffer "Switch to buffer: " |
|
74a5eaa67982
Make switch-to-buffer completion avoid current buffer.
Didier Verna <didier@xemacs.org>
parents:
2590
diff
changeset
|
44 (other-buffer (current-buffer)) |
|
74a5eaa67982
Make switch-to-buffer completion avoid current buffer.
Didier Verna <didier@xemacs.org>
parents:
2590
diff
changeset
|
45 nil |
|
74a5eaa67982
Make switch-to-buffer completion avoid current buffer.
Didier Verna <didier@xemacs.org>
parents:
2590
diff
changeset
|
46 (current-buffer)))) |
| 428 | 47 ;; #ifdef I18N3 |
| 48 ;; #### Doc string should indicate that the buffer name will get | |
| 49 ;; translated. | |
| 50 ;; #endif | |
| 51 (if (eq (minibuffer-window) (selected-window)) | |
| 52 (error "Cannot switch buffers in minibuffer window")) | |
| 53 (if (window-dedicated-p (selected-window)) | |
| 54 (error "Cannot switch buffers in a dedicated window")) | |
| 55 (let (buf) | |
| 56 (if (null bufname) | |
| 57 (setq buf (other-buffer (current-buffer))) | |
| 58 (setq buf (get-buffer bufname)) | |
| 59 (if (null buf) | |
| 60 (progn | |
| 61 (setq buf (get-buffer-create bufname)) | |
| 62 (set-buffer-major-mode buf)))) | |
| 63 (push-window-configuration) | |
| 64 (set-buffer buf) | |
| 442 | 65 (set-window-buffer (last-nonminibuf-window) buf norecord) |
| 428 | 66 buf)) |
| 67 | |
| 68 (defun pop-to-buffer (bufname &optional not-this-window-p on-frame) | |
| 69 "Select buffer BUFNAME in some window, preferably a different one. | |
| 70 If BUFNAME is nil, then some other buffer is chosen. | |
| 71 If `pop-up-windows' is non-nil, windows can be split to do this. | |
| 72 If optional second arg NOT-THIS-WINDOW-P is non-nil, insist on finding | |
| 73 another window even if BUFNAME is already visible in the selected window. | |
| 74 If optional third arg is non-nil, it is the frame to pop to this | |
| 75 buffer on. | |
| 2590 | 76 If `focus-follows-mouse' is non-nil, keyboard focus is left unchanged. |
| 77 | |
| 78 Buffers with names that are members of the `same-window-buffer-names' | |
| 79 list, or that match an element of the `same-window-regexps' list are | |
| 80 treated specially by this function--they are always selected in the | |
| 81 same window rather than in a different one." | |
| 428 | 82 ;; #ifdef I18N3 |
| 83 ;; #### Doc string should indicate that the buffer name will get | |
| 84 ;; translated. | |
| 85 ;; #endif | |
| 86 ;; This is twisted. It is evil to throw the keyboard focus around | |
| 87 ;; willy-nilly if the user wants focus-follows-mouse. | |
| 88 (let ((oldbuf (current-buffer)) | |
| 89 buf window frame) | |
| 90 (if (null bufname) | |
| 91 (setq buf (other-buffer (current-buffer))) | |
| 92 (setq buf (get-buffer bufname)) | |
| 93 (if (null buf) | |
| 94 (progn | |
| 95 (setq buf (get-buffer-create bufname)) | |
| 96 (set-buffer-major-mode buf)))) | |
| 97 (push-window-configuration) | |
| 98 (set-buffer buf) | |
| 99 (setq window (display-buffer buf not-this-window-p on-frame)) | |
| 100 (setq frame (window-frame window)) | |
| 101 ;; if the display-buffer hook decided to show this buffer in another | |
| 102 ;; frame, then select that frame, (unless obeying focus-follows-mouse -sb). | |
| 103 (if (and (not focus-follows-mouse) | |
| 104 (not (eq frame (selected-frame)))) | |
| 105 (select-frame frame)) | |
| 106 (record-buffer buf) | |
| 107 (if (and focus-follows-mouse | |
| 108 on-frame | |
| 109 (not (eq on-frame (selected-frame)))) | |
| 110 (set-buffer oldbuf) | |
| 111 ;; select-window will modify the internal keyboard focus of XEmacs | |
| 112 (select-window window)) | |
| 113 buf)) | |
| 114 | |
| 115 ;;; buffer.el ends here |
