|
|
1.1 ! root 1: ;; $Header: clinit.cl,v 1.8 89/02/14 17:17:05 layer Exp $ ! 2: ! 3: #| ! 4: ! 5: ;; Put the following single line in your .login file: ! 6: ! 7: setenv EMACSLIBRARY /usr/local/lib/emacs ! 8: ! 9: ;; Then, put the following single form in your .emacs file: ! 10: ! 11: (setq fi:unix-domain-socket ! 12: (format "/tmp/%s_emacs_to_acl" (user-login-name))) ! 13: ! 14: ;; Then, put the following single form in your .clinit file: ! 15: ! 16: (defparameter *emacs-library* ! 17: (let ((emacs-lib (si:getenv "EMACSLIBRARY"))) ! 18: (if emacs-lib (format nil "~a/lisp/fi/" emacs-lib)))) ! 19: ! 20: ;; plus one of the following three forms (after the above form) ! 21: ! 22: ;;;;;;; Form 1 ! 23: ;; this will load the ipc package and unconditionally start it up ! 24: (and *emacs-library* ! 25: (load (merge-pathnames "clinit.cl" *emacs-library*)) ! 26: (load-and-start-ipc-package)) ! 27: ! 28: ;;;;;;; Form 2 ! 29: ;; this will load the ipc package and start it up when `+ipc' is given on ! 30: ;; the Allegro CL command line. For example, if you put the following in ! 31: ;; your .emacs file: ! 32: ;; ! 33: ;; (setq fi:common-lisp-image-arguments '("+ipc")) ! 34: ;; ! 35: ;; then when you startup Allegro CL from within emacs (fi:common-lisp) you ! 36: ;; will automatically load and start the emacs/lisp interface. ! 37: (and *emacs-library* ! 38: (find "+ipc" (system:command-line-arguments) :test #'string=) ! 39: (load (merge-pathnames "clinit.cl" *emacs-library*)) ! 40: (load-and-start-ipc-package)) ! 41: ! 42: ;;;;;;; Form 3 ! 43: ;; this will load the ipc package and require you to start it manually ! 44: ;; with the top-level command `:listen'. ! 45: (tpl:alias "listen" () ! 46: (and *emacs-library* ! 47: (load (merge-pathnames "clinit.cl" *emacs-library*)) ! 48: (load-and-start-ipc-package))) ! 49: ! 50: |# ! 51: ! 52: ;;;;; NOTE: ! 53: ;; The rest of this file will be loaded when the forms you just added ! 54: ;; to your .clinit.cl are evaluated, so there is no need to put it in your ! 55: ;; .clinit.cl!!! ! 56: ! 57: (defmacro svalue (package symbol) ! 58: `(let ((p ,package) (s ,symbol)) ! 59: (values (find-symbol (symbol-name s) p)))) ! 60: ! 61: (defun load-and-start-ipc-package (&key (unix-domain nil udp)) ! 62: (excl::handler-case ! 63: (let ((emacs-library ! 64: (format nil "~a/lisp/fi/" (si:getenv "EMACSLIBRARY")))) ! 65: (if* emacs-library ! 66: then (let* ((first (car si:*require-search-list*)) ! 67: (do-pop (atom first))) ! 68: (if do-pop (pop si:*require-search-list*)) ! 69: (push (make-pathname :directory emacs-library :type "fasl") ! 70: si:*require-search-list*) ! 71: (push first si:*require-search-list*)) ! 72: (if (find-package :ipc) ! 73: (set (svalue :ipc :lisp-listener-daemon-ff-loaded) nil)) ! 74: (require :ipc) ! 75: (require :emacs) ! 76: (if udp (set (svalue :ipc :*unix-domain*) unix-domain)) ! 77: (let ((s (svalue :ipc :*socket-pathname*)) ! 78: (socket-file ! 79: (format nil "/tmp/~a_emacs_to_acl" ! 80: (excl::userid-to-name ! 81: (funcall (svalue :ipc :getuid)))))) ! 82: (if (boundp s) (set s socket-file)) ! 83: (funcall (svalue :ipc :start-lisp-listener-daemon))) ! 84: else (format t "~%EMACSLIBRARY is not in the environment~%"))) ! 85: (error (condition) (format t "error during ipc initialization: ~a" ! 86: condition))))
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.