Kaynağa Gözat

Update time

Eiyeron Fulmincendii 5 yıl önce
ebeveyn
işleme
72d4e176bc
2 değiştirilmiş dosya ile 157 ekleme ve 29 silme
  1. 145 18
      config.org
  2. 12 11
      init.el

+ 145 - 18
config.org

@@ -41,15 +41,16 @@ find a way to compile it)
 (package! vterm :ignore (eq system-type 'windows-nt))
 #+end_src
 *** Graphviz
-Making graphs is fun
+Making graphs is fun and GraphViz, might it be a bit limited in terms of ease of
+access, is still quite solid for basic stuff.
 #+begin_src emacs-lisp
-(package! graphviz-dot-mode)
+(package! graphviz-dot-mode :ignore (not (executable-find "dot")))
 #+end_src
 *** Python pacakges
 Python X allows me to have a notebook-ish workflow. More about this in its
 configuration section
 #+begin_src emacs-lisp
-(package! python-x)
+(package! python-x :ignore (not (executable-find "python")))
 #+end_src
 *** Ob-async
 Not having emacs be stuck when doing heavier stuff seems great. Let's use that.
@@ -71,6 +72,16 @@ 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
 * Helper functions
 I had issues before dealing with specific patterns at configuration time. At
@@ -147,19 +158,20 @@ when needed.
 #+end_src
 Now the font proper selection
 #+BEGIN_SRC emacs-lisp
-(let ((base-size 16)
+(let ((base-size 14)
       (code-font (chicken/select-first-available-font
                   '("PragmataPro Liga"
                     "PragmataPro"
+                    "Iosevka Custom"
                     "Iosevka"
                     "Iosevka SS08"
                     "InputMonoCompressed"
+                    "Cascadia Code PL"
+                    "Cascadia Code"
                     "Consolas"
                     "Courrier New")))
       (variable-font (chicken/select-first-available-font
-                      '("PragmataPro Liga"
-                        "PragmataPro"
-                        "Iosevka Extended"
+                      '("Iosevka Extended"
                         "Iosevka SS08 Extended"
                         "InputSansCompressed"
                         "Segoe UI")))
@@ -168,6 +180,7 @@ Now the font proper selection
                        "PragmataPro"
                        "Segoe Color Emoji"
                        "InputMonoCompressed"
+                       "Iosevka Custom"
                        ;;"Iosevka SS08 Light"
                        "Iosevka SS08"
                        "Iosevka"
@@ -205,8 +218,8 @@ Gruvbox-light doesn't need a font as think as its dark alternative.
 *** TODO Visual tweaks
 #+begin_src emacs-lisp
 (custom-set-faces!
-  '(line-number nil :slant 'italic)
-  '(org-quote nil :inherit 'fixed-pitch-serif))
+  '(line-number :slant italic)
+  '(org-quote :inherit fixed-pitch-serif))
 #+end_src
 
 ** Tweaks
@@ -313,6 +326,49 @@ 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
 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
@@ -323,6 +379,11 @@ Right now, the Windows' version is relatively bare, I only have setups where I
 use ~C:~ or ~D:~ as drives to store my notes folder, directly on the root, but
 maybe in the future I'd like to move it, so I should plan to support future
 configurations later.
+
+Using the ~use-package~ configuration scope instead of ~after!~ because org
+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)
@@ -339,6 +400,11 @@ configurations later.
           (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.
@@ -374,6 +440,20 @@ A small fix to avoid org-brain's key bindings be overwritten by evil.
   (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
+(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
+
 Working icon display with ~all-the-icons~ to have a small icon before various
 kind of resource links.
 #+BEGIN_SRC emacs-lisp
@@ -388,6 +468,9 @@ kind of resource links.
                        ;; TODO use string-suffix-p everywhere or string-match?
                        ;; The latter might give wrong results on filenames with
                        ;; multiple extensions.
+                       ;;
+                       ;; TODO Propertize works here. Color everything?
+                       ;; (propertize (all-the-icons-faicon "file-code-o") 'face '(:foreground "red") )
                        ((string-suffix-p ".pdf" link)
                         (all-the-icons-octicon "file-pdf"))
                        ((string-match "\\.cpp" link)
@@ -398,6 +481,10 @@ kind of resource links.
                         (all-the-icons-alltheicon "java"))
                        ((string-match "\\.lua" link)
                         (all-the-icons-fileicon "lua"))
+                       ((string-match "\\.xml" link)
+                        (all-the-icons-faicon "file-code-o"))
+                       ((string-match "\\.xaml" link)
+                        (all-the-icons-faicon "file-code-o"))
                        ;; [TODO] This will break http file links to header files.
                        ;; Use instead a more clever regex match
                        ((and (string-match "\\.h" link)
@@ -432,6 +519,7 @@ kind of resource links.
                        (t (all-the-icons-icon-for-file link)))))))
     (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
@@ -452,7 +540,7 @@ page]] uses ascii-art-to-unicode to draw the inheritance diagram with box drawin
 characters.
 #+begin_src emacs-lisp
 (after! org-brain
-  (defface aa2u-face '((t . nil))
+  (defface aa2u-face '((t  (:inherit fixed-pitch :weight light)) )
     "Face for aa2u box drawing characters")
   (advice-add #'aa2u-1c :filter-return
               (lambda (str) (propertize str 'face 'aa2u-face)))
@@ -464,6 +552,18 @@ characters.
       (ignore-errors (aa2u (point-min) (point-max)))))
   (add-hook 'org-brain-after-visualize-hook #'aa2u-org-brain-buffer))
 #+end_src
