init: Add base config.

main
Pierre-Antoine 2024-04-28 13:00:47 +02:00
parent 5d21b45af8
commit bf1ecec96a
17 changed files with 568 additions and 3 deletions

2
.gitignore vendored
View File

@ -5,6 +5,8 @@
/.emacs.desktop
/.emacs.desktop.lock
*.elc
*.eln
*.el.gz
auto-save-list
tramp
.\#*

View File

@ -1,3 +0,0 @@
# emacs-config
Personnal emacs config

3
README.org Normal file
View File

@ -0,0 +1,3 @@
* Emacs configuration
Personnal emacs config

27
manifest.scm Normal file
View File

@ -0,0 +1,27 @@
(define emacs-base '("guix"))
(define emacs-style
'("helm" "emojify" "doom-modeline" "cyberpunk-theme" "nyan-mode"
"nerd-icons"))
(define emacs-dev-tools
'("guix"
"magit" "git" "gitlab-ci-mode"
"deft" "paredit"
"company" "flycheck"
"multi-term" "strace-mode"
"simple-httpd"
"geiser" "geiser-guile" "geiser-racket"))
(define emacs-dev-langs
'("tuareg" "rust-mode" "rustic" "cmake-mode" "julia-mode"
"racket-mode" "haskell-mode" "markdown-mode"))
(define (name-to-package name) (string-append "emacs-" name))
(specifications->manifest
(append '("emacs")
(map name-to-package emacs-base)
(map name-to-package emacs-style)
(map name-to-package emacs-dev-tools)
(map name-to-package emacs-dev-langs)))

78
src/Makefile Normal file
View File

