diff --git a/.gitignore b/.gitignore index c0df46a..01f5936 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,8 @@ /.emacs.desktop /.emacs.desktop.lock *.elc +*.eln +*.el.gz auto-save-list tramp .\#* diff --git a/README.md b/README.md deleted file mode 100644 index 62bf149..0000000 --- a/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# emacs-config - -Personnal emacs config \ No newline at end of file diff --git a/README.org b/README.org new file mode 100644 index 0000000..ff36bb4 --- /dev/null +++ b/README.org @@ -0,0 +1,3 @@ +* Emacs configuration + +Personnal emacs config diff --git a/manifest.scm b/manifest.scm new file mode 100644 index 0000000..1097f8f --- /dev/null +++ b/manifest.scm @@ -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))) diff --git a/src/Makefile b/src/Makefile new file mode 100644 index 0000000..6c98f1b --- /dev/null +++ b/src/Makefile @@ -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 . + +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 diff --git a/src/init.el b/src/init.el new file mode 100644 index 0000000..5cba2cd --- /dev/null +++ b/src/init.el @@ -0,0 +1,29 @@ +;;; init.el --- Presonal GNUEmacs configuration. -*- lexical-binding: t; -*- +;; +;; Copyright (C) 2024 Pierre-Antoine Rouby +;; +;; Author: Pierre-Antoine Rouby +;; 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 . + +;;; Commentary: + +;; Personnal GNUEmacs configuration. + +;;; Code: + +(mapc 'load-file + (directory-files "~/.emacs.d/init.d/" + t ".eln")) diff --git a/src/init/0_default.el b/src/init/0_default.el new file mode 100644 index 0000000..d517913 --- /dev/null +++ b/src/init/0_default.el @@ -0,0 +1,44 @@ +;;; 0_default.el --- Init GNUEmacs configuration. -*- lexical-binding: t; -*- +;; +;; Copyright (C) 2024 Pierre-Antoine Rouby +;; +;; Author: Pierre-Antoine Rouby +;; 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 . + +;;; 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))) diff --git a/src/init/10_edit.el b/src/init/10_edit.el new file mode 100644 index 0000000..6772721 --- /dev/null +++ b/src/init/10_edit.el @@ -0,0 +1,46 @@ +;;; 0_default.el --- Init GNUEmacs configuration. -*- lexical-binding: t; -*- +;; +;; Copyright (C) 2024 Pierre-Antoine Rouby +;; +;; Author: Pierre-Antoine Rouby +;; 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 . + +;;; 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) diff --git a/src/init/15_c.el b/src/init/15_c.el new file mode 100644 index 0000000..f524789 --- /dev/null +++ b/src/init/15_c.el @@ -0,0 +1,29 @@ +;;; 15_c.el --- Init GNUEmacs configuration. -*- lexical-binding: t; -*- +;; +;; Copyright (C) 2024 Pierre-Antoine Rouby +;; +;; Author: Pierre-Antoine Rouby +;; 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 . + +;;; 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 diff --git a/src/init/15_lisp.el b/src/init/15_lisp.el new file mode 100644 index 0000000..9f7b978 --- /dev/null +++ b/src/init/15_lisp.el @@ -0,0 +1,50 @@ +;;; 15_lisp.el --- Init GNUEmacs configuration. -*- lexical-binding: t; -*- +;; +;; Copyright (C) 2024 Pierre-Antoine Rouby +;; +;; Author: Pierre-Antoine Rouby +;; 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 . + +;;; 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) diff --git a/src/init/15_ocaml.el b/src/init/15_ocaml.el new file mode 100644 index 0000000..14eeee7 --- /dev/null +++ b/src/init/15_ocaml.el @@ -0,0 +1,29 @@ +;;; 15_c.el --- Init GNUEmacs configuration. -*- lexical-binding: t; -*- +;; +;; Copyright (C) 2024 Pierre-Antoine Rouby +;; +;; Author: Pierre-Antoine Rouby +;; 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 . + +;;; Commentary: + +;; Personnal GNUEmacs configuration. + +;;; Code: + +(require 'tuareg) + +(add-to-list 'auto-mode-alist '("\\.ml$" . tuareg-mode)) diff --git a/src/init/15_org.el b/src/init/15_org.el new file mode 100644 index 0000000..c81cad7 --- /dev/null +++ b/src/init/15_org.el @@ -0,0 +1,43 @@ +;;; 15_org.el --- Init GNUEmacs configuration. -*- lexical-binding: t; -*- +;; +;; Copyright (C) 2024 Pierre-Antoine Rouby +;; +;; Author: Pierre-Antoine Rouby +;; 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 . + +;;; 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")) diff --git a/src/init/20_helm.el b/src/init/20_helm.el new file mode 100644 index 0000000..68231c2 --- /dev/null +++ b/src/init/20_helm.el @@ -0,0 +1,34 @@ +;;; 20_helm.el --- Init GNUEmacs configuration. -*- lexical-binding: t; -*- +;; +;; Copyright (C) 2024 Pierre-Antoine Rouby +;; +;; Author: Pierre-Antoine Rouby +;; 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 . + +;;; 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) diff --git a/src/init/20_magit.el b/src/init/20_magit.el new file mode 100644 index 0000000..5ffb472 --- /dev/null +++ b/src/init/20_magit.el @@ -0,0 +1,27 @@ +;;; 20_magit.el --- Init GNUEmacs configuration. -*- lexical-binding: t; -*- +;; +;; Copyright (C) 2024 Pierre-Antoine Rouby +;; +;; Author: Pierre-Antoine Rouby +;; 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 . + +;;; Commentary: + +;; Personnal GNUEmacs configuration. + +;;; Code: + +(global-set-key (kbd "C-x g") 'magit-status) diff --git a/src/init/30_doom.el b/src/init/30_doom.el new file mode 100644 index 0000000..6da1de1 --- /dev/null +++ b/src/init/30_doom.el @@ -0,0 +1,29 @@ +;;; 30_doom.el --- Init GNUEmacs configuration. -*- lexical-binding: t; -*- +;; +;; Copyright (C) 2024 Pierre-Antoine Rouby +;; +;; Author: Pierre-Antoine Rouby +;; 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 . + +;;; Commentary: + +;; Personnal GNUEmacs configuration. + +;;; Code: + +(require 'doom-modeline) + +(doom-modeline-mode) diff --git a/src/init/copyright.el b/src/init/copyright.el new file mode 100644 index 0000000..17d8857 --- /dev/null +++ b/src/init/copyright.el @@ -0,0 +1,57 @@ +;;; copyright.el --- Init GNUEmacs configuration. -*- lexical-binding: t; -*- +;; +;; Copyright (C) 2024 Pierre-Antoine Rouby +;; +;; Author: Pierre-Antoine Rouby +;; 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 . + +;;; 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 .")))) + (insert (string-join gpl)) + (goto-char pos)))) diff --git a/src/init/default.el b/src/init/default.el new file mode 100644 index 0000000..45cb1b7 --- /dev/null +++ b/src/init/default.el @@ -0,0 +1,41 @@ +;;; default.el --- Presonal GNUEmacs configuration. -*- lexical-binding: t; -*- +;; +;; Copyright (C) 2024 Pierre-Antoine Rouby +;; +;; Author: Pierre-Antoine Rouby +;; 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 . + +;;; 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)))