Difference between revisions of "Common Lisp Environment Configuration"
From copec
(Created page with "=== Basic Environment === * Emacs installed via package manager * SBCL installed via package manager * ~/.emacs.d/init.el: <pre> ;; ~/.emacs.d/init.el (require 'cl) (require '...") |
|||
(23 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | === | + | == Overview == |
− | + | Development environment for CL including an IDE (Emacs+SLIME), implementation (SBCL), and library management (Quicklisp+ASDF) | |
− | + | ||
− | + | == March 2021 Install == | |
+ | === Links === | ||
+ | [https://www.emacswiki.org/emacs/InstallingPackages EmacsWiki: Installing Packages] | ||
+ | |||
+ | [https://melpa.org/#/getting-started Installing MELPA Packages] | ||
+ | |||
+ | [https://github.com/slime/slime Github: slime repo] | ||
+ | |||
+ | [https://emacsforosx.com/ GNU Emacs For Mac OS X] | ||
+ | |||
+ | [https://github.com/roswell/roswell/wiki/Initial-Recommended-Setup Roswell Configuration] | ||
+ | |||
+ | [https://roswell.github.io/Initial-Recommended-Setup.html Roswell Configuration 9/6/21] | ||
+ | |||
+ | === Emacs Config === | ||
+ | <pre> | ||
+ | ;; ~/.emacs.d/init.el | ||
+ | (require 'cl) | ||
+ | (require 'package) ;; You might already have this line | ||
+ | (add-to-list 'package-archives | ||
+ | '("melpa" . "https://melpa.org/packages/") t) | ||
+ | (when (< emacs-major-version 24) | ||
+ | ;; For important compatibility libraries like cl-lib | ||
+ | (add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/"))) | ||
+ | (package-initialize) ;; You might already have this line | ||
+ | |||
+ | ;; Setup load-path, autoloads and your lisp system | ||
+ | ;; Not needed if you install SLIME via MELPA | ||
+ | ;;(add-to-list 'load-path "/usr/share/emacs/site-lisp/slime") | ||
+ | ;;(require 'slime-autoloads) | ||
+ | ;;(setq inferior-lisp-program "/usr/bin/sbcl") | ||
+ | ;;(setq inferior-lisp-program "/usr/local/bin/ros -Q run") | ||
+ | |||
+ | ;;(slime-setup '(slime-fancy | ||
+ | ;; slime-xref-browser | ||
+ | ;; slime-asdf | ||
+ | ;; slime-banner | ||
+ | ;; slime-repl | ||
+ | ;; slime-indentation | ||
+ | ;; slime-fuzzy | ||
+ | ;; slime-autodoc | ||
+ | ;; slime-presentations | ||
+ | ;; slime-presentation-streams)) | ||
+ | |||
+ | (load (expand-file-name "~/.roswell/helper.el")) | ||
+ | |||
+ | |||
+ | (setq backup-directory-alist `(("." . "~/.saves"))) | ||
+ | (setq backup-by-copying t) | ||
+ | |||
+ | |||
+ | (custom-set-variables | ||
+ | ;; custom-set-variables was added by Custom. | ||
+ | ;; If you edit it by hand, you could mess it up, so be careful. | ||
+ | ;; Your init file should contain only one such instance. | ||
+ | ;; If there is more than one, they won't work right. | ||
+ | '(custom-enabled-themes (quote (misterioso))) | ||
+ | '(inhibit-startup-screen t) | ||
+ | '(package-selected-packages (quote (slime)))) | ||
+ | |||
+ | |||
+ | (custom-set-faces | ||
+ | ;; custom-set-faces was added by Custom. | ||
+ | ;; If you edit it by hand, you could mess it up, so be careful. | ||
+ | ;; Your init file should contain only one such instance. | ||
+ | ;; If there is more than one, they won't work right. | ||
+ | '(default ((t (:family "DejaVu Sans Mono" :foundry "PfEd" :slant normal :weight normal :height 98 :width normal))))) | ||
+ | |||
+ | |||
+ | ;(tool-bar-mode -1) | ||
+ | (setq tool-bar-style 'text) | ||
+ | (setq frame-resize-pixelwise t) | ||
+ | |||
+ | |||
+ | ;; Custom functions/hooks for persisting/loading frame geometry upon save/load | ||
+ | (defun save-frameg () | ||
+ | "Gets the current frame's geometry and saves to ~/.emacs.frameg." | ||
+ | (let ((frameg-font (frame-parameter (selected-frame) 'font)) | ||
+ | (frameg-left (frame-parameter (selected-frame) 'left)) | ||
+ | (frameg-top (frame-parameter (selected-frame) 'top)) | ||
+ | (frameg-width (frame-parameter (selected-frame) 'width)) | ||
+ | (frameg-height (frame-parameter (selected-frame) 'height)) | ||
+ | (frameg-file (expand-file-name "~/.emacs.frameg"))) | ||
+ | (with-temp-buffer | ||
+ | ;; Turn off backup for this file | ||
+ | (make-local-variable 'make-backup-files) | ||
+ | (setq make-backup-files nil) | ||
+ | (insert | ||
+ | ";;; This file stores the previous emacs frame's geometry.\n" | ||
+ | ";;; Last generated " (current-time-string) ".\n" | ||
+ | "(setq initial-frame-alist\n" | ||
+ | ;; " '((font . \"" frameg-font "\")\n" | ||
+ | " '(" | ||
+ | (format " (top . %d)\n" (max frameg-top 0)) | ||
+ | (format " (left . %d)\n" (max frameg-left 0)) | ||
+ | (format " (width . %d)\n" (max frameg-width 0)) | ||
+ | (format " (height . %d)))\n" (max frameg-height 0))) | ||
+ | (when (file-writable-p frameg-file) | ||
+ | (write-file frameg-file))))) | ||
+ | |||
+ | (defun load-frameg () | ||
+ | "Loads ~/.emacs.frameg which should load the previous frame's geometry." | ||
+ | (let ((frameg-file (expand-file-name "~/.emacs.frameg"))) | ||
+ | (when (file-readable-p frameg-file) | ||
+ | (load-file frameg-file)))) | ||
+ | |||
+ | ;; Special work to do ONLY when there is a window system being used | ||
+ | (if window-system | ||
+ | (progn | ||
+ | (add-hook 'after-init-hook 'load-frameg) | ||
+ | (add-hook 'kill-emacs-hook 'save-frameg))) | ||
+ | </pre> | ||
+ | |||
+ | == Configuration (Steps) == | ||
+ | |||
+ | === Emacs installed via package manager === | ||
+ | |||
+ | === SBCL installed via package manager === | ||
+ | |||
+ | === Initial Emacs Configuration === | ||
+ | ==== ~/.emacs.d/init.el ==== | ||
<pre> | <pre> | ||
;; ~/.emacs.d/init.el | ;; ~/.emacs.d/init.el | ||
Line 13: | Line 133: | ||
(add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/"))) | (add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/"))) | ||
(package-initialize) ;; You might already have this line | (package-initialize) ;; You might already have this line | ||
+ | </pre> | ||
+ | === Install SLIME === | ||
+ | * Execute in Emacs: <pre>M-x package-install RET slime RET</pre> | ||
+ | |||
+ | === Append Emacs Configuration === | ||
+ | ==== ~/.emacs.d/init.el ==== | ||
+ | <pre> | ||
;; Setup load-path, autoloads and your lisp system | ;; Setup load-path, autoloads and your lisp system | ||
;; Not needed if you install SLIME via MELPA | ;; Not needed if you install SLIME via MELPA | ||
Line 20: | Line 147: | ||
(setq inferior-lisp-program "/usr/bin/sbcl") | (setq inferior-lisp-program "/usr/bin/sbcl") | ||
− | (slime-setup '(slime-fancy slime-xref-browser slime-asdf slime-banner slime-repl slime-indentation slime-fuzzy slime-autodoc slime-presentations slime-presentation-streams)) | + | (slime-setup '(slime-fancy |
+ | slime-xref-browser | ||
+ | slime-asdf | ||
+ | slime-banner | ||
+ | slime-repl | ||
+ | slime-indentation | ||
+ | slime-fuzzy | ||
+ | slime-autodoc | ||
+ | slime-presentations | ||
+ | slime-presentation-streams)) | ||
(setq backup-directory-alist `(("." . "~/.saves"))) | (setq backup-directory-alist `(("." . "~/.saves"))) | ||
(setq backup-by-copying t) | (setq backup-by-copying t) | ||
+ | |||
+ | (tool-bar-mode -1) | ||
+ | </pre> | ||
+ | |||
+ | === Install Quicklisp === | ||
+ | The only requirement for Quicklisp is that SBCL is installed (SBCL includes a sufficient ASDF version). | ||
+ | |||
+ | <pre> | ||
+ | $ curl -O https://beta.quicklisp.org/quicklisp.lisp | ||
+ | |||
+ | $ sbcl --load quicklisp.lisp | ||
+ | * (quicklisp-quickstart:install) | ||
+ | * (ql:add-to-init-file) | ||
+ | * (quit) | ||
+ | </pre> | ||
+ | |||
+ | ==== ~/.sbclrc ==== | ||
+ | <pre> | ||
+ | ;;; The following lines added by ql:add-to-init-file: | ||
+ | #-quicklisp | ||
+ | (let ((quicklisp-init (merge-pathnames "quicklisp/setup.lisp" | ||
+ | (user-homedir-pathname)))) | ||
+ | (when (probe-file quicklisp-init) | ||
+ | (load quicklisp-init))) | ||
+ | </pre> | ||
+ | |||
+ | === Allow Quicklisp/ASDF to find my source === | ||
+ | ==== ~/.config/common-lisp/source-registry.conf.d/projects.conf ==== | ||
+ | <pre> | ||
+ | (:tree (:home "org.unaen.dev.src/lisp/")) | ||
</pre> | </pre> |
Latest revision as of 18:30, 21 September 2021
Contents
Overview
Development environment for CL including an IDE (Emacs+SLIME), implementation (SBCL), and library management (Quicklisp+ASDF)
March 2021 Install
Links
EmacsWiki: Installing Packages
Emacs Config
;; ~/.emacs.d/init.el (require 'cl) (require 'package) ;; You might already have this line (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t) (when (< emacs-major-version 24) ;; For important compatibility libraries like cl-lib (add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/"))) (package-initialize) ;; You might already have this line ;; Setup load-path, autoloads and your lisp system ;; Not needed if you install SLIME via MELPA ;;(add-to-list 'load-path "/usr/share/emacs/site-lisp/slime") ;;(require 'slime-autoloads) ;;(setq inferior-lisp-program "/usr/bin/sbcl") ;;(setq inferior-lisp-program "/usr/local/bin/ros -Q run") ;;(slime-setup '(slime-fancy ;; slime-xref-browser ;; slime-asdf ;; slime-banner ;; slime-repl ;; slime-indentation ;; slime-fuzzy ;; slime-autodoc ;; slime-presentations ;; slime-presentation-streams)) (load (expand-file-name "~/.roswell/helper.el")) (setq backup-directory-alist `(("." . "~/.saves"))) (setq backup-by-copying t) (custom-set-variables ;; custom-set-variables was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. '(custom-enabled-themes (quote (misterioso))) '(inhibit-startup-screen t) '(package-selected-packages (quote (slime)))) (custom-set-faces ;; custom-set-faces was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. '(default ((t (:family "DejaVu Sans Mono" :foundry "PfEd" :slant normal :weight normal :height 98 :width normal))))) ;(tool-bar-mode -1) (setq tool-bar-style 'text) (setq frame-resize-pixelwise t) ;; Custom functions/hooks for persisting/loading frame geometry upon save/load (defun save-frameg () "Gets the current frame's geometry and saves to ~/.emacs.frameg." (let ((frameg-font (frame-parameter (selected-frame) 'font)) (frameg-left (frame-parameter (selected-frame) 'left)) (frameg-top (frame-parameter (selected-frame) 'top)) (frameg-width (frame-parameter (selected-frame) 'width)) (frameg-height (frame-parameter (selected-frame) 'height)) (frameg-file (expand-file-name "~/.emacs.frameg"))) (with-temp-buffer ;; Turn off backup for this file (make-local-variable 'make-backup-files) (setq make-backup-files nil) (insert ";;; This file stores the previous emacs frame's geometry.\n" ";;; Last generated " (current-time-string) ".\n" "(setq initial-frame-alist\n" ;; " '((font . \"" frameg-font "\")\n" " '(" (format " (top . %d)\n" (max frameg-top 0)) (format " (left . %d)\n" (max frameg-left 0)) (format " (width . %d)\n" (max frameg-width 0)) (format " (height . %d)))\n" (max frameg-height 0))) (when (file-writable-p frameg-file) (write-file frameg-file))))) (defun load-frameg () "Loads ~/.emacs.frameg which should load the previous frame's geometry." (let ((frameg-file (expand-file-name "~/.emacs.frameg"))) (when (file-readable-p frameg-file) (load-file frameg-file)))) ;; Special work to do ONLY when there is a window system being used (if window-system (progn (add-hook 'after-init-hook 'load-frameg) (add-hook 'kill-emacs-hook 'save-frameg)))
Configuration (Steps)
Emacs installed via package manager
SBCL installed via package manager
Initial Emacs Configuration
~/.emacs.d/init.el
;; ~/.emacs.d/init.el (require 'cl) (require 'package) ;; You might already have this line (add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/") t) (when (< emacs-major-version 24) ;; For important compatibility libraries like cl-lib (add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/"))) (package-initialize) ;; You might already have this line
Install SLIME
- Execute in Emacs:
M-x package-install RET slime RET
Append Emacs Configuration
~/.emacs.d/init.el
;; Setup load-path, autoloads and your lisp system ;; Not needed if you install SLIME via MELPA ;;(add-to-list 'load-path "/usr/share/emacs/site-lisp/slime") (require 'slime-autoloads) (setq inferior-lisp-program "/usr/bin/sbcl") (slime-setup '(slime-fancy slime-xref-browser slime-asdf slime-banner slime-repl slime-indentation slime-fuzzy slime-autodoc slime-presentations slime-presentation-streams)) (setq backup-directory-alist `(("." . "~/.saves"))) (setq backup-by-copying t) (tool-bar-mode -1)
Install Quicklisp
The only requirement for Quicklisp is that SBCL is installed (SBCL includes a sufficient ASDF version).
$ curl -O https://beta.quicklisp.org/quicklisp.lisp $ sbcl --load quicklisp.lisp * (quicklisp-quickstart:install) * (ql:add-to-init-file) * (quit)
~/.sbclrc
;;; The following lines added by ql:add-to-init-file: #-quicklisp (let ((quicklisp-init (merge-pathnames "quicklisp/setup.lisp" (user-homedir-pathname)))) (when (probe-file quicklisp-init) (load quicklisp-init)))
Allow Quicklisp/ASDF to find my source
~/.config/common-lisp/source-registry.conf.d/projects.conf
(:tree (:home "org.unaen.dev.src/lisp/"))