Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
;;;; -*- emacs-lisp -*- Sample .emacs file for use in Com S 342 ;;;; $Id: sample-.emacs,v 1.3 2005/02/22 00:42:22 leavens Exp leavens $ ;;; This sets up emacs to run Scheme, makes C-h the same as DEL, ;;; and makes help be on the key M-? (i.e., ESC ?). ;;; After installing this you can type ;;; ESC ? t ;;; for the emacs on-line tutorial. However, when reading the tutorial, ;;; remember to replace C-h by M-? everywhere. ;;; INSTRUCTIONS: copy this into your ~/.emacs file. ;;; However, if you are an emacs user already, ;;; you should instead integrate this into your existing .emacs file. ;;; Look especially at the optional customizations following how to run scheme. ;;; See the course staff if you have questions. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; The customization below is, we think, the best way to run Scheme locally. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Files mentioned below are found in "~/emacs" and "/usr/unsup/emacs". ;;; (If you're working at home, you may need to copy some files to a ;;; directory you call "/usr/unsup/emacs" or change the following.) ;;; (setq load-path (cons "~/emacs" (cons "/usr/unsup/emacs" load-path))) ;;; Scheme program mode ;;; Tell emacs that files that end in .ss are Chez Scheme files. ;;; There already is a mapping for the suffix .scm. ;;; (add-to-list 'auto-mode-alist '("\\.ss$" . scheme-mode)) (add-to-list 'auto-mode-alist '("\\.def$" . scheme-mode)) (add-to-list 'auto-mode-alist '("\\.tst$" . scheme-mode)) ;;; use cmuscheme instead of the standard scheme mode. ;;; (autoload 'run-scheme "cmuscheme" "Run Scheme in an emacs buffer." t) (autoload 'scheme-mode "cmuscheme" "Mode for Scheme programming and interaction" t) ;;; Special behavior that I want for scheme program files ;;; (setq scheme-mit-dialect nil) ;;; The following uses "scheme342" as the scheme interpreter ;;; (setq scheme-program-name "sh -c scheme342") ;;; To use scm342 as the scheme interpreter uncomment the following ; (setq scheme-program-name "sh -c scm342") ;;; Customize scheme mode ;;; (add-hook 'scheme-mode-hook (function (lambda () (define-key scheme-mode-map "\n" 'newline) (define-key scheme-mode-map "\r" 'newline-and-indent) (put 'cases 'scheme-indent-function 2) (put 'forall 'scheme-indent-function 1) (put 'has-type 'scheme-indent-function 0) (put 'has-type-trusted 'scheme-indent-function 0) (put 'defrep 'scheme-indent-function 0) (put 'module 'scheme-indent-function 2) (if window-system (progn ;; turn on fancy coloring of scheme programs (optional) (font-lock-mode) ;; Modify the font-locked keywords to include some used in EOPL ;; (The following is for GNU emacs 20) (if (> emacs-major-version 19) (progn (setq font-lock-keywords (cons 't (cons '("\\((\\(->\\|cases\\|isa\\|forall\\|def\\(rep\\|type\\|ine-datatype\\)\\|provide\\|module\\|require\\|file\\|lib\\|has-type\\(\\|-trusted\\)\\)\\>\\)" (1 font-lock-keyword-face)) (cdr font-lock-keywords)))) (font-lock-fontify-buffer))) )) (fset 'untyped (lambda () (interactive) (setq scheme-program-name "sh -c scheme342untyped"))) (fset 'typed (lambda () (interactive) (setq scheme-program-name "sh -c scheme342typed"))) ))) ;;; Portable scheme debugger mode ;;; (autoload 'psd-mode "psd" "Portable Scheme Debugger mode" t nil) ;;; ;;; uncomment the following to turn on psd-mode by default when running Scheme ;(add-hook 'inferior-scheme-mode-hook ; (function (lambda () (psd-mode 1)))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; The optional customizations below are generally helpful, ;;; but delete it or comment it out if you don't want it. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; The following disable key sequences that can cause ;;; big or unnoticed mistakes (put 'zap-to-char 'disabled t) ; M-z (put 'rmail-edit-current-message 'disabled 't) (global-unset-key "\C-x\C-u") ; C-x C-u (upcase-region) vs. C-x u (undo) (global-unset-key "\C-x\C-l") ; downcase of region can be disaster (global-unset-key "\C-xf") ; can use set-fill-column explicitly ;;; I don't use emacs to change directories, just to get to files (setq find-file-run-dired nil) ; never run dired ;;; it's safer to not allow local variable lists to take effect automatically (setq enable-local-variables 'query) ;;; Setting new commands and key bindings (make it do what I want) ;;; Make backspace (BS) work as most people expect (thanks to Bob Glickstein) ;;; ; make BS delete characters backwards, just like DEL (global-set-key "\C-h" 'backward-delete-char-untabify) ; put help on M-? (i.e., ESC ?) (global-set-key "\M-?" 'help-command) ;;; Make the behavior of a selection be as in many standard apps, so you can ;;; type right over it or delete it by using backspace. ;;; (pc-selection-mode) ;;; key bindings that are useful especially for flow control (ISN, telnet), ;;; which sometimes eats all the C-s and C-q chars, ;;; and which I can live with all the time anyway. ;;; (global-set-key "\C-\\" 'isearch-forward) (global-set-key "\C-^" 'quoted-insert) (global-set-key "\M-s" 'isearch-forward-regexp) (define-key isearch-mode-map "\C-\\" 'isearch-repeat-forward) (define-key isearch-mode-map "\C-^" 'isearch-quote-char) ;;; The following are mostly to help Prof. Leavens when you go to his ;;; office. You can comment them out if you want. ;;; Function key binding, the \M-O ones come from Kermit in emacs mode... ;;; (global-set-key "\M-OP" 'help) (global-set-key [f2] 'goto-line) (global-set-key "\M-OQ" 'goto-line) (global-set-key [f3] 'begin) (global-set-key "\M-OR" 'begin) (global-set-key "\M-OA" 'previous-line) (global-set-key "\M-OB" 'next-line) (global-set-key "\M-OC" 'forward-char) (global-set-key "\M-OD" 'backward-char) ;;; Keys from a Maltron keyboard using kermit that's not in emacs mode (:-( ;;; (global-set-key "\M-[A" 'previous-line) (global-set-key "\M-[B" 'next-line) (global-set-key "\M-[C" 'forward-char) (global-set-key "\M-[D" 'backward-char) ;;; Other customizations ;;; The following is important for the Windows file system, ;;; which uses ~ at the end of a name to control long file names! ;;; I use it also under Unix, so that sharing files on Windows works... (setq version-control t) ;;; Make ~ backup files even when using RCS or SCCS ;;; (setq vc-make-backup-files 't) ;;; Preserve links of files when editing ;;; (setq backup-by-copying-when-linked 't) ;;; Make files always end in a newline ;;; (setq require-final-newline 't) ;;; Uncomment the following to turn on viper-mode if you are a vi user. ;;; This make emacs use the vi keystrokes ; (setq viper-mode t) ; (require 'viper)