diff --git a/.gitignore b/.gitignore index 0cfc7747a480839479f37cdaf44b21518a31d034..cdab239d409ac9c2a251547c47dbc225911d4b75 100644 --- a/.gitignore +++ b/.gitignore @@ -11,7 +11,7 @@ bin *.log *.toc - +configure.el # Ignore (generated) html files, # *.html diff --git a/emacs/gdl.el b/emacs/gdl.el index 299b39f9c176bb87a65ae057914484a120510473..477a85186a563c30395bbc860bd8d8638561930f 100644 --- a/emacs/gdl.el +++ b/emacs/gdl.el @@ -108,7 +108,7 @@ (defun gendl-quit () (interactive) (gdl-quit)) -;; 4.2. Configure slime +;; 4.2. Locate Common Lisp / Locate SLIME ;; ;; Where is our Common Lisp implementation? Where is slime-helper.el? ;; Loading the latter means we can load slime-autoloads.el (which @@ -136,6 +136,7 @@ (slime-setup '(slime-fancy slime-banner)) (add-hook 'slime-connected-hook 'load-gendl t) (add-hook 'slime-connected-hook 'set-slime-shortcuts) + (add-hook 'slime-connected-hook 'customise-slime) (add-hook 'slime-repl-mode-hook 'remove-dos-eol) (add-to-list 'auto-mode-alist '("\\.cl\\'" . lisp-mode)) (add-to-list 'auto-mode-alist '("\\.gdl\\'" . lisp-mode)) @@ -154,6 +155,9 @@ (global-set-key "\C-x&" '(lambda()(interactive) (switch-to-buffer (slime-repl-buffer)))) (global-set-key "\C-x*" '(lambda()(interactive) (switch-to-buffer "*inferior-lisp*")))) +(defun customise-slime () + (setq slime-autodoc-use-multiline-p t)) + (defun remove-dos-eol () "Do not show ^M in files containing mixed UNIX and DOS line endings." (interactive) diff --git a/emacs/gendl.lisp b/emacs/gendl.lisp index 78b2a0ea139658e32d14c52bc6edbf5615f772c6..bf139c50a53040eb94dfcc0f854c8422d183e9b9 100644 --- a/emacs/gendl.lisp +++ b/emacs/gendl.lisp @@ -24,7 +24,7 @@ ;; This document is not confidential. See end for copyright ;; information. -(defparameter *gendl-slime-release* "0.1.0") +(defparameter *gendl-slime-release* "0.1.1") ;; 2. TESTS diff --git a/gendl.asd b/gendl.asd index 3dbe4d65e66d2dc402f97162c99ce1940d8eeb53..3b3ac37af729fcf45d77ffe1136226e429ac1c54 100644 --- a/gendl.asd +++ b/gendl.asd @@ -1,80 +1,80 @@ -(in-package :asdf) - -(defsystem #:gendl - :description "The Gendl Project" - :author "Dave Cooper " - :license "Affero Gnu General Public License (please see http://www.gnu.org/licenses/)" - :serial t - #+asdf-encoding :encoding #+asdf-encoding :utf-8 - :version "2013031600" - :depends-on (:cl-lite :gwl-graphics :tasty :robot :yadd)) - -(defmethod perform :after ((op load-op) (system (eql (find-system "gendl")))) - (declare (ignore op)) - ;; Check whether GENDL has been configured yet. - (multiple-value-bind (found ignore system-pathname) - (locate-system system) - (declare (ignore ignore)) - (if found - (let ((config-file (merge-pathnames "configure.el" system-pathname))) - (unless (probe-file config-file) - ;; Looks like this is the first time around. - (configure-gendl config-file))) - (warn "ASDF cannot locate the GENDL which it just loaded. Further configuration not possible.")))) - -(defparameter *setup-gendl-template* " -;; CONFIGURE.EL -;; -;; The purpose of this document is to configure (a) the lisp -;; invocation to be used for running GENDL and (b) the location of -;; your quicklisp installation. -;; -;; This file will be written automatically when the GENDL system is -;; loaded for the first time. You may edit it yourself but do take -;; care: the file is loaded by both EMACS and Common Lisp. We suggest -;; you don't add any other forms to the file.~@{~2%~s~}") - -(defparameter *setup-emacs-template* " - -********************************************************************* - -To configure your EMACS to work with GENDL, add the following to your -.emacs file: - - (defun start-gendl () (interactive) (load ~s)) - ;; (global-set-key [f10] 'start-gendl) - -") - - -(defun configure-gendl (config-file) - (unless (probe-file config-file) - (let ((lisp-invocation (funcall (find-symbol (string 'basic-command-line-arguments) :glisp))) - (path-to-quicklisp-helper (ql-setup:qmerge "slime-helper.el"))) - ;; This is unfortunate. Clozure won't give you the heap name - ;; unless you chase after it specifically. - #+:ccl - (let ((heap ccl:*heap-image-name*)) - (setf lisp-invocation `(,(car lisp-invocation) "-I" ,heap ,@(cdr lisp-invocation)))) - - ;; 1. Write the config file. - (with-open-file (out config-file :direction :output) - (let ((*package* (find-package :common-lisp-user)) - (*print-case* :downcase)) - (format out *setup-gendl-template* - `(setq ,'cl-user::lisp-invocation ',lisp-invocation) - `(setq ,'cl-user::path-to-quicklisp-helper ,(namestring path-to-quicklisp-helper))))) - - ;; 2. Download quicklisp-slime-helper - (let* (;; We intend to overwrite the default output from quicklisp-slime-helper:install - (standard-output *standard-output*) - (*standard-output* (make-broadcast-stream))) - (handler-bind ((serious-condition (lambda (e) (declare (ignore e)) (setf *standard-output* standard-output)))) - (ql:quickload :quicklisp-slime-helper))) - - ;; 3. Add GENDL-loading form to .emacs - (let ((path-to-gdl-loader (merge-pathnames "emacs/gdl.el" config-file))) - (format t *setup-emacs-template* (namestring path-to-gdl-loader))) - - config-file))) - +(in-package :asdf) + +(defsystem #:gendl + :description "The Gendl Project" + :author "Dave Cooper " + :license "Affero Gnu General Public License (please see http://www.gnu.org/licenses/)" + :serial t + #+asdf-encoding :encoding #+asdf-encoding :utf-8 + :version "2013031600" + :depends-on (:cl-lite :gwl-graphics :tasty :robot :yadd)) + +(defmethod perform :after ((op load-op) (system (eql (find-system "gendl")))) + (declare (ignore op)) + ;; Check whether GENDL has been configured yet. + (multiple-value-bind (found ignore system-pathname) + (locate-system system) + (declare (ignore ignore)) + (if found + (let ((config-file (merge-pathnames "configure.el" system-pathname))) + (unless (probe-file config-file) + ;; Looks like this is the first time around. + (configure-gendl config-file))) + (warn "ASDF cannot locate the GENDL which it just loaded. Further configuration not possible.")))) + +(defparameter *setup-gendl-template* "~ +;; CONFIGURE.EL +;; +;; The purpose of this document is to configure (a) the lisp +;; invocation to be used for running GENDL and (b) the location of +;; your quicklisp installation. +;; +;; This file will be written automatically when the GENDL system is +;; loaded for the first time. You may edit it yourself but do take +;; care: the file is loaded by both EMACS and Common Lisp. We suggest +;; you don't add any other forms to the file.~@{~2%~s~}") + +(defparameter *setup-emacs-template* " + +********************************************************************* + +To configure your EMACS to work with GENDL, add the following to your +.emacs file: + + (defun start-gendl () (interactive) (load ~s)) + ;; (global-set-key [f10] 'start-gendl) + +") + + +(defun configure-gendl (config-file) + (unless (probe-file config-file) + (let ((lisp-invocation (funcall (find-symbol (string 'basic-command-line-arguments) :glisp))) + (path-to-quicklisp-helper (ql-setup:qmerge "slime-helper.el"))) + ;; This is unfortunate. Clozure won't give you the heap name + ;; unless you chase after it specifically. + #+:ccl + (let ((heap ccl:*heap-image-name*)) + (setf lisp-invocation `(,(car lisp-invocation) "-I" ,heap ,@(cdr lisp-invocation)))) + + ;; 1. Write the config file. + (with-open-file (out config-file :direction :output) + (let ((*package* (find-package :common-lisp-user)) + (*print-case* :downcase)) + (format out *setup-gendl-template* + `(setq ,'cl-user::lisp-invocation ',lisp-invocation) + `(setq ,'cl-user::path-to-quicklisp-helper ,(namestring path-to-quicklisp-helper))))) + + ;; 2. Download quicklisp-slime-helper + (let* (;; We intend to overwrite the default output from quicklisp-slime-helper:install + (standard-output *standard-output*) + (*standard-output* (make-broadcast-stream))) + (handler-bind ((serious-condition (lambda (e) (declare (ignore e)) (setf *standard-output* standard-output)))) + (ql:quickload :quicklisp-slime-helper))) + + ;; 3. Add GENDL-loading form to .emacs + (let ((path-to-gdl-loader (merge-pathnames "emacs/gdl.el" config-file))) + (format t *setup-emacs-template* (namestring path-to-gdl-loader))) + + config-file))) + diff --git a/load-gendl.lisp b/load-gendl.lisp index 7d113046c50d023455db182d247fb7debfc8978c..57240d166aaaff0000c629c06c4c974651e3fe33 100644 --- a/load-gendl.lisp +++ b/load-gendl.lisp @@ -56,7 +56,7 @@ ;; 3. Load gendl plus dependencies. - (funcall (find-symbol "QUICKLOAD" "QL") :gendl) + (funcall (find-symbol (string 'quickload) :ql) :gendl) ;; 4. Load the slime integration. Ideally this should be done ;; (conditionally) by the quickload above. @@ -64,9 +64,16 @@ #+:swank (load (compile-file (merge-pathnames "emacs/gendl.lisp" gendl))) + ;; 4a. This is a workaround for https://bugs.launchpad.net/slime/+bug/1175550 + ;; "#+lispworks Gray slime-output-stream doesn't handle non base-chars" + #+:lispworks + (setf (slot-value *standard-output* 'swank-backend::buffer) + (coerce (slot-value *standard-output* 'swank-backend::buffer) + 'lw:simple-text-string)) + ;; 5. Start gendl. - (let ((starter (find-symbol "START-GENDL!" "GENDL"))) + (let ((starter (find-symbol (string 'start-gendl!) :gendl))) (funcall starter)))