home

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit caef42513786162c9c12cd16b4b6a62113e6df93
parent 326725bda9edd404debb9fc4b698b381d6e84105
Author: Vincent Demeester <vincent@sbr.pm>
Date:   Mon,  6 Apr 2020 15:35:05 +0200

emacs.org: add base typeface configurations

Signed-off-by: Vincent Demeester <vincent@sbr.pm>

Diffstat:
Mdocs/emacs.org | 64++++++++++++++++++++++++++++++++++++++--------------------------
Mtools/emacs/config/setup-style.el | 81+++++++++++++++++++++++++++++++++++++++++++++----------------------------------
2 files changed, 84 insertions(+), 61 deletions(-)

diff --git a/docs/emacs.org b/docs/emacs.org @@ -488,6 +488,18 @@ #+INCLUDE: "../tools/emacs/config/01-server.el" src emacs-lisp :range-begin "UseServer" :range-end "-UseServer" :lines "4-6" +** Base typeface configurations +:PROPERTIES: +:CUSTOM_ID: h:117f0725-0708-43b9-b191-0956ad0a0a7a +:END: + +Let's configure the font that Emacs will use. In the emacs world this is call =face=. I am +a big fan of the [[https://design.ubuntu.com/font/][=Ubuntu= fonts]], so this is the set of font family I use, if available. If +the =Ubuntu= font are not available on the system, I am just letting Emacs start with its +default font. + +#+INCLUDE: "../tools/emacs/config/setup-style.el" src emacs-lisp :range-begin "TypeFaceConfiguration" :range-end "-TypeFaceConfiguration" :lines "7-47" + * TODO Selection candidates and search methods :PROPERTIES: :CUSTOM_ID: h:4323a022-5419-48f7-acf9-7af94e43eddf @@ -554,7 +566,7 @@ First, let's define some basic constants, mainly on how my main =org= folder is organized. -#+INCLUDE: "../tools/emacs/config/setup-org.el" src emacs-lisp :range-begin "OrgConstants" :range-end "-OrgConstants" :lines "4-15" +#+INCLUDE: "../tools/emacs/config/setup-org.el" src emacs-lisp :range-begin "OrgConstants" :range-end "-OrgConstants" :lines "7-18" In a nutshell, I am currently trying the following organization, with =~/desktop/org/= as the base of almost all =org-mode= things: @@ -585,7 +597,7 @@ =inbox.org=. For this, we can use the emacs [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Registers.html][registers]] and more accurately the [[https://www.gnu.org/software/emacs/manual/html_node/emacs/File-Registers.html#File-Registers][file registers]]. -#+INCLUDE: "../tools/emacs/config/setup-org.el" src emacs-lisp :range-begin "OrgRegisters" :range-end "-OrgRegisters" :lines "18-23" +#+INCLUDE: "../tools/emacs/config/setup-org.el" src emacs-lisp :range-begin "OrgRegisters" :range-end "-OrgRegisters" :lines "21-26" With this, I can jump to the inbox with ~C-x r j i~, to the journal using ~C-x r j j~, … @@ -678,7 +690,7 @@ /The =ensure org-plus-contrib= is there to make sure I am loading the =org= module from my nix configuration and not the built-in =org= module (that might lag in terms of version)/ -#+INCLUDE: "../tools/emacs/config/setup-org.el" src emacs-lisp :range-begin "OrgMain" :range-end "-OrgMain" :lines "26-98" +#+INCLUDE: "../tools/emacs/config/setup-org.el" src emacs-lisp :range-begin "OrgMain" :range-end "-OrgMain" :lines "29-104" I've set-up an =org-mode= hook to add few modes to the default setup. - I am really annoyed by trailing white-space so I want them to be shown @@ -687,15 +699,15 @@ + I turn on =auto-revert-mode= so that the buffer is always up-to-date. + I like to have header indented, so I'm enabling =org-indent-mode=. -#+INCLUDE: "../tools/emacs/config/setup-org.el" src emacs-lisp :range-begin "OrgHook" :range-end "-OrgHook" :lines "101-110" +#+INCLUDE: "../tools/emacs/config/setup-org.el" src emacs-lisp :range-begin "OrgHook" :range-end "-OrgHook" :lines "107-116" Let's also use =org-id=… -#+INCLUDE: "../tools/emacs/config/setup-org.el" src emacs-lisp :range-begin "OrgId" :range-end "-OrgId" :lines "113-142" +#+INCLUDE: "../tools/emacs/config/setup-org.el" src emacs-lisp :range-begin "OrgId" :range-end "-OrgId" :lines "119-148" … and =org-crypt= (for encrypted =org-mode= files). -#+INCLUDE: "../tools/emacs/config/setup-org.el" src emacs-lisp :range-begin "OrgCrypt" :range-end "-OrgCrypt" :lines "145-150" +#+INCLUDE: "../tools/emacs/config/setup-org.el" src emacs-lisp :range-begin "OrgCrypt" :range-end "-OrgCrypt" :lines "151-156" **** TODO Refiling :PROPERTIES: @@ -730,11 +742,11 @@ agenda views. This allows to group things and overall set-up the agenda view I want. This agenda view uses the =n= key. -#+INCLUDE: "../tools/emacs/config/setup-org.el" src emacs-lisp :range-begin "OrgAgenda" :range-end "-OrgAgenda" :lines "153-203" +#+INCLUDE: "../tools/emacs/config/setup-org.el" src emacs-lisp :range-begin "OrgAgenda" :range-end "-OrgAgenda" :lines "159-208" Let's try to get my work calendar entries in my agenda too. It is a little bit tricky 👼. -#+INCLUDE: "../tools/emacs/config/setup-org.el" src emacs-lisp :range-begin "OrgGcal" :range-end "-OrgGcal" :lines "206-220" +#+INCLUDE: "../tools/emacs/config/setup-org.el" src emacs-lisp :range-begin "OrgGcal" :range-end "-OrgGcal" :lines "211-225" *** Habits :ATTACH: :PROPERTIES: @@ -766,14 +778,14 @@ [[./images/2020-02-29-14-41-59.png]] -#+INCLUDE: "../tools/emacs/config/setup-org.el" src emacs-lisp :range-begin "OrgHabit" :range-end "-OrgHabit" :lines "223-228" +#+INCLUDE: "../tools/emacs/config/setup-org.el" src emacs-lisp :range-begin "OrgHabit" :range-end "-OrgHabit" :lines "228-233" *** TODO Sources :PROPERTIES: :CUSTOM_ID: h:82c3b800-9d80-408d-b3b6-54dc15b0590c :END: -#+INCLUDE: "../tools/emacs/config/setup-org.el" src emacs-lisp :range-begin "OrgSrc" :range-end "-OrgSrc" :lines "231-238" +#+INCLUDE: "../tools/emacs/config/setup-org.el" src emacs-lisp :range-begin "OrgSrc" :range-end "-OrgSrc" :lines "236-243" *** TODO Capture :PROPERTIES: @@ -790,7 +802,7 @@ options. This is very interesting when you want to group some capture template together (like templates related to /work/, …). -#+INCLUDE: "../tools/emacs/config/setup-org.el" src emacs-lisp :range-begin "OrgCaptureStart" :range-end "-OrgCaptureStart" :lines "241-245" +#+INCLUDE: "../tools/emacs/config/setup-org.el" src emacs-lisp :range-begin "OrgCaptureStart" :range-end "-OrgCaptureStart" :lines "246-250" Some of my capture template are big and hard to read if embedded in the =emacs-lisp= code. The good thing is that =org-mode= is able to load the template from files too 💃. @@ -798,44 +810,44 @@ Here is a list of my templates: - Default :: Store a link (mainly used with =org-protocol=) and take a random note - #+INCLUDE: "../tools/emacs/config/setup-org.el" src emacs-lisp :range-begin "OrgCaptureOldTemplate" :range-end "-OrgCaptureOldTemplate" :lines "248-257" + #+INCLUDE: "../tools/emacs/config/setup-org.el" src emacs-lisp :range-begin "OrgCaptureOldTemplate" :range-end "-OrgCaptureOldTemplate" :lines "253-262" - Tasks :: /work/ task, like reviewing a PR, or cleaning a folder. - #+INCLUDE: "../tools/emacs/config/setup-org.el" src emacs-lisp :range-begin "OrgCaptureTask" :range-end "-OrgCaptureTask" :lines "260-272" + #+INCLUDE: "../tools/emacs/config/setup-org.el" src emacs-lisp :range-begin "OrgCaptureTask" :range-end "-OrgCaptureTask" :lines "265-277" - journaling :: As I use =org-mode= for my /journal/ too, I need capture entry for it. I currently have two types of journal entry : - #+INCLUDE: "../tools/emacs/config/setup-org.el" src emacs-lisp :range-begin "OrgCaptureJournalBase" :range-end "-OrgCaptureJournalBase" :lines "275-277" + #+INCLUDE: "../tools/emacs/config/setup-org.el" src emacs-lisp :range-begin "OrgCaptureJournalBase" :range-end "-OrgCaptureJournalBase" :lines "280-282" + standard: one title and some text #+INCLUDE: "../tools/emacs/etc/orgmode/journal.org" src org - #+INCLUDE: "../tools/emacs/config/setup-org.el" src emacs-lisp :range-begin "OrgCaptureJournalEntry" :range-end "-OrgCaptureJournalEntry" :lines "280-287" + #+INCLUDE: "../tools/emacs/config/setup-org.el" src emacs-lisp :range-begin "OrgCaptureJournalEntry" :range-end "-OrgCaptureJournalEntry" :lines "285-292" + worklog: related to work, to be able to say what I did, what I wanted to do, problems, … during the daily #+INCLUDE: "../tools/emacs/etc/orgmode/worklog.org" src org - #+INCLUDE: "../tools/emacs/config/setup-org.el" src emacs-lisp :range-begin "OrgCaptureWorklog" :range-end "-OrgCaptureWorklog" :lines "290-295" + #+INCLUDE: "../tools/emacs/config/setup-org.el" src emacs-lisp :range-begin "OrgCaptureWorklog" :range-end "-OrgCaptureWorklog" :lines "295-300" - weekly review :: each and every week, I am going through this item to make my review of the week. #+INCLUDE: "../tools/emacs/etc/orgmode/weekly.org" src org - #+INCLUDE: "../tools/emacs/config/setup-org.el" src emacs-lisp :range-begin "OrgCaptureWeekly" :range-end "-OrgCaptureWeekly" :lines "298-303" + #+INCLUDE: "../tools/emacs/config/setup-org.el" src emacs-lisp :range-begin "OrgCaptureWeekly" :range-end "-OrgCaptureWeekly" :lines "303-308" - blog posts :: - #+INCLUDE: "../tools/emacs/config/setup-org.el" src emacs-lisp :range-begin "OrgCaptureBlog" :range-end "-OrgCaptureBlog" :lines "313-315" + #+INCLUDE: "../tools/emacs/config/setup-org.el" src emacs-lisp :range-begin "OrgCaptureBlog" :range-end "-OrgCaptureBlog" :lines "318-320" -#+INCLUDE: "../tools/emacs/config/setup-org.el" src emacs-lisp :range-begin "OrgCaptureEnd" :range-end "-OrgCaptureEnd" :lines "318-319" +#+INCLUDE: "../tools/emacs/config/setup-org.el" src emacs-lisp :range-begin "OrgCaptureEnd" :range-end "-OrgCaptureEnd" :lines "323-324" -#+INCLUDE: "../tools/emacs/config/setup-org.el" src emacs-lisp :range-begin "OrgProtocol" :range-end "-OrgProtocol" :lines "322-324" +#+INCLUDE: "../tools/emacs/config/setup-org.el" src emacs-lisp :range-begin "OrgProtocol" :range-end "-OrgProtocol" :lines "327-329" *** Clocking :PROPERTIES: @@ -855,32 +867,32 @@ In addition to that workflow, I want to switch the state of the task to =STARTED= when I am clocking-in, if it's not already =STARTED=. -#+INCLUDE: "../tools/emacs/config/setup-org.el" src emacs-lisp :range-begin "OrgClock" :range-end "-OrgClock" :lines "327-420" +#+INCLUDE: "../tools/emacs/config/setup-org.el" src emacs-lisp :range-begin "OrgClock" :range-end "-OrgClock" :lines "332-425" *** TODO Links :PROPERTIES: :CUSTOM_ID: h:afc81fbb-f7a0-401c-8b56-19f51edebd88 :END: -#+INCLUDE: "../tools/emacs/config/setup-org.el" src emacs-lisp :range-begin "OrgAttach" :range-end "-OrgAttach" :lines "423-428" +#+INCLUDE: "../tools/emacs/config/setup-org.el" src emacs-lisp :range-begin "OrgAttach" :range-end "-OrgAttach" :lines "428-433" -#+INCLUDE: "../tools/emacs/config/setup-org.el" src emacs-lisp :range-begin "OrgLinks" :range-end "-OrgLinks" :lines "431-467" +#+INCLUDE: "../tools/emacs/config/setup-org.el" src emacs-lisp :range-begin "OrgLinks" :range-end "-OrgLinks" :lines "436-461" *** TODO Litterate programming :PROPERTIES: :CUSTOM_ID: h:b5f6beba-6195-4ff0-a194-502ac2a9e3da :END: -#+INCLUDE: "../tools/emacs/config/setup-org.el" src emacs-lisp :range-begin "OrgBabel" :range-end "-OrgBabel" :lines "470-529" +#+INCLUDE: "../tools/emacs/config/setup-org.el" src emacs-lisp :range-begin "OrgBabel" :range-end "-OrgBabel" :lines "464-523" *** TODO Exporting :PROPERTIES: :CUSTOM_ID: h:afad00e0-367c-4c7b-b191-e3ed72be754b :END: -#+INCLUDE: "../tools/emacs/config/setup-org.el" src emacs-lisp :range-begin "OrgExportConstants" :range-end "-OrgExportConstants" :lines "532-534" +#+INCLUDE: "../tools/emacs/config/setup-org.el" src emacs-lisp :range-begin "OrgExportConstants" :range-end "-OrgExportConstants" :lines "526-528" -#+INCLUDE: "../tools/emacs/config/setup-org.el" src emacs-lisp :range-begin "OrgExportCfg" :range-end "-OrgExportCfg" :lines "537-548" +#+INCLUDE: "../tools/emacs/config/setup-org.el" src emacs-lisp :range-begin "OrgExportCfg" :range-end "-OrgExportCfg" :lines "531-542" ** TODO Email and newsgroup :PROPERTIES: diff --git a/tools/emacs/config/setup-style.el b/tools/emacs/config/setup-style.el @@ -1,39 +1,50 @@ -;;; -*- lexical-binding: t; -*- +;;; setup-style.el --- -*- lexical-binding: t -*- +;;; Commentary: +;;; Setup of the style, from font faces to themes +;;; Code: + +;; TypeFaceConfiguration ;;; ¯\_(ツ)_/¯ -;;; - Iosevka (https://github.com/be5invis/Iosevka) -;;; - Fira Sans (https://github.com/mozilla/Fira/) -(defconst font-height 130) -;; Middle/Near East: שלום, السّلام عليكم -(when (member "Noto Sans Arabic" (font-family-list)) - (set-fontset-font t 'arabic "Noto Sans Arabic")) -(when (member "Noto Sans Hebrew" (font-family-list)) - (set-fontset-font t 'arabic "Noto Sans Hebrew")) - -;; Africa: ሠላም -(when (member "Noto Sans Ethiopic" (font-family-list)) - (set-fontset-font t 'ethiopic "Noto Sans Ethiopic")) - -(set-face-attribute 'default nil - :family "Ubuntu Mono" - :height font-height) -(set-face-attribute 'variable-pitch nil - :family "Ubuntu Sans" - :height font-height - :weight 'regular) - -;;; Utilities and key bindings -(defun mu-reset-fonts () - "Reset fonts to my preferences." - (interactive) - (set-face-attribute 'default nil - :family "Ubuntu Mono" - :height font-height) - (set-face-attribute 'variable-pitch nil - :family "Ubuntu Sans" - :height font-height - :weight 'regular)) - -(bind-key "C-c f r" #'mu-reset-fonts) +(defconst font-height 130 + "Default font-height to use.") + +(use-package emacs + :bind ("C-c f r" . mu-reset-fonts) + :config + ;; Middle/Near East: שלום, السّلام عليكم + (when (member "Noto Sans Arabic" (font-family-list)) + (set-fontset-font t 'arabic "Noto Sans Arabic")) + (when (member "Noto Sans Hebrew" (font-family-list)) + (set-fontset-font t 'arabic "Noto Sans Hebrew")) + ;; Africa: ሠላም + (when (member "Noto Sans Ethiopic" (font-family-list)) + (set-fontset-font t 'ethiopic "Noto Sans Ethiopic")) + + ;; Default font is Ubuntu Mono (and Ubuntu Sans for variable-pitch) + ;; If Ubuntu Mono or Ubuntu Sans are not available, use the default Emacs face + (when (member "Ubuntu Mono" (font-family-list)) + (set-face-attribute 'default nil + :family "Ubuntu Mono" + :height font-height)) + (when (member "Ubuntu Sans" (font-family-list)) + (set-face-attribute 'variable-pitch nil + :family "Ubuntu Sans" + :height font-height + :weight 'regular)) + + (defun mu-reset-fonts () + "Reset fonts to my preferences." + (interactive) + (when when (member "Ubuntu Mono" (font-family-list)) + (set-face-attribute 'default nil + :family "Ubuntu Mono" + :height font-height)) + (when when (member "Ubuntu Sans" (font-family-list)) + (set-face-attribute 'variable-pitch nil + :family "Ubuntu Sans" + :height font-height + :weight 'regular)))) +;; -TypeFaceConfiguration ;;; Interface (use-package frame ; Frames