From f774eda04b2259863cfc7343ee86c8748afa3a70 Mon Sep 17 00:00:00 2001 From: Kubat <mael.martin31@gmail.com> Date: Tue, 16 Nov 2021 21:15:39 +0100 Subject: [PATCH] Use the org thing to generate the configuration file without the comments --- README.org | 120 +++++++++++++++++++++++++++++++++++++++++ config.el | 76 ++++++++------------------ packages/porth-mode.el | 6 +-- 3 files changed, 146 insertions(+), 56 deletions(-) create mode 100644 README.org diff --git a/README.org b/README.org new file mode 100644 index 0000000..b5cc3c4 --- /dev/null +++ b/README.org @@ -0,0 +1,120 @@ +#+TITLE: Doom's configuration +#+PROPERTY: header-args :tangle config.el + +* Table of Contents :TOC_3:noexport: +- [[#description][Description]] + - [[#simple-configuration-rules][Simple configuration rules]] +- [[#font-settings][Font settings]] +- [[#packages-configuration][Packages configuration]] + - [[#custom-package-imports][Custom package imports]] + - [[#plain-text-file-configuration][Plain text file configuration]] + - [[#org-mode-configuration][Org mode configuration]] +- [[#custom-key-bindings][Custom key bindings]] +- [[#help][Help]] + +* Description +My configuration of Doom Emacs. + +Don't forget to =pip install cmake-language-server= before installing Emacs for +the CMake LSP thing to work. + +** Simple configuration rules +This is done to ensure natural split and that mathematical things use radians +instead of degrees. The simple doom theme is used because it's pretty enough. + +#+begin_src emacs-lisp +(setq user-full-name "Maël MARTIN" + user-mail-address "mael.martin@protonmail.com" + truncate-string-ellipsis "…" + evil-vsplit-window-right t + evil-split-window-below t + calc-angle-mode 'rad + calc-symbolic-mode t + display-line-numbers-type t + doom-theme 'doom-one +) +#+end_src + +* Font settings +I prefer Fira Code, but ligatures are not handled correctly for now... + +#+begin_src emacs-lisp +(setq doom-font (font-spec :family "Fira Code" :size 12 :weight 'medium) + doom-variable-pitch-font (font-spec :family "Fira Code" :size 12) + doom-big-font (font-spec :family "Fira Code" :size 14)) +(after! doom-theme + (setq doom-themes-enable-bold t + doom-themes-enable-italic t)) + +(custom-set-faces! + '(font-lock-comment-face :slant italic) + '(font-lock-keyword-face :slant italic)) + +(custom-set-faces + '(org-level-1 ((t (:inherit outline-1 :height 1.2)))) + '(org-level-2 ((t (:inherit outline-2 :height 1.0)))) + '(org-level-3 ((t (:inherit outline-3 :height 1.0)))) + '(org-level-4 ((t (:inherit outline-4 :height 1.0)))) + '(org-level-5 ((t (:inherit outline-5 :height 1.0))))) +#+end_src + +* Packages configuration +** Custom package imports +#+begin_src emacs-lisp +(load! "packages/porth-mode.el") +#+end_src + +** Plain text file configuration +Even with plain text we can do some things. +#+begin_src emacs-lisp +(set-file-template! "\\.tex$" :trigger "__" :mode 'latex-mode) +(set-file-template! "\\.org$" :trigger "__" :mode 'org-mode) +(set-file-template! "/LICEN[CS]E$" :trigger '+file-templates/insert-license) +#+end_src + +** Org mode configuration +Simply configure the org mode. Everything is placed inside =~/org/=. We also load +the custom bullets mode. + +#+begin_src emacs-lisp +(add-hook 'org-mode-hook 'org-indent-mode) +(setq org-directory "~/org/" + org-agenda-files '("~/org/agenda.org") + org-default-notes-file (expand-file-name "notes.org" org-directory) + org-ellipsis " ▼ " + org-log-done 'time + org-journal-dir "~/org/journal/" + org-journal-date-format "%B %d, %Y (%A) " + org-journal-file-format "%Y-%m-%d.org" + org-hide-emphasis-markers t) + +(setq org-src-preserve-indentation nil + org-src-tab-acts-natively t + org-edit-src-content-indentation 0) + +(add-hook 'org-mode-hook (lambda () (org-bullets-mode 1))) +#+end_src + +* Custom key bindings +#+begin_src emacs-lisp +(map! :leader "b o" #'org-mode :desc "Switch buffer type to 'org-mode'") +(global-set-key (kbd "C-=") 'text-scale-increase) +(global-set-key (kbd "C--") 'text-scale-decrease) +#+end_src + +* Help +This help was found in the original =config.el= file. + +- =load!= for loading external =*.el= files relative to this one +- =use-package!= for configuring packages +- =after!= for running code after a package has loaded +- =add-load-path!= for adding directories to the =load-path=, relative to this file. + Emacs searches the =load-path= when you load packages with =require= or =use-package=. +- =map!= for binding new keys + +To get information about any of these functions/macros, move the cursor over the +highlighted symbol at press =K= (non-evil users must press =C-c c k=). This will +open documentation for it, including demos of how they are used. + +You can also try =gd= (or =C-c c d=) to jump to their definition and see how they +are implemented. diff --git a/config.el b/config.el index 523f4ea..64b4ecb 100644 --- a/config.el +++ b/config.el @@ -1,46 +1,38 @@ -;;; $DOOMDIR/config.el -*- lexical-binding: t; -*- - -;; Place your private configuration here! Remember, you do not need to run 'doom -;; sync' after modifying this file! - -;; Notes: -;; * Don't forget to =pip install cmake-language-server= - -;; Some functionality uses this to identify you, e.g. GPG configuration, email -;; clients, file templates and snippets. (setq user-full-name "Maël MARTIN" user-mail-address "mael.martin@protonmail.com" - truncate-string-ellipsis "…" ; replace '...' by the utf8 character - evil-vsplit-window-right t ; natural splits - evil-split-window-below t ; natural splits - calc-angle-mode 'rad ; radians are rad - calc-symbolic-mode t ; keeps expressions like \sqrt{2} irrational for as long as possible + truncate-string-ellipsis "…" + evil-vsplit-window-right t + evil-split-window-below t + calc-angle-mode 'rad + calc-symbolic-mode t + display-line-numbers-type t + doom-theme 'doom-one ) -;; Set Doom fonts (setq doom-font (font-spec :family "Fira Code" :size 12 :weight 'medium) doom-variable-pitch-font (font-spec :family "Fira Code" :size 12) doom-big-font (font-spec :family "Fira Code" :size 14)) (after! doom-theme (setq doom-themes-enable-bold t doom-themes-enable-italic t)) + (custom-set-faces! '(font-lock-comment-face :slant italic) '(font-lock-keyword-face :slant italic)) -;; Set theme. Either `doom-theme' or `load-theme' -(setq doom-theme 'doom-one) +(custom-set-faces + '(org-level-1 ((t (:inherit outline-1 :height 1.2)))) + '(org-level-2 ((t (:inherit outline-2 :height 1.0)))) + '(org-level-3 ((t (:inherit outline-3 :height 1.0)))) + '(org-level-4 ((t (:inherit outline-4 :height 1.0)))) + '(org-level-5 ((t (:inherit outline-5 :height 1.0))))) -;; Line numbering: nil | relative | t (true) -(setq display-line-numbers-type t) +(load! "packages/porth-mode.el") -;; Zoom key-bindings -(global-set-key (kbd "C-=") 'text-scale-increase) -(global-set-key (kbd "C--") 'text-scale-decrease) -(global-set-key (kbd "<C-wheel-up>") 'text-scale-increase) -(global-set-key (kbd "<C-wheel-down>") 'text-scale-decrease) +(set-file-template! "\\.tex$" :trigger "__" :mode 'latex-mode) +(set-file-template! "\\.org$" :trigger "__" :mode 'org-mode) +(set-file-template! "/LICEN[CS]E$" :trigger '+file-templates/insert-license) -;; Things for the ORG mode (add-hook 'org-mode-hook 'org-indent-mode) (setq org-directory "~/org/" org-agenda-files '("~/org/agenda.org") @@ -51,35 +43,13 @@ org-journal-date-format "%B %d, %Y (%A) " org-journal-file-format "%Y-%m-%d.org" org-hide-emphasis-markers t) + (setq org-src-preserve-indentation nil org-src-tab-acts-natively t org-edit-src-content-indentation 0) -(add-hook 'org-mode-hook (lambda () (org-bullets-mode 1))) -;; Custom font sizes for the headings -(custom-set-faces - '(org-level-1 ((t (:inherit outline-1 :height 1.2)))) - '(org-level-2 ((t (:inherit outline-2 :height 1.0)))) - '(org-level-3 ((t (:inherit outline-3 :height 1.0)))) - '(org-level-4 ((t (:inherit outline-4 :height 1.0)))) - '(org-level-5 ((t (:inherit outline-5 :height 1.0))))) - -;; Custom packages -(load! "packages/porth-mode.el") +(add-hook 'org-mode-hook (lambda () (org-bullets-mode 1))) -;; Here are some additional functions/macros that could help you configure Doom: -;; -;; - `load!' for loading external *.el files relative to this one -;; - `use-package!' for configuring packages -;; - `after!' for running code after a package has loaded -;; - `add-load-path!' for adding directories to the `load-path', relative to -;; this file. Emacs searches the `load-path' when you load packages with -;; `require' or `use-package'. -;; - `map!' for binding new keys -;; -;; To get information about any of these functions/macros, move the cursor over -;; the highlighted symbol at press 'K' (non-evil users must press 'C-c c k'). -;; This will open documentation for it, including demos of how they are used. -;; -;; You can also try 'gd' (or 'C-c c d') to jump to their definition and see how -;; they are implemented. +(map! :leader "b o" #'org-mode :desc "Switch buffer type to 'org-mode'") +(global-set-key (kbd "C-=") 'text-scale-increase) +(global-set-key (kbd "C--") 'text-scale-decrease) diff --git a/packages/porth-mode.el b/packages/porth-mode.el index ab16b2b..6b6ba0c 100644 --- a/packages/porth-mode.el +++ b/packages/porth-mode.el @@ -37,9 +37,9 @@ (defconst porth-mode-syntax-table (with-syntax-table (copy-syntax-table) ;; C/C++ style comments - (modify-syntax-entry ?/ ". 124b") - (modify-syntax-entry ?* ". 23") - (modify-syntax-entry ?\n "> b") + (modify-syntax-entry ?/ ". 124b") + (modify-syntax-entry ?* ". 23") + (modify-syntax-entry ?\n "> b") ;; Chars are the same as strings (modify-syntax-entry ?' "\"") (syntax-table)) -- GitLab