Add Emacs configuration

This commit is contained in:
Tom Willemse 2023-03-17 01:04:03 -07:00
parent 726e44fa23
commit dd23871b67
2 changed files with 93 additions and 3 deletions

View file

@ -7,13 +7,15 @@
#:use-module ((gnu home services) #:use-module ((gnu home services)
#:select (service-type #:select (service-type
service-extension service-extension
home-profile-service-type)) home-profile-service-type
home-files-service-type))
#:use-module ((gnu home services shepherd) #:use-module ((gnu home services shepherd)
#:select (shepherd-service #:select (shepherd-service
home-shepherd-service-type)) home-shepherd-service-type))
#:use-module ((guix gexp) #:use-module ((guix gexp)
#:select (gexp #:select (gexp
file-append)) file-append
local-file))
#:use-module ((guix packages) #:use-module ((guix packages)
#:select (package?)) #:select (package?))
@ -41,6 +43,9 @@
#:log-file (format #f "~a/.local/var/log/xbindkeys.log" (getenv "HOME")))) #:log-file (format #f "~a/.local/var/log/xbindkeys.log" (getenv "HOME"))))
(stop #~(make-kill-destructor))))) (stop #~(make-kill-destructor)))))
(define (home-emacs-config-files config)
`((".emacs.d/init.el" ,(local-file "emacs/init.el"))))
(define home-emacs-service-type (define home-emacs-service-type
(service-type (service-type
(name 'home-emacs) (name 'home-emacs)
@ -50,7 +55,10 @@
add-emacs-packages) add-emacs-packages)
(service-extension (service-extension
home-shepherd-service-type home-shepherd-service-type
home-emacs-shepherd-service))) home-emacs-shepherd-service)
(service-extension
home-files-service-type
home-emacs-config-files)))
(compose identity) (compose identity)
(default-value (home-emacs-configuration)) (default-value (home-emacs-configuration))
(description "Install and configure Emacs."))) (description "Install and configure Emacs.")))

View file

@ -0,0 +1,82 @@
;;; init.el --- ryuslash's init -*- lexical-binding: t; -*-
;; Copyright (C) 2023 Tom Willemse
;; Author: Tom Willemse <tom@ryuslash.org>
;; Keywords: local
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;; This is my Emacs' init file.
;;; Code:
(require 'oni-core)
(require 'oni-gui)
(add-to-list
'auto-save-file-name-transforms
`(,(rx (zero-or-more any))
,(concat (or (getenv "XDG_DATA_HOME")
(expand-file-name "~/.local/share"))
"/emacs/auto-save-list")
t)
t)
(eval-when-compile (require 'ispell))
(with-eval-after-load 'ispell
(setq ispell-program-name "hunspell"
ispell-really-hunspell t))
(defun oni-in-word-p ()
"Check whether the character just typed was part of a word."
(save-excursion
(backward-char)
(looking-back (rx word) (1- (point)))))
(with-eval-after-load 'electric
(add-hook 'electric-quote-inhibit-functions #'oni-in-word-p))
(add-to-list 'load-path (expand-file-name "~/projects/inkplate"))
(when (require 'inkplate nil t)
(let ((my-dev (inkplate-open "/dev/ttyUSB0")))
(inkplate-clear-screen my-dev)
(inkplate-set-cursor my-dev 280 100)
(inkplate-set-text-size my-dev 10)
(inkplate-print my-dev (inkplate--convert-string-to-hex (format-time-string "%Y")))
(inkplate-set-cursor my-dev 275 180)
(inkplate-set-text-size my-dev 8)
(inkplate-print my-dev (inkplate--convert-string-to-hex (format-time-string "%m-%d")))
(inkplate-draw-rectangle my-dev 270 90 250 155 3)
(inkplate-draw-rectangle my-dev 269 89 252 157 3)
(inkplate-draw-rectangle my-dev 268 88 254 159 3)
(inkplate-partial-update my-dev)
;; It doesn't seem to update properly unless I send the same update twice.
(inkplate-partial-update my-dev)
(inkplate-send my-dev)
(delete-process (inkplate-device-process my-dev))))
(setq custom-file "~/.config/emacs/custom.el")
(load custom-file)
(provide 'init)
;;; init.el ends here