+
+*** TODO Mapping
+#+begin_src emacs-lisp
+(map! (:when (featurep! :lang org +brain)
+        (:map org-mode-map
+              :localleader
+              :desc "brain" "B" nil
+              :desc "Get Id" "Bi" #'org-brain-get-id
+              :desc "Visualize" "Bv" #'org-brain-visualize
+        )))
+#+end_src
+
 ** TODO Org-Agenga
 *** TODO French day names
 #+begin_src emacs-lisp
@@ -475,6 +575,29 @@ characters.
                                    "Juin" "Juillet" "Août" "Septembre"
                                    "Octobre" "Novembre" "Décembre"]))
 #+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!
+
+I want it to work with gruvbox's colors, so let's tweak the non-lua face to be
+toned down but in Gruv's palette. Base4 seems to works well in both dark and
+light mode.
+** Smaller tab indent
+Mimicking Pico's decision to make tabs as short as spaces due to small screen
+space.
+#+begin_src emacs-lisp
+(add-hook 'pico8-mode-hook
+          (lambda ()
+            (setq indent-tabs-mode t)
+            (setq tab-width 2)))
+#+end_src
+
+** Proper non-lua text color
+#+begin_src emacs-lisp
+(custom-set-faces!
+  `(pico8--non-lua-overlay :weight light :foreground ,(doom-color 'base4)))
+#+end_src
+
 * Blog writing
 I have a [[https://retroactive.me][blog]]. I want to use emacs as my platform to type bits and bobs on it.
 
@@ -636,12 +759,12 @@ Simple but rather effective.
 #+BEGIN_SRC emacs-lisp
 (defun chicken/counsel-filter-gif(regex candidates)
   "Wraps counsel--find-file-matcher to filter files to only keep
-gifs located in the post's folder."
-  (let ((filtered (chicken/filter
-                   (lambda (file)
-                     (and (s-ends-with-p ".gif" file t)
-                          t))
-                   candidates)))
+gifs located in the content subfolder."
+  (let ((filtered
+         (remove-if-not
+          (lambda (file) (and (s-ends-with-p ".gif" file t)
+                 (s-starts-with-p "content" file t)))
+          candidates)))
     (counsel--find-file-matcher regex filtered)))
 
 ;;;###autoload
@@ -670,7 +793,9 @@ more Doom Emacs' documentation to figure how and where to scope the mapping.
       :desc "Everything" "sE" #'chicken/search-everything)
 #+END_SRC
 * PROJ Character/sequences insertion
-** STRT Basic principle
+** TODO Basic principle
+Convert this snippet to use lexical binding instead of lexical-let ([[https://www.gnu.org/software/emacs/manual/html_node/elisp/Using-Lexical-Binding.html#Using-Lexical-Binding][link to
+manual]])
 #+BEGIN_SRC emacs-lisp
 ;; Note, I could build the list by concating the character's unicode name and itself.
 
@@ -798,5 +923,7 @@ But again, the FAQ suggests using hooks to limit the tweak to specific modes.
 (defun chicken/alter-underscore-entry()
   (modify-syntax-entry ?_ "w"))
 
-(add-hook! (python-mode lua-mode markdown-mode) #'chicken/alter-underscore-entry)
+(add-hook!
+  (python-mode pico8-mode lua-mode markdown-mode)
+  #'chicken/alter-underscore-entry)
 #+END_SRC

+ 12 - 11
init.el

@@ -39,9 +39,9 @@
        ;;neotree           ; a project drawer, like NERDTree for vim
        ophints           ; highlight the region an operation acts on
        (popup +defaults)   ; tame sudden yet inevitable temporary windows
-       (pretty-code       ; replace bits of code with pretty symbols
-        ;;+pragmata-pro) ; HACK @work
-        )
+       (ligatures       ; ligatures and symbols to make your code pretty again
+        +pragmata-pro)
+
        ;;tabs              ; an tab bar for Emacs
        treemacs          ; a project drawer, like neotree but cooler
        ;;unicode           ; extended unicode support for various languages
@@ -53,7 +53,7 @@
 
        :editor
        (evil +everywhere); come to the dark side, we have cookies
-       file-templates    ; auto-snippets for empty files
+       ;; file-templates    ; auto-snippets for empty files
        fold              ; (nigh) universal code folding
        ;;(format +onsave)  ; automated prettiness
        ;;god               ; run Emacs commands without modifier keys
@@ -62,7 +62,7 @@
        ;;objed             ; text object editing for the innocent
        ;;parinfer          ; turn lisp into python, sort of
        ;;rotate-text       ; cycle region at point between text candidates
-       snippets          ; my elves. They type so I don't have to
+       ;; snippets          ; my elves. They type so I don't have to
        ;;word-wrap         ; soft wrapping with language-aware indent
 
        :emacs
@@ -89,7 +89,7 @@
        ;;direnv
        ;;docker
        editorconfig      ; let someone else argue about tabs vs spaces
-       ;;ein               ; tame Jupyter notebooks with emacs
+       ein               ; tame Jupyter notebooks with emacs
        (eval +overlay)     ; run code, run (also, repls)
        ;;gist              ; interacting with github gists
        lookup              ; navigate your code and its documentation
@@ -108,13 +108,13 @@
 
        :lang
        ;;agda              ; types of types of types of types...
-       ;;cc                ; C/C++/Obj-C madness
+       cc                ; C/C++/Obj-C madness
        ;;clojure           ; java with a lisp
        ;;common-lisp       ; if you've seen one lisp, you've seen them all
        ;;coq               ; proofs-as-programs
        ;;crystal           ; ruby at the speed of c
-       ;;csharp            ; unity, .NET, and mono shenanigans
-       ;;data              ; config/data formats
+       csharp            ; unity, .NET, and mono shenanigans
+       data              ; config/data formats
        ;;(dart +flutter)   ; paint ui and not much else
        ;;elixir            ; erlang done right
        ;;elm               ; care for a cup of TEA?
@@ -148,9 +148,10 @@
         +dragndrop       ; drag & drop files/images into org buffers
         ;;+hugo            ; use Emacs for hugo blogging
         +jupyter         ; ipython/jupyter support for babel
-        +pandoc          ; export-with-pandoc support
+        ;;+pandoc          ; export-with-pandoc support
         ;;+pomodoro        ; be fruitful with the tomato technique
-        +present)        ; using org-mode for presentations
+        ;;+present)        ; using org-mode for presentations
+        )
        ;;perl              ; write code no one else can comprehend
        ;;php               ; perl's insecure younger brother
        ;;plantuml          ; diagrams for confusing people more