Skip to content

Instantly share code, notes, and snippets.

@santanuchakrabarti
Last active February 19, 2022 18:56
Show Gist options
  • Save santanuchakrabarti/b15518780aaf52f328ca441ae0cadff9 to your computer and use it in GitHub Desktop.
Save santanuchakrabarti/b15518780aaf52f328ca441ae0cadff9 to your computer and use it in GitHub Desktop.
Configuring Emacs 27 for Common Lisp
(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.
'(package-selected-packages '(diff-hl magit treemacs project-explorer use-package))
'(pe/cache-enabled nil)
'(pe/inline-folders nil)
'(pe/width 20)
'(treemacs-python-executable "C:/Python310/python.exe"))
(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.
)
;; Define the init file
(setq custom-file (expand-file-name "custom.el" user-emacs-directory))
(when (file-exists-p custom-file)
(load custom-file))
(add-hook 'emacs-startup-hook 'toggle-frame-maximized)
;; Define and initialise package repositories
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(package-initialize)
;; use-package to simplify the config file
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))
(require 'use-package)
(setq use-package-always-ensure 't)
(setq inhibit-startup-message t)
(tool-bar-mode -1)
(defalias 'yes-or-no-p 'y-or-n-p)
;; Customize EMACS to allow package search based on name
;; Taken from:
;; https://stackoverflow.com/questions/41204532/is-there-some-kind-of-package-search-function-available-for-emacs
;; USAGE: M-x apropose-package
(defun apropos-package--filter (string)
(let (packages)
(dolist (package-assoc package-archive-contents)
(let ((package (cadr package-assoc)))
(when (or (string-match-p (regexp-quote string) (package-desc-summary package))
(string-match-p (regexp-quote string) (prin1-to-string (package-desc-name package))))
(push package packages))))
packages))
(defun apropos-package (string)
(interactive "sSearch for package: ")
;; Initialize the package system if necessary.
(unless package--initialized
(package-initialize t))
(let ((packages (apropos-package--filter string)))
(if (null packages)
(message "No packages")
(package-show-package-list (mapcar 'package-desc-name packages)))))
;; End package search function
(add-to-list 'custom-theme-load-path "~/.emacs.d/libs/theme/atom-one-dark-theme")
(load-theme 'atom-one-dark t)
;; This works nicely. It provides the parent, '..', directory unlike nav.
;;(use-package project-explorer
;; :ensure t)
;;(project-explorer-open)
(use-package treemacs
:ensure t)
(add-hook 'emacs-startup-hook 'treemacs)
(treemacs-git-mode 'deferred) ;; Enabling Treemacs to show Git status
;; Workaround to stop Treemacs from directory flattening
(with-eval-after-load 'treemacs
(setf treemacs-collapse-dirs 0))
(add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on)
;; Integrating SLIME with EMACS for Common Lisp
(load (expand-file-name "~/quicklisp/slime-helper.el"))
(show-paren-mode 1)
(add-hook 'lisp-mode-hook (lambda () (slime-mode t)))
(add-hook 'inferior-lisp-mode-hook (lambda () (inferior-slime-mode t)))
;; Replace "sbcl" with the path to your implementation
(setq inferior-lisp-program "abcl")
;; For using Git with Magit
(use-package magit
:ensure t)
(autoload 'magit-status "magit" nil t)
(use-package diff-hl
:ensure t)
(add-hook 'magit-pre-refresh-hook 'diff-hl-magit-pre-refresh)
(add-hook 'magit-post-refresh-hook 'diff-hl-magit-post-refresh)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment