Annotation of GNUtools/emacs/lisp/sun-keys.el, revision 1.1

1.1     ! root        1: ;;;
        !             2: ;;; Support (cleanly) for Sun function keys.  Provides help facilities,
        !             3: ;;; better diagnostics, etc.
        !             4: ;;;
        !             5: ;;; To use: make sure your .ttyswrc binds 'F1' to <ESC> * F1 <CR> and so on.
        !             6: ;;;         load this lot from your start_up
        !             7: ;;;
        !             8: ;;; 
        !             9: ;;;    Copyright (C) 1986 Free Software Foundation, Inc.
        !            10: ;;; 
        !            11: ;; This file is part of GNU Emacs.
        !            12: 
        !            13: ;; GNU Emacs is free software; you can redistribute it and/or modify
        !            14: ;; it under the terms of the GNU General Public License as published by
        !            15: ;; the Free Software Foundation; either version 1, or (at your option)
        !            16: ;; any later version.
        !            17: 
        !            18: ;; GNU Emacs is distributed in the hope that it will be useful,
        !            19: ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
        !            20: ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        !            21: ;; GNU General Public License for more details.
        !            22: 
        !            23: ;; You should have received a copy of the GNU General Public License
        !            24: ;; along with GNU Emacs; see the file COPYING.  If not, write to
        !            25: ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
        !            26: 
        !            27: ;;;
        !            28: ;;; [email protected] (Ian G. Batten)
        !            29: ;;;
        !            30: 
        !            31: (defun sun-function-keys-dispatch (arg)
        !            32:   "Dispatcher for function keys."
        !            33:   (interactive "p")
        !            34:   (let* ((key-stroke (read t))
        !            35:          (command (assq key-stroke sun-function-keys-command-list)))
        !            36:     (cond (command (funcall (cdr command) arg))
        !            37:           (t (error "Unbound function key %s" key-stroke)))))
        !            38: 
        !            39: (defvar sun-function-keys-command-list 
        !            40:   '((F1 . sun-function-keys-describe-bindings)
        !            41:     (R8 . previous-line)                ; arrow keys
        !            42:     (R10 . backward-char)
        !            43:     (R12 . forward-char)
        !            44:     (R14 . next-line)))
        !            45: 
        !            46: (defun sun-function-keys-bind-key (arg1 arg2)
        !            47:   "Bind a specified key."
        !            48:   (interactive "xFunction Key Cap Label:
        !            49: CCommand To Use:")
        !            50:   (setq sun-function-keys-command-list 
        !            51:         (cons (cons arg1 arg2) sun-function-keys-command-list)))
        !            52: 
        !            53: (defun sun-function-keys-describe-bindings (arg)
        !            54:   "Describe the function key bindings we're running"
        !            55:   (interactive)
        !            56:   (with-output-to-temp-buffer "*Help*"
        !            57:     (sun-function-keys-write-bindings
        !            58:      (sort (copy-sequence sun-function-keys-command-list)
        !            59:            '(lambda (x y) (string-lessp (car x) (car y)))))))
        !            60: 
        !            61: (defun sun-function-keys-write-bindings (list)
        !            62:   (cond ((null list)
        !            63:          t)
        !            64:         (t
        !            65:          (princ (format "%s: %s\n" 
        !            66:                         (car (car list))
        !            67:                         (cdr (car list))))
        !            68:          (sun-function-keys-write-bindings (cdr list)))))
        !            69:     
        !            70: (global-set-key "\e*" 'sun-function-keys-dispatch)
        !            71: 
        !            72: (make-variable-buffer-local 'sun-function-keys-command-list)

unix.superglobalmegacorp.com

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