@ -26,23 +26,14 @@
;; $HOME/.profile or similar.
( setenv " SSH_AUTH_SOCK "
( string-trim
( shell-command-to-string " gpgconf --list-dirs agent-ssh-socket " ) ) )
;; Use pinentry-emacs
;; (pinentry-start)
) )
( use-package init-org
:demand t )
( shell-command-to-string " gpgconf --list-dirs agent-ssh-socket " ) ) ) ) )
( use-package init-org-publish
:demand t )
:after org )
( use-package init-notmuch
:demand t )
;; (use-package init-exwm
;; :demand t)
( use-package flycheck-ledger
:demand t
:after ( flycheck ledger-mode )
@ -56,6 +47,267 @@
:init ( progn
( add-hook 'ledger-mode-hook #' company-mode ) ) )
( use-package olivetti
:hook ( org-mode . olivetti-mode )
:config ( progn
( setq-default olivetti-body-width 80 ) ) )
( use-package org
:hook ( ( org-mode . org-indent-mode ) )
:bind ( :map global-map
( ( " C-c l " . org-store-link )
( " C-c a " . org-agenda )
( " C-c c " . org-capture )
( " C-c p " . org-pomodoro ) )
:map org-mode-map
( ( " C-c C-j " . avy-goto-word-1 )
( " M-, " . org-mark-ring-goto )
( " M-. " . nico-org-open-at-point-same-window ) ) )
:config ( progn
;; preserve the indentation inside of source blocks
( setq org-src-preserve-indentation t )
;; Allow electric-pair-mode to surround things with = and ~ in org-mode
( modify-syntax-entry ?~ " (~ " org-mode-syntax-table )
( modify-syntax-entry ?= " (= " org-mode-syntax-table )
( org-babel-do-load-languages
'org-babel-load-languages
' ( ( ditaa . t )
( js . t )
( emacs-lisp . t ) ) )
;; Fontify org-mode code blocks
( setq org-src-fontify-natively t )
;; Export TODO items in iCal too
( setq org-icalendar-include-todo t )
;; org-capture
( setq org-capture-templates ' ( ) )
( add-to-list 'org-capture-templates
' ( " p " " Appt [agenda] " entry ( file " ~/org/agenda.org " )
" * %i%? \n %^T " ) )
( add-to-list 'org-capture-templates
' ( " p " " Appt [shared] " entry ( file " ~/org/shared.org " )
" * %i%? \n %^T " ) )
( defvar french-holiday
' ( ( holiday-fixed 1 1 " Jour de l'an " )
( holiday-fixed 5 1 " Fête du travail " )
( holiday-fixed 5 8 " Victoire 45 " )
( holiday-fixed 7 14 " Fête nationale " )
( holiday-fixed 8 15 " Assomption " )
( holiday-fixed 11 1 " Toussaint " )
( holiday-fixed 11 11 " Armistice 18 " )
( holiday-fixed 12 25 " Noël " )
( holiday-easter-etc 1 " Lundi de Pâques " )
( holiday-easter-etc 39 " Ascension " )
( holiday-easter-etc 50 " Lundi de Pentecôte " ) ) )
( setq calendar-date-style 'european
calendar-holidays french-holiday
calendar-mark-holidays-flag t )
( defun nico-org-open-at-point-same-window ( )
" Like `org-open-at-point' , but configured to open in the same window. "
( interactive )
( let ( ( org-link-frame-setup ' ( ( file . find-file ) ) ) )
( org-open-at-point ) ) )
( defun org-agenda-skip-all-siblings-but-first ( )
( let ( should-skip-entry )
( unless ( org-current-is-todo )
( setq should-skip-entry t ) )
( save-excursion
( while ( and ( not should-skip-entry ) ( org-goto-sibling t ) )
( when ( org-current-is-todo )
( setq should-skip-entry t ) ) ) )
( when should-skip-entry
( or ( outline-next-heading )
( goto-char ( point-max ) ) ) ) ) )
( defun org-current-is-todo ( )
( string= " TODO " ( org-get-todo-state ) ) )
( defun org-agenda-format-parent ( n )
;; (s-truncate n (org-format-outline-path (org-get-outline-path)))
( save-excursion
( save-restriction
( widen )
( org-up-heading-safe )
( s-truncate n ( org-get-heading t t ) ) ) ) )
( add-hook 'before-save-hook
#' nico/org-align-all-tags )
( defun nico/org-align-all-tags ( )
( interactive )
( when ( eq major-mode 'org-mode )
( org-align-all-tags ) ) )
( defun nico/org-update-parent-cookie ( )
( when ( eq major-mode 'org-mode )
( save-excursion
( ignore-errors
( org-back-to-heading )
( org-update-parent-todo-statistics ) ) ) ) )
( defadvice org-kill-line ( after fix-cookies activate )
( nico/org-update-parent-cookie ) )
( defadvice kill-whole-line ( after fix-cookies activate )
( nico/org-update-parent-cookie ) )
( defadvice org-archive-subtree ( after fix-cookies activate )
( nico/org-update-parent-cookie ) ) ) )
( use-package org-caldav
:after org
:bind ( ( " C-c S " . org-caldav-sync ) )
:config
( progn
( setq gnutls-algorithm-priority " NORMAL:-VERS-TLS1.3 " )
( setq org-caldav-url " https://dav.petton.fr/nico "
org-caldav-calendar-id " 882703e4-1ee8-e657-dcec-5b5fe7a2ff52 "
org-caldav-inbox " ~/org/shared.org "
org-caldav-files ' ( )
org-icalendar-timezone " Europe/Paris "
org-caldav-sync-changes-to-org 'all ) ) )
( use-package org-pomodoro
:after org )
( use-package org-superstar
:after org
:hook ( org-mode . org-superstar-mode )
:config ( progn
( setq org-superstar-headline-bullets-list ' ( 8226 ) )
( setq org-superstar-special-todo-items t ) ) )
( use-package org-roam
:hook ( after-init . org-roam-mode )
:custom
( org-id-link-to-org-use-id t )
;; When renaming, links get updated after 2sec idle, which can lead to issues
;; when renaming multiple times without idling, see
;; https://github.com/org-roam/org-roam/issues/1425#issuecomment-775715148
( org-roam-db-update-method 'immediate )
( org-roam-directory " ~/org/roam/ " )
( org-roam-db-location ( expand-file-name " roam.db " org-roam-directory ) )
( org-roam-completion-system 'ivy )
( org-roam-buffer-position 'right )
( org-roam-dailies-capture-templates ' (
( " d " " default " plain #' org-roam-capture--get-point
" %? "
:file-name " daily/%<%Y-%m-%d> "
:head " #+title: %<%Y-%m-%d> \n " )
( " t " " Todo " plain #' org-roam-capture--get-point
" * TODO %? "
:file-name " daily/%<%Y-%m-%d> "
:head " #+title: %<%Y-%m-%d> \n " ) ) )
( org-roam-capture-templates ' ( ( " d " " default " plain #' org-roam-capture--get-point
" %? "
:file-name " %<%Y-%m-%d>-${slug} "
:head " #+title: ${title} \n #+created: %T \n #+Time-stamp: %T \n \n " ) ) )
:bind ( :map org-roam-mode-map
( ( " C-c r l " . org-roam )
( " C-c r f " . org-roam-find-file )
( " C-c r g " . org-roam-graph )
( " C-c r p " . org-roam-dailies-find-previous-note )
( " C-c r n " . org-roam-dailies-find-next-note ) )
:map org-mode-map
( ( " C-c r i " . org-roam-insert )
( " C-c r I " . org-roam-insert-immediate ) )
:map global-map
( ( " C-c r . " . org-roam-dailies-find-today )
( " C-c r t " . org-roam-dailies-find-today )
( " C-c r d " . org-roam-dailies-capture-today )
( " C-c RET " . org-roam-capture ) ) )
:config ( progn
( setq org-default-notes-file " ~/org/roam/2021-02-14-inbox.org " )
;;
;; Task management with org-roam inspired by https://d12frosted.io/
;;
( defun nico-org-project-p ( )
" Return non-nil if current buffer has any todo entry.
TODO entries marked as done are ignored, meaning the this
function returns nil if current buffer contains only completed
tasks. "
( seq-find
( lambda ( type )
( eq type 'todo ) )
( org-element-map
( org-element-parse-buffer 'headline )
'headline
( lambda ( headline )
( org-element-property :todo-type headline ) ) ) ) )
( defun nico-org-project-update-tag ( )
" Update PROJECT tag in the current buffer. "
( when ( and ( not ( active-minibuffer-window ) )
( nico-org-roam-buffer-p ) )
( let* ( ( file ( buffer-file-name ( buffer-base-buffer ) ) )
( all-tags ( org-roam--extract-tags file ) )
( prop-tags ( org-roam--extract-tags-prop file ) )
( tags prop-tags ) )
( if ( nico-org-project-p )
( setq tags ( cons " Project " tags ) )
( setq tags ( remove " Project " tags ) ) )
( unless ( eq prop-tags tags )
( org-roam--set-global-prop
" ROAM_TAGS "
( combine-and-quote-strings ( seq-uniq tags ) ) ) ) ) ) )
( defun nico-org-roam-buffer-p ( )
" Return non-nil if the currently visited buffer is a note. "
( and buffer-file-name
( string-prefix-p
( expand-file-name ( file-name-as-directory org-roam-directory ) )
( file-name-directory buffer-file-name ) ) ) )
( add-hook 'find-file-hook #' nico-org-project-update-tag )
( add-hook 'before-save-hook #' nico-org-project-update-tag )
( defun nico-org-project-files ( )
" Return a list of note files containing Project tag. "
( seq-map
#' car
( org-roam-db-query
[ :select file
:from tags
:where ( like tags ( quote " % \" Project \" % " ) ) ] ) ) )
( defun nico-org-agenda-files-update ( &rest _ )
" Update the value of `org-agenda-files' . "
( setq org-agenda-files ` ( " ~/org/agenda.org "
" ~/org/shared.org "
,@ ( nico-org-project-files ) ) ) )
( advice-add 'org-agenda :before #' nico-org-agenda-files-update ) ) )
( use-package org-roam-protocol
:demand t )
( use-package org-roam-server
:config ( progn
( setq org-roam-server-host " 127.0.0.1 "
org-roam-server-port 8080
org-roam-server-authenticate nil
org-roam-server-export-inline-images t
org-roam-server-serve-files nil
org-roam-server-served-file-extensions ' ( " pdf " " mp4 " " ogv " )
org-roam-server-network-poll t
org-roam-server-network-arrows nil
org-roam-server-network-label-truncate t
org-roam-server-network-label-truncate-length 60
org-roam-server-network-label-wrap-length 20 ) ) )
( use-package ox-twbs
:after org )
( use-package prodigy
:config
( prodigy-define-service
@ -91,7 +343,51 @@
:tags ' ( personal ) ) )
( when ( window-system )
( set-face-attribute 'default nil :height 110 :family " Fira Mono " ) )
( require 'markdown-mode )
( set-face-attribute 'default nil :height 110 :family " Fira Mono " )
( setq-default line-spacing 2 )
;; (set-face-attribute 'variable-pitch nil :height 150 :font "ETBembo")
( set-face-attribute 'variable-pitch nil :height 140 :font " Gentium Book Basic " )
;; (set-face-attribute 'variable-pitch nil :height 130 :font "Fira Sans")
( add-hook 'org-mode-hook 'variable-pitch-mode )
;; Set some faces as fixed pitch
( with-eval-after-load 'org
( mapc ( lambda ( face )
( let* ( ( inherited ( face-attribute face :inherit ) )
( inherited-list ( if ( listp inherited )
inherited
( list inherited ) ) ) )
( set-face-attribute
face nil
:height 110
:inherit ` ( fixed-pitch ,@ inherited-list ) ) ) )
' ( org-drawer
org-verbatim
org-code
org-block
org-block-begin-line
org-block-end-line
org-table
org-block-begin-line
org-block-end-line
org-meta-line
org-todo
org-done
org-special-keyword
org-document-info-keyword
markdown-pre-face
markdown-code-face ) )
;; Some more custom fonts for org-mode
( set-face-attribute 'org-drawer nil :height 100 )
( set-face-attribute 'org-document-info-keyword nil :height 100 )
( set-face-attribute 'org-meta-line nil :height 100 )
( set-face-attribute 'outline-1 nil :weight 'normal )
( set-face-attribute 'outline-2 nil :weight 'normal )
( set-face-attribute 'outline-3 nil :weight 'normal )
( set-face-attribute 'outline-4 nil :weight 'normal )
( set-face-attribute 'outline-5 nil :weight 'normal )
( set-face-attribute 'outline-6 nil :weight 'normal ) ) )
;; Local Variables:
;; indent-tabs-mode: nil