diff --git a/org/config/emacs.org b/org/config/emacs.org index afe5461..93a6692 100644 --- a/org/config/emacs.org +++ b/org/config/emacs.org @@ -1910,6 +1910,116 @@ Org-mode is probably one of the best if not the best Emacs feature I have ever d (with-eval-after-load 'org #+END_SRC +**** Beautify Org-mode +:PROPERTIES: +:CUSTOM_ID: Beautify-Org-mode-0506af2f +:END: +As I will always say, orgmode is an amazing piece of software that deserves particular care and love. That is why I want to give it a unique look and feel compared to the rest of my Emacs configuration, in order to make it feel much more comfortable. You will find below how my org buffers look like when I open one of them. + +#+include: ./img/org-mode.svg export html + +And here you can find the source code of this buffer you just saw a screenshot of: +#+BEGIN_SRC org :exports code + ,#+TITLE: My Document + ,#+AUTHOR: Lucien Cartier-Tilet + ,#+EMAIL: lucien@phundrak.com + ,#+DATE: 2020-12-21 + ,#+TAGS: tag1|tag2|tag3 + ,* Header 1 + :PROPERTIES: + :CUSTOM_ID: custom-id-for-html-export + :END: + # A regular comment + This is an example org file, with [[https://config.phundrak.com/emacs][a link]], a {{{macro(with arguments)}}}, an <>, a code block and a bullet list: + ,#+header :export code + ,#+BEGIN_SRC emacs-lisp + (message "Hello World!") + ,#+END_SRC + + ,* Element 1 + ,* Element 2 + + ,** TODO Global task [1/2] + ,*** TODO [#A] Task 1 + ,*** TODO Checkboxes [1/3] + - [ ] Hello + - [ ] World! + - [X] This is done + ,*** DONE Task 2 + CLOSED: [2020-12-21 mon. 14:30] + ,** Header 2 + ,*** Header 3 + ,**** Header 4 + ,***** Header 5 + ,****** Header 6 + ,******* Header 7 + ,******** Header 8 +#+END_SRC + +In order to make org-mode even sexier, let’s enable ~variable-pitch-mode~ for org-mode so we can get some proportional font. I’ll also remove ~auto-fill-mode~ which seems to stick to Orgmode like hell and I don’t know why. +#+BEGIN_SRC emacs-lisp + (add-hook 'org-mode-hook 'visual-line-mode) + (remove-hook 'org-mode-hook 'auto-fill-mode) + (add-hook 'org-mode-hook 'variable-pitch-mode) + (auto-fill-mode -1) +#+END_SRC + +Fonts will play an important part in this, but so will colors and font size. The following code is largely based on the one found [[https://zzamboni.org/post/beautifying-org-mode-in-emacs/][on this blog post]] and [[https://lepisma.xyz/2017/10/28/ricing-org-mode/][this one]]. +#+BEGIN_SRC emacs-lisp + (let* ((font `(:font "Charis SIL" :height 1.0)) + (head `(:inherit default :weight bold)) + (fixed `(:inherit fixed-pitch :height 0.8))) + (custom-theme-set-faces + 'user + `(org-level-1 ((t (,@font ,@head :foreground ,phundrak/nord15 :height 1.75)))) + `(org-level-2 ((t (,@font ,@head :foreground ,phundrak/nord10 :height 1.5)))) + `(org-level-3 ((t (,@font ,@head :foreground ,phundrak/nord9 :height 1.25)))) + `(org-level-4 ((t (,@font ,@head :foreground ,phundrak/nord15 :height 1.1)))) + `(org-level-5 ((t (,@font ,@head :foreground ,phundrak/nord8)))) + `(org-level-6 ((t (,@font ,@head :foreground ,phundrak/nord7)))) + `(org-level-7 ((t (,@font ,@head :foreground ,phundrak/nord15)))) + `(org-level-8 ((t (,@font ,@head :foreground ,phundrak/nord6)))) + `(org-document-title ((t (,@font ,@head :foreground ,phundrak/nord11 :height 2.0 :italic t)))) + `(variable-pitch ((t (,@font :height 1.3 :weight thin)))) + `(org-block ((t (,@fixed)))) + `(org-block-begin-line ((t (,@fixed)))) + `(org-indent ((t (,@fixed)))) + `(org-formula ((t (,@fixed)))) + `(org-macro ((t (,@fixed)))) + `(org-target ((t (,@fixed)))) + `(org-property-value ((t (,@fixed))) t) + `(org-drawer ((t (,@fixed :foreground ,phundrak/nord10))) t) + `(org-table ((t (,@fixed :foreground ,phundrak/nord14))) t) + '(org-code ((t (:inherit (shadow fixed-pitch))))) + '(org-verbatim ((t (:inherit (shadow fixed-pitch))))) + '(org-document-info-keyword ((t (:inherit (shadow fixed-pitch))))) + '(org-tag ((t (:inherit (shadow fixed-pitch) :weight bold)))) + '(org-meta-line ((t (:inherit (font-lock-comment-face fixed-pitch) :height 0.8)))) + `(org-special-keyword ((t (:inherit (font-lock-comment-face fixed-pitch) :height 0.8 :foreground ,phundrak/nord15)))) + '(org-checkbox ((t (:inherit (org-todo shadow fixed-pitch))))) + `(org-document-info ((t (:foreground ,phundrak/nord12)))) + `(org-link ((t (:foreground ,phundrak/nord8 :underline t)))))) +#+END_SRC + +Some other tweaks will make Org-mode more beautiful. This includes a new folding icon, some indentation that is not added whitespace. +#+BEGIN_SRC emacs-lisp + (setq org-startup-indented t + org-startup-align-all-tables t + org-pretty-entities t + org-fontify-whole-heading-line t + org-fontify-done-headline t + org-fontify-quote-and-verse-blocks t + org-display-inline-images t + org-redisplay-inline-images t + org-startup-with-inline-images "inlineimages" + org-ellipsis "  ") +#+END_SRC + +Finally, let’s limit the width of images inlined in org buffers to 400px: +#+BEGIN_SRC emacs-lisp + (setq org-image-actual-width 400) +#+END_SRC + **** Custom org-mode functions :PROPERTIES: :CUSTOM_ID: User_Configuration-Org-mode-Custom_org-mode_functions-f1726995 @@ -3336,76 +3446,6 @@ I want to see by default how much battery my computer has, so let’s enable it: (spacemacs/toggle-mode-line-battery-on) #+END_SRC -*** Beautify Org-mode -:PROPERTIES: -:CUSTOM_ID: User-Configuration-Visual-configuration-Beautify-Org-mode-0506af2f -:END: -As I will always say, orgmode is an amazing piece of software that deserves particular care and love. That is why I want to give it a unique look and feel compared to the rest of my Emacs configuration, in order to make it feel much more comfortable. - -In order to make org-mode even sexier, let’s enable ~variable-pitch-mode~ for org-mode so we can get some proportional font. I’ll also remove ~auto-fill-mode~ which seems to stick to Orgmode like hell and I don’t know why. -#+BEGIN_SRC emacs-lisp - (add-hook 'org-mode-hook 'visual-line-mode) - (remove-hook 'org-mode-hook 'auto-fill-mode) - (add-hook 'org-mode-hook 'variable-pitch-mode) - (auto-fill-mode -1) -#+END_SRC - -Fonts will play an important part in this, but so will colors and font size. The following code is largely based on the one found [[https://zzamboni.org/post/beautifying-org-mode-in-emacs/][on this blog post]] and [[https://lepisma.xyz/2017/10/28/ricing-org-mode/][this one]]. -#+BEGIN_SRC emacs-lisp - (let* ((font `(:font "Charis SIL" :height 1.0)) - (head `(:inherit default :weight bold)) - (fixed `(:inherit fixed-pitch :height 0.8))) - (custom-theme-set-faces - 'user - `(org-level-1 ((t (,@font ,@head :foreground ,phundrak/nord15 :height 1.75)))) - `(org-level-2 ((t (,@font ,@head :foreground ,phundrak/nord10 :height 1.5)))) - `(org-level-3 ((t (,@font ,@head :foreground ,phundrak/nord9 :height 1.25)))) - `(org-level-4 ((t (,@font ,@head :foreground ,phundrak/nord15 :height 1.1)))) - `(org-level-5 ((t (,@font ,@head :foreground ,phundrak/nord8)))) - `(org-level-6 ((t (,@font ,@head :foreground ,phundrak/nord7)))) - `(org-level-7 ((t (,@font ,@head :foreground ,phundrak/nord15)))) - `(org-level-8 ((t (,@font ,@head :foreground ,phundrak/nord6)))) - `(org-document-title ((t (,@font ,@head :foreground ,phundrak/nord11 :height 2.0 :italic t)))) - `(variable-pitch ((t (,@font :height 1.3 :weight thin)))) - `(org-block ((t (,@fixed)))) - `(org-block-begin-line ((t (,@fixed)))) - `(org-indent ((t (,@fixed)))) - `(org-formula ((t (,@fixed)))) - `(org-macro ((t (,@fixed)))) - `(org-target ((t (,@fixed)))) - `(org-property-value ((t (,@fixed))) t) - `(org-drawer ((t (,@fixed :foreground ,phundrak/nord10))) t) - `(org-table ((t (,@fixed :foreground ,phundrak/nord14))) t) - '(org-code ((t (:inherit (shadow fixed-pitch))))) - '(org-verbatim ((t (:inherit (shadow fixed-pitch))))) - '(org-document-info-keyword ((t (:inherit (shadow fixed-pitch))))) - '(org-tag ((t (:inherit (shadow fixed-pitch) :weight bold)))) - '(org-meta-line ((t (:inherit (font-lock-comment-face fixed-pitch) :height 0.8)))) - `(org-special-keyword ((t (:inherit (font-lock-comment-face fixed-pitch) :height 0.8 :foreground ,phundrak/nord15)))) - '(org-checkbox ((t (:inherit (org-todo shadow fixed-pitch))))) - `(org-document-info ((t (:foreground ,phundrak/nord12)))) - `(org-link ((t (:foreground ,phundrak/nord8 :underline t)))))) -#+END_SRC - -Some other tweaks will make Org-mode more beautiful. This includes a new folding icon, some indentation that is not added whitespace. -#+BEGIN_SRC emacs-lisp - (setq org-startup-indented t - org-startup-align-all-tables t - org-pretty-entities t - org-fontify-whole-heading-line t - org-fontify-done-headline t - org-fontify-quote-and-verse-blocks t - org-display-inline-images t - org-redisplay-inline-images t - org-startup-with-inline-images "inlineimages" - org-ellipsis "  ") -#+END_SRC - -Finally, let’s limit the width of images inlined in org buffers to 400px: -#+BEGIN_SRC emacs-lisp - (setq org-image-actual-width 400) -#+END_SRC - *** Prettified symbols :PROPERTIES: :CUSTOM_ID: User_Configuration-Miscellaneous-Prettified_symbols-da50f4a6