Przeglądaj źródła

Cleaned a bit the config

Kept it up to date, removed old untangled bits, merged a few short
subsections.
Eiyeron Fulmincendii 5 lat temu
rodzic
commit
8cd73f7a1f
2 zmienionych plików z 120 dodań i 199 usunięć
  1. 118 198
      config.org
  2. 2 1
      init.el

+ 118 - 198
config.org

@@ -72,17 +72,12 @@ Note that with evil, digraphs are back.
 #+begin_src emacs-lisp
 (package! ascii-art-to-unicode)
 #+end_src
-*** Org-Starless
-Why not removing those pesky asteriks for a change?
-#+begin_src emacs-lisp
-(package! org-starless :recipe (:host github :repo "TonCherAmi/org-starless"))
-#+end_src
 *** Pico8-mode
 Experimenting with that package. I might need to fork it in the future to add the latest P8 additions.
 #+begin_src emacs-lisp
 (package! pico8-mode :recipe (:host github :repo "Kaali/pico8-mode"))
 #+end_src
-* TODO Buffer-local variables to make stuff easily tweakable
+* TODO Config variables to make stuff easily tweakable
 * Helper functions
 I had issues before dealing with specific patterns at configuration time. At
 this moment, I don't have all the packages nor do I want to deal with them
@@ -135,9 +130,7 @@ colorscheme.
              ;; Gruvbox-light
              "ff984792cce90b274d29d59e63c8a51ce91ff0ab01d6504f7d407ef545aa1a82"
              ;; Gruvbox-dark
-             "8141c11fa933b60d4ae77bd74187d7ff8a510c3237515a68c79cf997277bd3b4"
-             )
-
+             "8141c11fa933b60d4ae77bd74187d7ff8a510c3237515a68c79cf997277bd3b4")
 #+END_SRC
 ** The fonts
 The other basic configuration I usually do first too is setting a font.
@@ -145,8 +138,8 @@ PragmataPro has been my newest typographic friend as it's /really/ good for what
 it's made for: displaying text in a flexible yet consistent way. Wait, I just
 described fonts. Yet, Pragmata is neicely designed and made in a way I'm still
 discovering little details after weeks of daily usage, like properly managing
-combining characters like F⃣. I really like those small touches and of course the
-mighty ligatures.
+combining characters like F⃣.. I really like those small touches and of course
+the mighty ligatures.
 
 On the other hand, I don't always want to install all the fonts everywhere, so
 let's build first a font selector so I can gracefully fallback on other fonts
@@ -158,7 +151,7 @@ when needed.
 #+end_src
 Now the font proper selection
 #+BEGIN_SRC emacs-lisp
