Annotation of 43BSDReno/contrib/emacs-18.55/lisp/gosmacs.el, revision 1.1.1.1

1.1       root        1: ;; Rebindings to imitate Gosmacs.
                      2: ;; Copyright (C) 1986 Free Software Foundation, Inc.
                      3: 
                      4: ;; This file is part of GNU Emacs.
                      5: 
                      6: ;; GNU Emacs is distributed in the hope that it will be useful,
                      7: ;; but WITHOUT ANY WARRANTY.  No author or distributor
                      8: ;; accepts responsibility to anyone for the consequences of using it
                      9: ;; or for whether it serves any particular purpose or works at all,
                     10: ;; unless he says so in writing.  Refer to the GNU Emacs General Public
                     11: ;; License for full details.
                     12: 
                     13: ;; Everyone is granted permission to copy, modify and redistribute
                     14: ;; GNU Emacs, but only under the conditions described in the
                     15: ;; GNU Emacs General Public License.   A copy of this license is
                     16: ;; supposed to have been given to you along with GNU Emacs so you
                     17: ;; can know your rights and responsibilities.  It should be in a
                     18: ;; file named COPYING.  Among other things, the copyright notice
                     19: ;; and this notice must be preserved on all copies.
                     20: 
                     21: 
                     22: (defvar non-gosmacs-binding-alist nil)
                     23: 
                     24: (defun set-gosmacs-bindings ()
                     25:   "Rebind some keys globally to make GNU Emacs resemble Gosling Emacs.
                     26: Use \\[set-gnu-bindings] to restore previous global bindings."
                     27:   (interactive)
                     28:   (setq non-gosmacs-binding-alist
                     29:        (rebind-and-record
                     30:         '(("\C-x\C-e" compile)
                     31:           ("\C-x\C-f" save-buffers-kill-emacs)
                     32:           ("\C-x\C-i" insert-file)
                     33:           ("\C-x\C-m" save-some-buffers)
                     34:           ("\C-x\C-n" next-error)
                     35:           ("\C-x\C-o" switch-to-buffer)
                     36:           ("\C-x\C-r" insert-file)
                     37:           ("\C-x\C-u" undo)
                     38:           ("\C-x\C-v" find-file-other-window)
                     39:           ("\C-x\C-z" shrink-window)
                     40:           ("\C-x!" shell-command)
                     41:           ("\C-xd" delete-window)
                     42:           ("\C-xn" gosmacs-next-window)
                     43:           ("\C-xp" gosmacs-previous-window)
                     44:           ("\C-xz" enlarge-window)
                     45:           ("\C-z" scroll-one-line-up)
                     46:           ("\e\C-c" save-buffers-kill-emacs)
                     47:           ("\e!" line-to-top-of-window)
                     48:           ("\e(" backward-paragraph)
                     49:           ("\e)" forward-paragraph)
                     50:           ("\e?" apropos)
                     51:           ("\eh" delete-previous-word)
                     52:           ("\ej" indent-sexp)
                     53:           ("\eq" query-replace)
                     54:           ("\er" replace-string)
                     55:           ("\ez" scroll-one-line-down)
                     56:           ("\C-_" suspend-emacs)))))
                     57: 
                     58: (defun rebind-and-record (bindings)
                     59:   "Establish many new global bindings and record the bindings replaced.
                     60: Arg is an alist whose elements are (KEY DEFINITION).
                     61: Value is a similar alist whose elements describe the same KEYs
                     62: but each with the old definition that was replaced,"
                     63:   (let (old)
                     64:     (while bindings
                     65:       (let* ((this (car bindings))
                     66:             (key (car this))
                     67:             (newdef (nth 1 this)))
                     68:        (setq old (cons (list key (lookup-key global-map key)) old))
                     69:        (global-set-key key newdef))
                     70:       (setq bindings (cdr bindings)))
                     71:     (nreverse old)))
                     72: 
                     73: (defun set-gnu-bindings ()
                     74:   "Restore the global bindings that were changed by \\[set-gosmacs-bindings]."
                     75:   (interactive)
                     76:   (rebind-and-record non-gosmacs-binding-alist))
                     77: 
                     78: (defun gosmacs-previous-window ()
                     79:   "Select the window above or to the left of the window now selected.
                     80: From the window at the upper left corner, select the one at the lower right."
                     81:   (interactive)
                     82:   (select-window (previous-window)))
                     83: 
                     84: (defun gosmacs-next-window ()
                     85:   "Select the window below or to the right of the window now selected.
                     86: From the window at the lower right corner, select the one at the upper left."
                     87:   (interactive)
                     88:   (select-window (next-window)))
                     89: 
                     90: (defun scroll-one-line-up (&optional arg)
                     91:   "Scroll the selected window up (forward in the text) one line (or N lines)."
                     92:   (interactive "p")
                     93:   (scroll-up (or arg 1)))
                     94: 
                     95: (defun scroll-one-line-down (&optional arg)
                     96:   "Scroll the selected window down (backward in the text) one line (or N)."
                     97:   (interactive "p")
                     98:   (scroll-down (or arg 1)))
                     99: 
                    100: (defun line-to-top-of-window ()
                    101:   "Scroll the selected window up so that the current line is at the top."
                    102:   (interactive)
                    103:   (recenter 0))

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.