Mercurial > emacs
annotate lisp/=gosmacs.el @ 8767:441af4b664ac
(yank-menu): New variable; kill-ring in menu format.
(menu-bar-update-yank-menu, menu-bar-select-yank): New function.
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Thu, 15 Sep 1994 22:16:49 +0000 |
parents | afb11b3822c2 |
children |
rev | line source |
---|---|
660
08eb386dd0f3
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
258
diff
changeset
|
1 ;;; gosmacs.el --- rebindings to imitate Gosmacs. |
08eb386dd0f3
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
258
diff
changeset
|
2 |
845 | 3 ;; Copyright (C) 1986 Free Software Foundation, Inc. |
4 | |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
660
diff
changeset
|
5 ;; Maintainer: FSF |
811
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
807
diff
changeset
|
6 ;; Keywords: emulations |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
660
diff
changeset
|
7 |
36 | 8 ;; This file is part of GNU Emacs. |
9 | |
10 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
11 ;; it under the terms of the GNU General Public License as published by | |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
660
diff
changeset
|
12 ;; the Free Software Foundation; either version 2, or (at your option) |
36 | 13 ;; any later version. |
14 | |
15 ;; GNU Emacs is distributed in the hope that it will be useful, | |
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 ;; GNU General Public License for more details. | |
19 | |
20 ;; You should have received a copy of the GNU General Public License | |
21 ;; along with GNU Emacs; see the file COPYING. If not, write to | |
22 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | |
23 | |
2307
10e417efb12a
Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1864
diff
changeset
|
24 ;;; Commentary: |
10e417efb12a
Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1864
diff
changeset
|
25 |
10e417efb12a
Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1864
diff
changeset
|
26 ;; Make GNU Emacs look like Gosling Emacs. `M-x set-gosmacs-bindings' |
10e417efb12a
Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1864
diff
changeset
|
27 ;; does this change; `M-x set-gnu-bindings' undoes it. |
10e417efb12a
Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1864
diff
changeset
|
28 |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
660
diff
changeset
|
29 ;;; Code: |
36 | 30 |
1864
1354a2911d11
* gosmacs.el: Bind M-h to delete-previous-word, not
Jim Blandy <jimb@redhat.com>
parents:
1850
diff
changeset
|
31 (require 'mlsupport) |
1354a2911d11
* gosmacs.el: Bind M-h to delete-previous-word, not
Jim Blandy <jimb@redhat.com>
parents:
1850
diff
changeset
|
32 |
36 | 33 (defvar non-gosmacs-binding-alist nil) |
34 | |
258 | 35 ;;;###autoload |
36 | 36 (defun set-gosmacs-bindings () |
37 "Rebind some keys globally to make GNU Emacs resemble Gosling Emacs. | |
38 Use \\[set-gnu-bindings] to restore previous global bindings." | |
39 (interactive) | |
40 (setq non-gosmacs-binding-alist | |
41 (rebind-and-record | |
42 '(("\C-x\C-e" compile) | |
43 ("\C-x\C-f" save-buffers-kill-emacs) | |
44 ("\C-x\C-i" insert-file) | |
45 ("\C-x\C-m" save-some-buffers) | |
46 ("\C-x\C-n" next-error) | |
47 ("\C-x\C-o" switch-to-buffer) | |
48 ("\C-x\C-r" insert-file) | |
2411 | 49 ("\C-x\C-u" undo) |
36 | 50 ("\C-x\C-v" find-file-other-window) |
51 ("\C-x\C-z" shrink-window) | |
52 ("\C-x!" shell-command) | |
53 ("\C-xd" delete-window) | |
54 ("\C-xn" gosmacs-next-window) | |
55 ("\C-xp" gosmacs-previous-window) | |
56 ("\C-xz" enlarge-window) | |
57 ("\C-z" scroll-one-line-up) | |
58 ("\e\C-c" save-buffers-kill-emacs) | |
59 ("\e!" line-to-top-of-window) | |
60 ("\e(" backward-paragraph) | |
61 ("\e)" forward-paragraph) | |
62 ("\e?" apropos) | |
1864
1354a2911d11
* gosmacs.el: Bind M-h to delete-previous-word, not
Jim Blandy <jimb@redhat.com>
parents:
1850
diff
changeset
|
63 ("\eh" delete-previous-word) |
36 | 64 ("\ej" indent-sexp) |
65 ("\eq" query-replace) | |
66 ("\er" replace-string) | |
67 ("\ez" scroll-one-line-down) | |
68 ("\C-_" suspend-emacs))))) | |
69 | |
70 (defun rebind-and-record (bindings) | |
71 "Establish many new global bindings and record the bindings replaced. | |
208 | 72 Arg BINDINGS is an alist whose elements are (KEY DEFINITION). |
73 Returns a similar alist whose elements describe the same KEYs | |
36 | 74 but each with the old definition that was replaced," |
75 (let (old) | |
76 (while bindings | |
77 (let* ((this (car bindings)) | |
78 (key (car this)) | |
79 (newdef (nth 1 this))) | |
80 (setq old (cons (list key (lookup-key global-map key)) old)) | |
81 (global-set-key key newdef)) | |
82 (setq bindings (cdr bindings))) | |
83 (nreverse old))) | |
84 | |
85 (defun set-gnu-bindings () | |
86 "Restore the global bindings that were changed by \\[set-gosmacs-bindings]." | |
87 (interactive) | |
88 (rebind-and-record non-gosmacs-binding-alist)) | |
89 | |
90 (defun gosmacs-previous-window () | |
91 "Select the window above or to the left of the window now selected. | |
92 From the window at the upper left corner, select the one at the lower right." | |
93 (interactive) | |
94 (select-window (previous-window))) | |
95 | |
96 (defun gosmacs-next-window () | |
97 "Select the window below or to the right of the window now selected. | |
98 From the window at the lower right corner, select the one at the upper left." | |
99 (interactive) | |
100 (select-window (next-window))) | |
101 | |
102 (defun scroll-one-line-up (&optional arg) | |
103 "Scroll the selected window up (forward in the text) one line (or N lines)." | |
104 (interactive "p") | |
105 (scroll-up (or arg 1))) | |
106 | |
107 (defun scroll-one-line-down (&optional arg) | |
108 "Scroll the selected window down (backward in the text) one line (or N)." | |
109 (interactive "p") | |
110 (scroll-down (or arg 1))) | |
111 | |
112 (defun line-to-top-of-window () | |
113 "Scroll the selected window up so that the current line is at the top." | |
114 (interactive) | |
115 (recenter 0)) | |
660
08eb386dd0f3
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
258
diff
changeset
|
116 |
08eb386dd0f3
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
258
diff
changeset
|
117 ;;; gosmacs.el ends here |