-(let ((base-size 14)
+(let ((base-size 10)
       (code-font (chicken/select-first-available-font
                   '("PragmataPro Liga"
                     "PragmataPro"
@@ -221,19 +214,13 @@ Gruvbox-light doesn't need a font as think as its dark alternative.
   '(line-number :slant italic)
   '(org-quote :inherit fixed-pitch-serif))
 #+end_src
+***  Extra ligatures
+#+begin_src emacs-lisp
+(after! ligatures
+  (setq +ligatures-extras-in-modes '(org-mode)))
+#+end_src
 
-** Tweaks
-*** Window borders
-Nothing really fancy yet, I'm content with how Doom looks right now. In the
-future I might add something to change the windows' border colors. Window
-dividers (located in the ~window-divider~ group) are inheriting from the
-~vertical-border~ face, so editing the later allows me to quickly change the
-border color if needed.
-#+BEGIN_SRC emacs-lisp :tangle no
-(custom-set-faces!
-  '(vertical-border :foreground "red"))
-#+END_SRC
-*** STRT Doom Modeline
+** STRT Doom Modeline
 I'm trying to slightly tweak the modeline to show some info like the word count
 and forcing the usage of icons for situations where I use emacs in daemon mode,
 which occured quite often on Windows with Spacemacs, due to the latter's
@@ -242,9 +229,9 @@ increased boot time.
 I'm disabling the font icons when one of the fonts (here GitHub's) isn't present
 so I can directly fallback on the unicode symbols. Allows me to tone down the
 visual noise.
-
 #+BEGIN_SRC emacs-lisp
-(after! doom-modeline
+(use-package! doom-modeline
+  :config
   (if (member "github-octicons" (font-family-list))
       (progn
         (setq doom-modeline-icon t)
@@ -252,70 +239,8 @@ visual noise.
     (progn
       (setq doom-modeline-icon nil)
       (setq doom-modeline-unicode-fallback t)))
-
-  ;; FIXME What does it lack to work?
-  ;;(setq doom-modeline-enable-word-count t)
-  ;;(setq doom-modeline-continuous-word-count-modes
-  ;;      '(markdown-mode gfm-mode org-mode))
-
-  ;; HACK @work No really need right now to hack with encoding yet.
-  (setq doom-modeline-buffer-encoding nil))
+  (setq doom-modeline-height 16))
 #+END_SRC
-*** TODO Top-modeline
-Inspired from [[https://github.com/rougier/elegant-emacs/blob/master/elegance.el#L150][Elegant-Emacs]].
-
-Currently disabled until I get it done properly. It suffers from messy code and
-bad performance.
-
-#+begin_src emacs-lisp :tangle no
-(after! doom-themes
-  (custom-set-faces!
-    `(header-line
-      :inherit 'variable-pitch
-      :underline t
-      :foreground ,(doom-color 'base6))))
-
-
-(defun staging/reload-header-line-theme()
-  (setq chicken--header-line-width
-        (window-font-width (selected-window) 'header-line)))
-(staging/reload-header-line-theme)
-#+end_src
-
-
-#+begin_src emacs-lisp :tangle no
-(define-key mode-line-major-mode-keymap [header-line]
-  (lookup-key mode-line-major-mode-keymap [mode-line]))
-
-(add-hook 'doom-load-theme-hook 'staging/reload-header-line-theme)
-
-(defun mode-line-render (left right)
-  (let* ((available-width (-
-                           (/
-                            (window-width (selected-window) t)
-                            chicken--header-line-width)
-                           (length left) )))
-    (format (format "%%s  %%%ds" available-width) left right)))
-(setq-default header-line-format
-              '((:eval
-                 (mode-line-render
-                  (format-mode-line (list
-                                     (propertize "☰" 'face `(:inherit mode-line-buffer-id)
-                                                 'help-echo "Mode(s) menu"
-                                                 'mouse-face 'mode-line-highlight
-                                                 'local-map   mode-line-major-mode-keymap)
-                                     (propertize " %b " 'face `(:underline nil :foreground ,(doom-color 'base7)))
-                                     (if (and buffer-file-name (buffer-modified-p))
-                                         (propertize "*" 'face `(:inherit header-line)))))
-                  (format-mode-line
-                   (propertize "%4l:%2c  " 'face `(:inherit header-line)))))))
-(setq-default mode-line-format nil)
-#+end_src
-*** TODO Hide line numbers for org
-#+begin_src emacs-lisp
-(after! org
-  (add-hook 'org-mode-hook (lambda () (setq-local display-line-numbers nil))))
-#+end_src
 * Python
 ** Python-x
 Python-x allows me to have the same cell-based workflow than on Jupter or
@@ -326,50 +251,7 @@ Spyder. I'd like also to use similar separators to what I currently use (~# %%~)
   (setq python-section-delimiter "# %%"))
 #+END_SRC
 * Org-Mode
-** Ellipsis
-#+begin_src emacs-lisp
-(after! org
-  (setq org-ellipsis "…"))
-#+end_src
-** Starless
-#+begin_src emacs-lisp :tangle no
-(after! org
-  (add-hook 'org-mode-hook #'org-starless-mode))
-#+end_src
-
-** Hide markup
-#+begin_src emacs-lisp
-(after! org
-  (setq org-hide-emphasis-markers t))
-#+end_src
-** Digraphs
-I kinda like this feature and want it back on C-k on Org.
-#+begin_src emacs-lisp
-(after! org
-  (map! :map evil-org-mode-map
-        :i "C-k" 'evil-insert-digraph))
-#+end_src
-
-** TODO Smaller properties
-"Broken" as drawer's actual line height isn't updated. Need to find out why.
-#+begin_src emacs-lisp :tangle no
-(custom-set-faces! '(org-drawer :height 0.5)
-  '(org-property-value :height 0.5)
-  '(org-special-keyword :height 0.5))
-#+end_src
-
-** Org-mode theming bugfixes
-*** Org-blocks not extended
-Emacs 27 adds a face attribute that allows a line background to extend past the
-last character. ~org-block~ has this disabled in doom-gruvbox(-light). Let's add
-it back. This is mostly visible in the scratch buffer where the background is
-using a different background color.
-
-#+begin_src emacs-lisp
-(custom-set-faces! '(org-block :extend t))
-#+end_src
-
-** STRT Org location
+** STRT Org notes location
 I have usually two locations for my own note repository. On Windows, I like to
 put it in a folder located in the root folder of a hard drive while on Linux, I
 prefer having it at the root of my home folder. This prevents having spaces in
@@ -385,79 +267,82 @@ expands some configured variable at initialization (for instance the capture
 file locations are derived from the org directory), so the ~after!~ hook won't
 update those variables.
 #+BEGIN_SRC emacs-lisp
-(let ((base-folder-name "Notes"))
-  (when (eq system-type 'windows-nt)
-    ;; HACK I usually have two disk drives
-    (if (file-directory-p (concat "C:/" base-folder-name))
-        (setq org-directory (concat "C:/" base-folder-name))
-      (setq org-directory (concat "D:/" base-folder-name))))
-  (when (eq system-type 'gnu/linux)
-    ;; TODO Factorize with let
-    (let ((notes-folder (concat
-                         (file-name-as-directory (getenv "HOME"))
-                         base-folder-name)))
-      (if (file-directory-p notes-folder)
-          (setq org-directory notes-folder)
-        (message "Can't find the org note folder.")))))
+(use-package! org
+  :init
+  (let ((base-folder-name "Notes"))
+    (when (eq system-type 'windows-nt)
+      ;; HACK I usually have two disk drives
+      (if (file-directory-p (concat "C:/" base-folder-name))
+          (setq org-directory (concat "C:/" base-folder-name))
+        (setq org-directory (concat "D:/" base-folder-name))))
+    (when (eq system-type 'gnu/linux)
+      ;; TODO Factorize with let
+      (let ((notes-folder (concat
+                           (file-name-as-directory (getenv "HOME"))
+                           base-folder-name)))
+        (if (file-directory-p notes-folder)
+            (setq org-directory notes-folder)
+          (message "Can't find the org note folder."))))))
 #+END_SRC
 *** Org-Attach location
 Instead of having a global attachment dir, I'm going to use multiple folders as I have multiple org base folders
 #+begin_src emacs-lisp
 (setq org-attach-id-dir ".attach/")
 #+end_src
-** TODO Org Bullets
-Doom's default bullets, using ~org-superstar~, for org doesn't work perfectly in
-Windows. Let's use another set that'll work on my computers.
-#+BEGIN_SRC emacs-lisp :tangle no
-(setq org-superstar-headline-bullets-list '("■" "▩" "▦" "▨" "▤" "□"))
-#+END_SRC
-
-The new one
-#+BEGIN_SRC emacs-lisp
-(setq org-superstar-headline-bullets-list '("⧫"))
-#+END_SRC
+** Small visual tweaks
+Emacs 27 adds a face attribute that allows a line background to extend past the
+last character. ~org-block~ has this disabled in doom-gruvbox(-light). Let's add
+it back. This is mostly visible in the scratch buffer where the background is
+using a different background color.
 
+Also tweaking the ellipsis character to actually use an ellipsis character and
+disabling the line numbers.
+#+begin_src emacs-lisp
+(use-package! org
+  :config
+  (setq org-ellipsis "…")
+  (custom-set-faces! '(org-block :extend t))
+  (add-hook 'org-mode-hook (lambda () (setq-local display-line-numbers nil))))
+#+end_src
+** TODO Digraphs
+I kinda like this feature and want it back on C-k on Org. The current snippet is
+broken, I need to find the proper way to turn digraph input back on.
+#+begin_src emacs-lisp :tangle no
+(use-package! org
+  :config
+  (map! :map evil-org-mode-map
+        :i "C-k" 'evil-insert-digraph))
+#+end_src
 ** TODO Todo lists
 I'd like to track when I finish tasks. I'm not feeling that adding a note each
 time I close an item might be the best thing as I'd get tired of the prompt
 really quickly. I'll reserve this to manual additions.
 #+BEGIN_SRC emacs-lisp
-(setq org-log-done 'time)
+(use-package! org
+  :config
+  (setq org-log-done 'time))
 #+END_SRC
 ** TODO Org Brain
 Here will be located a routine to determine which folder we want to write the
-default brain(s) down.
-#+BEGIN_SRC emacs-lisp
-;; TODO proper folder
-(when (eq system-type 'windows-nt)
-  (add-hook! org-brain
-  (setq org-brain-path "c:/Notes/Work/Brain")))
-#+END_SRC
+default brain(s) down. A small fix to avoid org-brain's key bindings be
+overwritten by evil.
 
-A small fix to avoid org-brain's key bindings be overwritten by evil.
 #+BEGIN_SRC emacs-lisp
-(after! org-brain
-  (evil-set-initial-state 'org-brain-visualize-mode 'emacs))
-#+END_SRC
-
-Org-brain's mindmap doesn't work well with mixed-pitch. It's padded with default
-face spaces and the face differences break the map's links visually.
-#+begin_src emacs-lisp :tangle no
-(after! org-brain
-  (add-hook 'org-brain-visualize-text-hook #'mixed-pitch-mode ))
-#+end_src
-
-#+begin_src emacs-lisp
+(use-package! org-brain
+  :config
+(evil-set-initial-state 'org-brain-visualize-mode 'emacs)
 (custom-set-faces!
   `(org-brain-child :inherit fixed-pitch :foreground ,(doom-color 'blue))
   `(org-brain-parent :inherit fixed-pitch :foreground ,(doom-color 'dark-blue))
   `(org-brain-wires :inherit fixed-pitch  :weight light :foreground ,(doom-color 'base5)))
-#+end_src
+)
+#+END_SRC
 
 Working icon display with ~all-the-icons~ to have a small icon before various
 kind of resource links.
 #+BEGIN_SRC emacs-lisp
-(after! org-brain
+(use-package! org-brain
+  :config
   (defun org-brain-insert-resource-icon (link)
     "Insert an icon, based on content of org-mode LINK."
     (let ((starts_with_http (string-prefix-p "http" link)))
@@ -517,29 +402,15 @@ kind of resource links.
                        ((string-prefix-p "brain:" link)
                         (all-the-icons-fileicon "brain"))
                        (t (all-the-icons-icon-for-file link)))))))
-    (add-hook 'org-brain-after-resource-button-functions #'org-brain-insert-resource-icon))
+  (add-hook 'org-brain-after-resource-button-functions #'org-brain-insert-resource-icon))
 #+END_SRC
 
-** TODO Convenience narrow keybindings
-Here's some keybindings vaguely inspired from my experience with Spacemacs.
-#+BEGIN_SRC emacs-lisp
-(map! :mode org-mode
-      :leader
-      ;; Narrow
-      :desc "narrow" "mN" nil
-      :desc "Narrow to subtree" "mNs" #'org-narrow-to-subtree
-      :desc "Toggle subtree narrowing" "mNt" #'org-toggle-narrow-to-subtree
-      :desc "Narrow to element" "mNe" #'org-narrow-to-element
-      :desc "Narrow to element" "mNb" #'org-narrow-to-block
-      :desc "Widen" "mNw" #'widen)
-#+END_SRC
-** TODO Org-brain
 *** TODO Ascii-art-to-unicode decoration
 This snippet, slightly edited from the code available on org-brain's [[https://github.com/Kungsgeten/org-brain][repository
 page]] uses ascii-art-to-unicode to draw the inheritance diagram with box drawing
 characters.
 #+begin_src emacs-lisp
-(after! org-brain
+(after! (ascii-art-to-unicode org-brain)
   (defface aa2u-face '((t  (:inherit fixed-pitch :weight light)) )
     "Face for aa2u box drawing characters")
   (advice-add #'aa2u-1c :filter-return
@@ -563,7 +434,19 @@ characters.
               :desc "Visualize" "Bv" #'org-brain-visualize
         )))
 #+end_src
-
+** TODO Convenience narrow keybindings
+Here's some keybindings vaguely inspired from my experience with Spacemacs.
+#+BEGIN_SRC emacs-lisp
+(map! :mode org-mode
+      :localleader
+      ;; Narrow
+      :desc "narrow" "mN" nil
+      :desc "Narrow to subtree" "mNs" #'org-narrow-to-subtree
+      :desc "Toggle subtree narrowing" "mNt" #'org-toggle-narrow-to-subtree
+      :desc "Narrow to element" "mNe" #'org-narrow-to-element
+      :desc "Narrow to element" "mNb" #'org-narrow-to-block
+      :desc "Widen" "mNw" #'widen)
+#+END_SRC
 ** TODO Org-Agenga
 *** TODO French day names
 #+begin_src emacs-lisp
@@ -575,6 +458,43 @@ characters.
                                    "Juin" "Juillet" "Août" "Septembre"
                                    "Octobre" "Novembre" "Décembre"]))
 #+end_src
+** TODO Org-Capture
+#+begin_src emacs-lisp
+(use-package! org
+  :config
+  (setq chicken/dreamlog-file (concat org-directory "/Dreamlog.org"))
+  (setq
+   org-capture-templates
+   '(("b" "Brain" plain #'org-brain-goto-end "* %i%?" :empty-lines 1)
+     ("d" "Dreamlog" entry
+      (file+olp+datetree chicken/dreamlog-file))
+     ("t" "Personal todo" entry
+      (file+headline +org-capture-todo-file "Inbox")
+      "* [ ] %?\n%i\n%a" :prepend t)
+     ("n" "Personal notes" entry
+      (file+headline +org-capture-notes-file "Inbox")
+      "* %u %?\n%i\n%a" :prepend t)
+     ("j" "Journal" entry
+      (file+olp+datetree +org-capture-journal-file)
+      "* %U %?\n%i\n%a" :prepend t)
+     ("p" "Templates for projects")
+     ("pt" "Project-local todo" entry
+      (file+headline +org-capture-project-todo-file "Inbox")
+      "* TODO %?\n%i\n%a" :prepend t)
+     ("pn" "Project-local notes" entry
+      (file+headline +org-capture-project-notes-file "Inbox")
+      "* %U %?\n%i\n%a" :prepend t)
+     ("pc" "Project-local changelog" entry
+      (file+headline +org-capture-project-changelog-file "Unreleased")
+      "* %U %?\n%i\n%a" :prepend t)
+     ("o" "Centralized templates for projects")
+     ("ot" "Project todo" entry #'+org-capture-central-project-todo-file
+      "* TODO %?\n %i\n %a" :heading "Tasks" :prepend nil)
+     ("on" "Project notes" entry #'+org-capture-central-project-notes-file
+      "* %U %?\n %i\n %a" :heading "Notes" :prepend t)
+     ("oc" "Project changelog" entry #'+org-capture-central-project-changelog-file
+      "* %U %?\n %i\n %a" :heading "Changelog" :prepend t))))
+#+end_src
 * Pico-8
 Using that [[https://github.com/Kaali/pico8-mode][pico-8 mode]] for Emacs might be fun. It even includes an overlay to
 display the GFX and label as pictures in the code. Fancy!

+ 2 - 1
init.el

@@ -40,7 +40,8 @@
        ophints           ; highlight the region an operation acts on
        (popup +defaults)   ; tame sudden yet inevitable temporary windows
        (ligatures       ; ligatures and symbols to make your code pretty again
-        +pragmata-pro)
+        +pragmata-pro
+        +extra)
 
        ;;tabs              ; an tab bar for Emacs
        treemacs          ; a project drawer, like neotree but cooler