[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Emacs and CLISP



   Date: Mon, 29 May 95 14:40:34 +0200
   Reply-To: clisp-list <clisp-list@ma2s2.mathematik.uni-karlsruhe.de>

   Hi,

   The question how to use CLISP from within Emacs comes up over and over
   again. I would like to settle this finally.

   Could everyone of you who uses CLISP from within Emacs please send us a
   mail stating
   - What version of Emacs/XEmacs/Lucid-Emacs/Epoch are you using?

I'm using Xemacs 19.11 under Linux.

   - What interface package is used? If ILISP, which version? (5.5 or 5.7 or
     is there something newer?)

ILISP 5.5.

   - What local additions or patches did you make? Send us code. Send us
     excerpts from your .emacs file.

My .emacs file is attached at the bottom, after my .sig.  Much of it deals with
ILISP.

I especially recommend the font-lock package.  Having comments,
strings, and keywords in different colors is enormously helpful.

   - What commands/keystrokes to you use to start up clisp from within Emacs?

M-x clisp

   - Are you satisfied with the way it works?

Mostly.  My biggest complaint is that the *clisp* buffer refuses to
acknowledge any other input if I accidentally type a right parenthesis
which has no balancing left parenthesis.

+-     PETER DUDEY DRAKE      279-D SE Lilly Ave.,  Corvallis, OR  97333     -+
|       MS student in Artificial Intelligence, Oregon State University        |
|     "Everybody wants prosthetic foreheads on their real heads."  - TMBG     |
+-  drakep@research.cs.orst.edu        (finger dudeyp@research.cs.orst.edu)  -+

;;; Standard Emacs stuff

(display-time)
(setq-default version-control t)
(global-unset-key "\C-xf")              ; I keep hitting that by accident...
(setq-default auto-save-interval 50)
(setq next-line-add-newlines nil)
(setq teach-extended-commands-p t)
(setq meta-flag t)                      ;this too
(setq default-major-mode 'text-mode)    ;usually what I want.
(setq text-mode-hook 'turn-on-auto-fill)
(add-hook 'lisp-mode-hook
	  '(lambda () (setq comment-column 60)))
(add-hook 'c-mode-hook
	  '(lambda () (setq comment-column 60)))
(setq trim-versions-without-asking t)

(put 'eval-expression 'disabled nil)

;;; paren match
					
(defun paren-match (arg)
  "(ARG)  Go to the matching parenthesis."
  (interactive "P")
  (cond ((looking-at "[\(\[{]")
	 (forward-sexp 1)
	 (backward-char))
	((looking-at "[])}]")
	 (forward-char)
	 (backward-sexp 1))))
(global-set-key "\C-X%" 'paren-match)

;;; Did we happen to mention the modes?

(autoload 'tcl-mode "tcl-mode" "Major mode for editing tcl-scripts." t)
(setq auto-mode-alist (cons '("\\.tcl$" . tcl-mode) auto-mode-alist))
(require 'tcl)
(require 'html-mode)

;;; Things to make lisp-mode indent things properly

(require 'lisp-mode)

(put 'unless  'lisp-indent-function 1)
(put 'dolist  'lisp-indent-function 1)
(put 'dotimes 'lisp-indent-function 1)
(put 'when    'lisp-indent-function 1)
(put 'case    'lisp-indent-function 1)

(put 'multiple-value-bind 'lisp-indent-function 2)
(put 'do                  'lisp-indent-function 2)
(put 'do*                 'lisp-indent-function 2)


(setq akcl-program "/usr/local/bin/gcl")
(setq clisp-program "/usr/bin/clisp -I")
(setq ilisp-program "/usr/bin/clisp -I")

;;; A bunch of goodies for ILISP
       
;; If you always want partial minibuffer completion
(require 'completer)

(autoload 'run-ilisp "ilisp" "Select a new inferior LISP." t)
(autoload 'clisp     "ilisp" "CLISP" t)

;; This makes reading a lisp file load in ilisp.
(set-default 'auto-mode-alist
	     (append '(("\\.lisp$" . lisp-mode)) auto-mode-alist))
(add-hook 'lisp-mode-hook '(lambda () (require 'ilisp)))
;; To be honest, I'd suggest everyone disable the popper, bug or no bug.
;; If you like it great. If you want to disembowel the thing, here's how:
(setq lisp-no-popper t)
(setq popper-load-hook
      '(lambda ()
	 (setq popper-pop-buffers nil)
	 (setq popper-buffers-to-skip nil)))

;;; ********************
;;; Load much improved versions of the C and C++ modes.  At some point this
;;; will become the default in Lucid Emacs.
;;;
(fmakunbound 'c-mode)
(fmakunbound 'c++-mode)
(makunbound 'c-mode-map)
(makunbound 'c++-mode-map)
(makunbound 'c-style-alist)

(autoload 'c++-mode "cc-mode" "C++ Editing Mode" t)
(autoload 'c-mode   "cc-mode" "C Editing Mode" t)

(setq auto-mode-alist
      (append '(("\\.C$"  . c++-mode)
		("\\.cc$" . c++-mode)
		("\\.hh$" . c++-mode)
		("\\.c$"  . c-mode)
		("\\.h$"  . c-mode))
	      auto-mode-alist))

;; This controls indentation.  The default is 4 spaces but the
;; Emacs source code uses 2.
(setq c-basic-offset 2)


;;; ********************
;;; Load a partial-completion mechanism, which makes minibuffer completion
;;; search multiple words instead of just prefixes; for example, the command
;;; `M-x byte-compile-and-load-file RET' can be abbreviated as `M-x b-c-a RET'
;;; because there are no other commands whose first three words begin with
;;; the letters `b', `c', and `a' respectively.
;;;
(load-library "completer")


;;; ********************
;;; Load crypt, which is a package for automatically decoding and reencoding
;;; files by various methods - for example, you can visit a .Z or .gz file,
;;; edit it, and have it automatically re-compressed when you save it again.
;;; 
(setq crypt-encryption-type 'pgp   ; default encryption mechanism
      crypt-confirm-password t	   ; make sure new passwords are correct
					;crypt-never-ever-decrypt t  ; if you don't encrypt anything, set this to
					; tell it not to assume that "binary" files
					; are encrypted and require a password.
      )
(require 'crypt)
       
;;; ********************
;;; Font-Lock is a syntax-highlighting package.  When it is enabled and you
;;; are editing a program, different parts of your program will appear in
;;; different fonts or colors.  For example, with the code below, comments
;;; appear in red italics, function names in function definitions appear in
;;; blue bold, etc.  The code below will cause font-lock to automatically be
;;; enabled when you edit C, C++, Emacs-Lisp, and many other kinds of
;;; programs.
;;;
;;; The "Options" menu has some commands for controlling this as well.
;;;
(require 'font-lock)
(add-hook 'font-lock-mode-hook 'font-lock-use-default-colors)
;(set-face-foreground 'font-lock-function-name-face "blue")
;(set-face-foreground 'font-lock-comment-face "red")
;(set-face-foreground 'font-lock-string-face "forest green")
;(set-face-underline-p 'font-lock-string-face nil)
;(make-face-unitalic 'font-lock-string-face)
;(make-face-unitalic 'font-lock-function-name-face)
(add-hook 'emacs-lisp-mode-hook	'turn-on-font-lock)
(add-hook 'tcl-mode-hook        'turn-on-font-lock)
(add-hook 'html-mode-hook       'turn-on-font-lock)
(add-hook 'lisp-mode-hook	'turn-on-font-lock)
(add-hook 'ilisp-mode-hook      'turn-on-font-lock)
(add-hook 'c-mode-hook		'turn-on-font-lock)
(add-hook 'c++-mode-hook	'turn-on-font-lock)
(add-hook 'perl-mode-hook	'turn-on-font-lock)
(add-hook 'tex-mode-hook	'turn-on-font-lock)
(add-hook 'texinfo-mode-hook	'turn-on-font-lock)
(add-hook 'postscript-mode-hook	'turn-on-font-lock)
(add-hook 'dired-mode-hook	'turn-on-font-lock)
(add-hook 'ada-mode-hook	'turn-on-font-lock)

;;; Customize-menus adds a "Lisp" entry to the menubar
(require 'customize-menus)

;;; func-menu is a package that scans your source file for function definitions
;;; and makes a menubar entry that lets you jump to any particular function
;;; definition by selecting it from the menu.  The following code turns this on
;;; for all of the recognized languages.  Scanning the buffer takes some time,
;;; but not much.
;;;
(cond ((string-match "Lucid" emacs-version)
       (require 'func-menu)
       (define-key global-map 'f8 'function-menu)
       (add-hook 'find-file-hooks 'fume-add-menubar-entry)
       (define-key global-map "\C-cg" 'fume-prompt-function-goto)
       (define-key global-map '(shift button3) 'mouse-function-menu)
       ))

;; Options Menu Settings
;; =====================
(cond
 ((and (string-match "XEmacs" emacs-version)
       (boundp 'emacs-major-version)
       (= emacs-major-version 19)
       (>= emacs-minor-version 10))
  (setq-default highlight-paren-expression nil)
  (setq-default overwrite-mode nil)
  (setq-default teach-extended-commands-p t)
  (setq-default complex-buffers-menu-p nil)
  (setq-default buffers-menu-max-size 20)
  (setq-default case-fold-search t)
  (if (featurep 'blink-paren) (blink-paren 0))
  (if (featurep 'pending-del) (pending-delete 0))
  (set-face-font 'default "-*-Courier-Medium-R-*-*-*-160-*-*-*-*-*-*")
  (set-face-font 'modeline "-*-Courier-medium-R-*-*-*-160-*-*-*-*-*-*")
  (add-hook 'c-mode-hook 'turn-on-font-lock)
  (add-hook 'c++-mode-hook 'turn-on-font-lock)
  (add-hook 'lisp-mode-hook 'turn-on-font-lock)
  (add-hook 'emacs-lisp-mode-hook 'turn-on-font-lock)
  (require 'font-lock)
    (remove-hook 'font-lock-mode-hook 'turn-on-fast-lock)
  (setq lisp-font-lock-keywords lisp-font-lock-keywords-2)
  (set-face-foreground 'font-lock-comment-face "#6920ac")
  (set-face-foreground 'font-lock-string-face "green4")
  (set-face-foreground 'font-lock-doc-string-face "green4")
  (set-face-foreground 'font-lock-function-name-face "red3")
  (set-face-foreground 'font-lock-keyword-face "blue3")
  (set-face-foreground 'font-lock-type-face "blue3")
  ))
;; ============================
;; End of Options Menu Settings