@ -0,0 +1,78 @@
## Makefile --- emacs-config Makefile. -*- lexical-binding: t; -*-
# Copyright (C) 2024 Pierre-Antoine Rouby
# 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/>.
GZ = gzip
EMACS = emacs -Q -q --batch -nw
EMACS_COMPILE = -f emacs-lisp-byte-compile
EMACS_NATIVE_COMPILE = -f emacs-lisp-native-compile
EMACS_DIR = ~/.emacs.d/
EMACS_INIT_DIR = init.d/
SOURCES:=$(wildcard init/*.el)
COMPRESSED_FILE += $(SOURCES:.el=.el.gz)
COMPILED_FILE += $(SOURCES:.el=.elc)
NATIVE_COMPILED_FILE += $(SOURCES:.el=.eln)
.PHONY: clean install uninstall compile
all: compile
# Compile
compile: $(SOURCES) byte native gz
byte: $(COMPILED_FILE)
native: $(NATIVE_COMPILED_FILE)
gz: $(COMPRESSED_FILE)
%.el.gz: %.el
$(info GZ $<)
@$(GZ) -k $<
%.elc: %.el
$(info BYTE $<)
@$(EMACS) $< $(EMACS_COMPILE)
%.eln: %.el
$(info NATIVE $<)
@$(EMACS) $< $(EMACS_NATIVE_COMPILE)
# Install
install: compile install-file
install-file:
$(info INSTALL sources)
@mkdir -p $(EMACS_DIR)$(EMACS_INIT_DIR)
@cp -v ./init.el $(EMACS_DIR)
@cp -v $(COMPRESSED_FILE) $(EMACS_DIR)$(EMACS_INIT_DIR)
@cp -v $(COMPILED_FILE) $(EMACS_DIR)$(EMACS_INIT_DIR)
@cp -v $(NATIVE_COMPILED_FILE) $(EMACS_DIR)$(EMACS_INIT_DIR)
# Clean
clean:
$(info CLEAN)
@rm -fv init/*.elc
@rm -fv init/*.eln
@rm -fv init/*.el.gz
## Makefile ends here

29
src/init.el Normal file
View File

@ -0,0 +1,29 @@
;;; init.el --- Presonal GNUEmacs configuration. -*- lexical-binding: t; -*-
;;
;; Copyright (C) 2024 Pierre-Antoine Rouby
;;
;; Author: Pierre-Antoine Rouby <contact@parouby.fr>
;; Keywords: lisp
;;
;; 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:
;; Personnal GNUEmacs configuration.
;;; Code:
(mapc 'load-file
(directory-files "~/.emacs.d/init.d/"
t ".eln"))

44
src/init/0_default.el Normal file
View File

@ -0,0 +1,44 @@
;;; 0_default.el --- Init GNUEmacs configuration. -*- lexical-binding: t; -*-
;;
;; Copyright (C) 2024 Pierre-Antoine Rouby
;;
;; Author: Pierre-Antoine Rouby <contact@parouby.fr>
;; Keywords: lisp
;;
;; 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:
;; Personnal GNUEmacs configuration.
;;; Code:
;; Disable menu and tool bar
(menu-bar-mode 0)
(tool-bar-mode 0)
(recentf-mode 1) ; Save recent file list
(display-time-mode t) ; Active time mode
;; Transparent background
(set-frame-parameter (selected-frame) 'alpha '(85 . 50))
(add-to-list 'default-frame-alist '(alpha . (85 . 50)))
;; Fullscreen
(when (display-graphic-p)
(add-to-list 'default-frame-alist
'(fullscreen . maximized)))

46
src/init/10_edit.el Normal file
View File

@ -0,0 +1,46 @@
;;; 0_default.el --- Init GNUEmacs configuration. -*- lexical-binding: t; -*-
;;
;; Copyright (C) 2024 Pierre-Antoine Rouby
;;
;; Author: Pierre-Antoine Rouby <contact@parouby.fr>
;; Keywords: lisp
;;
;; 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:
;; Personnal GNUEmacs configuration.
;;; Code:
(require 'company)
(require 'flycheck)
(add-hook 'before-save-hook
'delete-trailing-whitespace)
(line-number-mode 1)
(column-number-mode 1)
;; Company
(add-hook 'after-init-hook 'global-company-mode)
(setq company-idle-delay 0.2)
(setq company-minimum-prefix-length 3)
;; Flycheck
(add-hook 'LaTex-mode-hook 'flycheck-mode)
(add-hook 'org-mode-hook 'flycheck-mode)
(add-hook 'text-mode-hook 'flycheck-mode)

29
src/init/15_c.el Normal file
View File

@ -0,0 +1,29 @@
;;; 15_c.el --- Init GNUEmacs configuration. -*- lexical-binding: t; -*-
;;
;; Copyright (C) 2024 Pierre-Antoine Rouby
;;
;; Author: Pierre-Antoine Rouby <contact@parouby.fr>
;; Keywords: lisp
;;
;; 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:
;; Personnal GNUEmacs configuration.
;;; Code:
(setq-default c-default-style "gnu" ; Use GNU indent style
c-basic-offset 2 ; Use tow stace
indent-tabs-mode nil) ; Do not use tab

50
src/init/15_lisp.el Normal file
View File

@ -0,0 +1,50 @@
;;; 15_lisp.el --- Init GNUEmacs configuration. -*- lexical-binding: t; -*-
;;
;; Copyright (C) 2024 Pierre-Antoine Rouby
;;
;; Author: Pierre-Antoine Rouby <contact@parouby.fr>
;; Keywords: lisp
;;
;; 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:
;; Personnal GNUEmacs configuration.
;;; Code:
(require 'guix)
;; Guix
(add-hook 'after-init-hook 'global-guix-prettify-mode)
;; Emacs lisp
(add-hook 'emacs-lisp-mode-hook 'paredit-mode)
(add-hook 'emacs-lisp-mode-hook 'emojify-mode)
(defun eval-string (str)
"Eval STR as sexp in string format. Return t on success and nil
on error."
(with-temp-buffer
(insert str)
(condition-case nil
(progn (eval-buffer) t)
(error (message "eval-string: error !") nil))))
;; Scheme
(add-hook 'scheme-mode-hook 'guix-devel-mode)
(add-hook 'scheme-mode-hook 'paredit-mode)

29
src/init/15_ocaml.el Normal file
View File

@ -0,0 +1,29 @@
;;; 15_c.el --- Init GNUEmacs configuration. -*- lexical-binding: t; -*-
;;
;; Copyright (C) 2024 Pierre-Antoine Rouby
;;
;; Author: Pierre-Antoine Rouby <contact@parouby.fr>
;; Keywords: lisp
;;
;; 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:
;; Personnal GNUEmacs configuration.
;;; Code:
(require 'tuareg)
(add-to-list 'auto-mode-alist '("\\.ml$" . tuareg-mode))

43
src/init/15_org.el Normal file
View File

@ -0,0 +1,43 @@
;;; 15_org.el --- Init GNUEmacs configuration. -*- lexical-binding: t; -*-
;;
;; Copyright (C) 2024 Pierre-Antoine Rouby
;;
;; Author: Pierre-Antoine Rouby <contact@parouby.fr>
;; Keywords: lisp
;;
;; 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:
;; Personnal GNUEmacs configuration.
;;; Code:
(require 'org-tempo)
(add-hook 'org-mode-hook 'emojify-mode)
(org-babel-do-load-languages
'org-babel-load-languages
'((emacs-lisp . t)
(C . t)
(python . t)
(shell . t)
(dot . t)
(scheme . t)))
;; Remplate
(add-to-list 'org-structure-template-alist '("c" . "src C :includes '(\"stdlib.h\" \"stdio.h\")"))
(add-to-list 'org-structure-template-alist '("p" . "src python :results output"))
(add-to-list 'org-structure-template-alist '("r" . "src rustic"))

34
src/init/20_helm.el Normal file
View File

@ -0,0 +1,34 @@
;;; 20_helm.el --- Init GNUEmacs configuration. -*- lexical-binding: t; -*-
;;
;; Copyright (C) 2024 Pierre-Antoine Rouby
;;
;; Author: Pierre-Antoine Rouby <contact@parouby.fr>
;; Keywords: lisp
;;
;; 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:
;; Personnal GNUEmacs configuration.
;;; Code:
(require 'helm)
(require 'helm-mode)
(helm-mode t)
(global-set-key (kbd "C-x C-f") 'helm-find-files)
(global-set-key (kbd "C-x C-b") 'helm-buffers-list)
(global-set-key (kbd "M-x") 'helm-M-x)

27
src/init/20_magit.el Normal file
View File

@ -0,0 +1,27 @@
;;; 20_magit.el --- Init GNUEmacs configuration. -*- lexical-binding: t; -*-
;;
;; Copyright (C) 2024 Pierre-Antoine Rouby
;;
;; Author: Pierre-Antoine Rouby <contact@parouby.fr>
;; Keywords: lisp
;;
;; 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:
;; Personnal GNUEmacs configuration.
;;; Code:
(global-set-key (kbd "C-x g") 'magit-status)

29
src/init/30_doom.el Normal file
View File

@ -0,0 +1,29 @@
;;; 30_doom.el --- Init GNUEmacs configuration. -*- lexical-binding: t; -*-
;;
;; Copyright (C) 2024 Pierre-Antoine Rouby
;;
;; Author: Pierre-Antoine Rouby <contact@parouby.fr>
;; Keywords: lisp
;;
;; 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:
;; Personnal GNUEmacs configuration.
;;; Code:
(require 'doom-modeline)
(doom-modeline-mode)

57
src/init/copyright.el Normal file
View File

@ -0,0 +1,57 @@
;;; copyright.el --- Init GNUEmacs configuration. -*- lexical-binding: t; -*-
;;
;; Copyright (C) 2024 Pierre-Antoine Rouby
;;
;; Author: Pierre-Antoine Rouby <contact@parouby.fr>
;; Keywords: lisp
;;
;; 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:
;; Personnal GNUEmacs configuration.
;;; Code:
(defun my-copyright ()
"Insert copyright with name and email in current buffer."
(interactive)
(copyright (format "%s <%s>"
"Pierre-Antoine Rouby"
"contact@parouby.fr")))
(defun gpl-header ()
(interactive)
(let ((pos (point)))
(goto-char (point-min))
(let ((gpl (mapc
(lambda (x)
(format "%s %s %s\n"
comment-start
x
comment-end))
'("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/>."))))
(insert (string-join gpl))
(goto-char pos))))

41
src/init/default.el Normal file
View File

@ -0,0 +1,41 @@
;;; default.el --- Presonal GNUEmacs configuration. -*- lexical-binding: t; -*-
;;
;; Copyright (C) 2024 Pierre-Antoine Rouby
;;
;; Author: Pierre-Antoine Rouby <contact@parouby.fr>
;; Keywords: lisp
;;
;; 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:
;; Personnal GNUEmacs configuration.
;;; Code:
;; Disable menu and tool bar
(menu-bar-mode 0)
(tool-bar-mode 0)
(recentf-mode 1) ; Save recent file list
(display-time-mode t) ; Active time mode
;; Transparent background
(set-frame-parameter (selected-frame) 'alpha '(85 . 50))
(add-to-list 'default-frame-alist '(alpha . (85 . 50)))
;; Fullscreen
(when (display-graphic-p)
(add-to-list 'default-frame-alist
'(fullscreen . maximized)))