up config org

This commit is contained in:
Tykayn 2022-10-08 10:58:27 +02:00 committed by tykayn
parent 959c054bed
commit 99c08e560c
1 changed files with 419 additions and 383 deletions

View File

@ -6,9 +6,9 @@
* Ma config emacs
Voici la documentation au format Orgmode de ma configuration d'Emacs. Pour que cela fonctionne, il faut demander au fichier de config dans le dossier utilisateur, le fichier ".emacs" débutant par un point, de charger ce fichier config.org.
Voici la documentation au format Orgmode de ma configuration d'Emacs. Pour que cela fonctionne, il faut demander au fichier de config dans le dossier utilisateur, le fichier "~/.emacs" débutant par un point, de l'actuel fichier config.org.
J'utilise un dossier Nextcloud pour stocker mes textes, on retrouvera donc souvent des mentions à ce dossier dans la config. Ma liste d0s tâches [[file:tasks.org]] pour la gestion de projets se compose d'un fichier principal et de quelques autres.
J'utilise un dossier Nextcloud pour stocker mes textes, on retrouvera donc souvent des mentions à ce dossier dans la config. Ma liste de tâches [[file:tasks.org]] pour la gestion de projets se compose d'un fichier principal et de quelques autres.
Les réunions ont leur propre fichier, le journal aussi.
Fichiers souvent utiles:
- file:/home/tykayn/Nextcloud/textes/orgmode/tasks.org
@ -20,6 +20,8 @@ Fichiers souvent utiles:
Contenu du fichier de config [[file:~/.emacs]]
#+begin_quote
;; straight el bootstrap https://github.com/raxod502/straight.el#getting-started
(defvar bootstrap-version)
(let ((bootstrap-file
(expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
@ -39,8 +41,6 @@ Contenu du fichier de config [[file:~/.emacs]]
(setq package-enable-at-startup nil)
(use-package org)
(setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3")
(org-babel-load-file "~/Nextcloud/textes/orgmode/config.org")
@ -49,7 +49,6 @@ Contenu du fichier de config [[file:~/.emacs]]
* Introduction
Ma configuration d'Emacs. Voir la doc personnelle des concepts généraux d'[[id:3adc0f02-729a-42fc-ae1f-7c29a1e5b11c][emacs]] ici.
** Initialisation de cette configuration
Pour que cela fonctionne, il faut demander au fichier de config dans le dossier utilisateur, le fichier ".emacs" débutant par un point, de charger ce fichier **config.org**.
J'utilise un dossier Nextcloud pour stocker mes textes, on retrouvera donc souvent des mentions à ce dossier dans la config.
@ -97,6 +96,7 @@ Contenu du fichier de config [[file:~/.emacs]]
(setq org-fontify-whole-heading-line t)
(setq org-tags-column 0)
(setq org-adapt-indentation t)
;; (setq org-src-preserve-indentation t)
(setq org-deadline-warning-days 0)
(setq line-move-visual t)
;; Keep tasks with dates on the global todo lists
@ -171,13 +171,15 @@ Contenu du fichier de config [[file:~/.emacs]]
(tags-todo "drawing")
(tags-todo "coding")
(tags-todo "writing")
(tags-todo "reading")
(tags-todo "computer")
(tags-todo "home")
(tags-todo "santé")
(tags-todo "errands"))
"Usual list of contexts.")
(setq org-agenda-sorting-strategy
'((agenda time-up priority-down tag-up category-keep)
'((agenda tag-up time-up priority-down category-keep)
;; (todo user-defined-up todo-state-up priority-down effort-up)
(todo todo-state-up priority-down effort-up)
(tags user-defined-up)
@ -196,6 +198,9 @@ Contenu du fichier de config [[file:~/.emacs]]
nil
"\\<IGNORE\\>"))
#+end_src
** Séquences de choses à faire
#+begin_src emacs-lisp
@ -207,10 +212,6 @@ Contenu du fichier de config [[file:~/.emacs]]
;; "TOBLOG(b)" ; next action
"WAITING(w@/!)"
"SOMEDAY(.)" "BLOCKED(k@/!)" "|" "DONE(x!)" "CANCELLED(c)")
(sequence "PROJECT" "|" "DONE(x)")
(sequence "LEARN" "TRY" "TEACH" "|" "DONE(x)")
;; (sequence "TOSKETCH" "SKETCHED" "|" "POSTED")
(sequence "TOBUY" "TOSHRINK" "TOCUT" "TOSEW" "|" "DONE(x)")
(sequence "TODELEGATE(-)" "DELEGATED(d)" "|" "DONE(x)")))
#+end_src
@ -223,16 +224,9 @@ Contenu du fichier de config [[file:~/.emacs]]
(use-package org-super-agenda)
(use-package org-ql)
(bind-key "<apps> a" 'org-agenda)
(setq org-return-follows-link t)
(setq org-cycle-include-plain-lists 'integrate)
(defun my-org-agenda-skip-scheduled ()
(org-agenda-skip-entry-if 'scheduled 'deadline 'regexp "\n]+>"))
@ -282,9 +276,16 @@ Contenu du fichier de config [[file:~/.emacs]]
("c" "Cancelled" tags-todo "CANCELLED")
("D" "Done tasks" tags-todo "DONE")
("g". "GTD Searches") ;; category searches
("gd" "Daily"
agenda "" (
(org-agenda-overriding-header "\n-------------- Daily ------------------\n")
(org-agenda-span 1)
(tags-todo "+PRIORITY=\"A\"")
(tags-todo "+inbox")
)
)
("gw" "Weekly review"
agenda ""
(
agenda "" (
(org-agenda-overriding-header "\nRevue hebdomadaire\n------------------\n")
(org-agenda-start-day "-7d")
(org-agenda-span 7)
@ -308,7 +309,6 @@ Contenu du fichier de config [[file:~/.emacs]]
((org-agenda-skip-function 'my-org-agenda-skip-scheduled)
(org-agenda-sorting-strategy '(priority-down effort-down))
(org-agenda-max-entries 3)))
("p" "By priority"
((tags-todo "+PRIORITY=\"A\"")
(tags-todo "+PRIORITY=\"B\"")
@ -321,11 +321,14 @@ Contenu du fichier de config [[file:~/.emacs]]
(org-agenda-start-on-weekday nil) ;; calendar begins today
(org-agenda-repeating-timestamp-show-all t)
(org-agenda-entry-types '(:timestamp :sexp))))
(agenda "" ((org-agenda-span 1) ; daily agenda
(agenda "" (
(org-agenda-span 1) ; daily agenda
(org-deadline-warning-days 7) ; 7 day advanced warning for deadlines
(org-agenda-todo-keyword-format "[ ]")
(org-agenda-scheduled-leaders '("" ""))
(org-agenda-prefix-format "%t%s")))
(org-agenda-prefix-format "%t%s")
)
)
(todo "TODO" ;; todos sorted by context
((org-agenda-prefix-format "[ ] %T: ")
(org-agenda-sorting-strategy '(tag-up priority-down))
@ -361,13 +364,39 @@ Contenu du fichier de config [[file:~/.emacs]]
'(todo-state-down effort-up category-keep)))
)
)
))
)
)
#+end_src
** Revue mensuelle
** Ménage dans les tâches réalisées
#+begin_src emacs-lisp
(defun my-org-clean-up-inbox ()
"Archive all DONE tasks and sort the remainder by TODO order."
(interactive)
(with-current-buffer (find-file my-org-inbox-file)
(my-org-archive-done-tasks 'file)
(goto-char (point-min))
(if (org-at-heading-p) (save-excursion (insert "\n")))
(org-sort-entries nil ?p)
(goto-char (point-min))
(org-sort-entries nil ?o)
(save-buffer)))
(defun my-org-archive-done-tasks (&optional scope)
"Archive finished or cancelled tasks.
SCOPE can be 'file or 'tree."
(interactive)
(org-map-entries
(lambda ()
(org-archive-subtree)
(setq org-map-continue-from (outline-previous-heading)))
"TODO=\"DONE\"|TODO=\"CANCELLED\"" (or scope (if (org-before-first-heading-p) 'file 'tree))))
#+end_src
** Revue mensuelle (FIXME)
#+begin_src emacs-lisp
(defun my-org-review-month (start-date)
"Review the month's clocked tasks and time."
(interactive (list (org-read-date)))
@ -432,7 +461,7 @@ Contenu du fichier de config [[file:~/.emacs]]
#+end_src
** Définir l'effort sur une tâche
Raccourci pour définir un effort compté en nombre de minutes à consacrer à une tâche: F6.
#+begin_src emacs-lisp
;; org-set-effort
(global-set-key (kbd "<f6>") 'org-set-effort)
@ -470,7 +499,21 @@ Contenu du fichier de config [[file:~/.emacs]]
tags prédéfinis au choix lors de la qualification avec C-c C-q sur une tâche
#+begin_src emacs-lisp
(setq org-tag-alist '(("boulot" . ?b) ("family" . ?f) ("tel" . ?t) ("osm" . ?o) ("cil-gometz" . ?g) ("administratif" . ?a) ("adminsys" . ?d) ("dev" . ?v) ("inbox" . ?i) ("privacy" . ?p) ("habitudes" . ?h) ("backup" . ?u) ("email" .?e)))
(setq org-tag-alist '(
("adminsys" . ?A)
("administratif" . ?a)
("boulot" . ?b)
("dev" . ?d)
("email" .?e)
("GULL" . ?g)
("habitudes" . ?h)
("social" . ?s)
("tel" . ?t)
("osm" . ?o)
("inbox" . ?i)
("rangement" . ?r)
)
)
(setq org-todo-state-tags-triggers '(("CANCELLED" ("ARCHIVE" . t))))
#+end_src
@ -486,6 +529,8 @@ https://orgmode.org/manual/Template-expansion.html
'(
("t" "Todo" entry (file+headline "~/Nextcloud/textes/orgmode/tasks.org" "Inbox")
"* TODO %?\n")
("d" "Todo this Day" entry (file+headline "~/Nextcloud/textes/orgmode/tasks.org" "Inbox")
"* TODO %?\nDEADLINE:%T")
("l" "ToLearn" entry (file+headline "~/Nextcloud/textes/orgmode/tasks.org" "Recherches et éducation")
"* LEARN %?\n %i\n %a")
("b" "Boulot" entry (file+headline "~/Nextcloud/textes/orgmode/boulot.org" "Inbox")
@ -506,15 +551,14 @@ https://orgmode.org/manual/Template-expansion.html
;; raccourci custom pour clavier sans pavé numérique
(global-set-key (kbd "C-T") 'org-todo)
(global-set-key (kbd "C-T") 'org-capture)
(defun insert-created-date(&rest ignore)
(org-back-to-heading) ; in org-capture, this folds the entry; when inserting a heading, this moves point back to the heading line
(move-end-of-line()) ; when inserting a heading, this moves point to the end of the line
(insert (format-time-string
(concat " \nCREATED: "
(cdr org-time-stamp-formats))
))
(org-back-to-heading) ; in org-capture, this folds the entry; when inserting a heading, this moves point back to the heading line
(move-end-of-line()) ; when inserting a heading, this moves point to the end of the line
)
@ -544,7 +588,7 @@ https://orgmode.org/manual/Template-expansion.html
(org-roam-capture-templates
'(("d" "default" plain
"%?"
:if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n")
:if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n\n* ${title}%?")
:unnarrowed t)
("m" "meeting" plain (file "~/Nextclod/textes/orgmode/org-roam/20220620110632-meeting_template.org")
:if-new (file+head "%<%Y%m%d%H%M%S>-meeting-${slug}.org" "#+title: ${title}\n")
@ -631,7 +675,6 @@ https://orgmode.org/manual/Template-expansion.html
;; agenda vue calendrier avec Ctrl Shift F12
(global-set-key (kbd "C-s-<f12>") 'cfw:open-org-calendar)
#+end_src
* Insérer la date et l'heure
@ -662,12 +705,10 @@ exemple : <2022-06-27 lun. 18:51>
;; fait par tykayn le 7-04-2022
;; version GNU Emacs 27.1
#+end_src
** Gestion de paquets Straight.el
#+begin_src emacs-lisp
;; on utilise straight.el pour déclarer les packages à utiliser
#+end_src
** Charset UTF-8
@ -684,7 +725,6 @@ exemple : <2022-06-27 lun. 18:51>
#+begin_src emacs-lisp
(setq initial-buffer-choice "~/Nextcloud/textes/orgmode/tasks.org")
#+end_src
** Centrer la fenêtre
#+begin_src emacs-lisp
@ -696,7 +736,7 @@ exemple : <2022-06-27 lun. 18:51>
#+begin_src emacs-lisp
;; (use-package dirvish
;; :init
;; Let Dirvish take over Dired globally
;; ;; Let Dirvish take over Dired globally
;; (dirvish-override-dired-mode)
;; )
;; (require 'dirvish)
@ -742,7 +782,6 @@ exemple : <2022-06-27 lun. 18:51>
(global-set-key (kbd "C-<S-C>") 'comment-eclipse)
#+end_src
** Tout sélectionner
#+begin_src emacs-lisp
@ -764,10 +803,12 @@ exemple : <2022-06-27 lun. 18:51>
"C-x C-q" ;; read-only-mode
))
#+end_src
* Common usage CUA
#+begin_src emacs-lisp
;; raccourcis communs pour copier coller de texte
(cua-mode t)
#+end_src
* Recherche globale
Deft
#+begin_src emacs-lisp
@ -784,8 +825,6 @@ Deft
* Lecture
#+begin_src emacs-lisp
;; raccourcis communs pour copier coller de texte
(cua-mode t)
;; - - - - - - - - - - - - - - - - - - - - - - - - - custom keys - - - - - - - - - - - - - - - - - - - - - - - - -
(global-set-key (kbd "C-c l") 'org-store-link)
@ -794,28 +833,23 @@ Deft
;;---- open tasks list at startup
(setq initial-buffer-choice "~/Nextcloud/textes/orgmode/config.org")
;; barres de GUI
(setq tool-bar-mode t)
(setq scroll-bar-mode t)
(setq menu-bar-mode t)
(setq left-margin-width 5)
(setq right-margin-width 5)
;; highlight of lines
(require 'hl-line)
(add-hook 'prog-mode-hook #'hl-line-mode)
(add-hook 'text-mode-hook #'hl-line-mode)
;; fonts
;; font for errors
(ignore-errors (set-frame-font "JuliaMono-12"))
(use-package doom-themes
:config
;; Global settings (defaults)
@ -837,18 +871,16 @@ Deft
(use-package doom-modeline
:config (doom-modeline-mode))
;; dossier des fichiers org à considérer pour les agendas, uniquement la racine du dossier orgmode dans Nextcloud
(setq org-agenda-files (list "~/Nextcloud/textes/orgmode"))
;; pouvoir faire du refile dans des headers de niveau 2 dans tasks.org
(setq org-refile-targets
'((nil :maxlevel . 1)
( "~/Nextcloud/textes/orgmode/tasks.org" :maxlevel . 2)))
;; alias
(defalias 'yes-or-no-p 'y-or-n-p)
;; - - - - - - - - - - - - - - matching parentheses - - - - - - - - - - - - - - - - - - - - - - - - - -
(use-package paren
:ensure nil
@ -871,8 +903,6 @@ Deft
:after all-the-icons
:hook (dired-mode . all-the-icons-dired-mode))
;; - - - - - - - - - - - - - - - - - - - - - - - - - custom keys - - - - - - - - - - - - - - - - - - - - - - - - -
(global-set-key (kbd "C-c l") 'org-store-link)
(global-set-key (kbd "C-c a") 'org-agenda)
@ -892,15 +922,12 @@ Deft
(bind-key "C-c K" #'kill-all-buffers)
(bind-key "C-x !" #'delete-other-windows) ;; Access to the old keybinding.
(defun switch-to-scratch-buffer ()
"Switch to the current session's scratch buffer."
(interactive)
(switch-to-buffer "*scratch*"))
(bind-key "C-c s" #'switch-to-scratch-buffer)
;; voir la liste des tâches à l'état DONE
(fset 'done-tasks-list
(kmacro-lambda-form [?\C-c ?a ?t kp-2 ?r] 0 "%d"))
@ -917,6 +944,7 @@ Deft
;; save all by default Was: isearch-forward
(defun save-all () (interactive) (save-some-buffers t))
(global-set-key (kbd "C-x C-s") 'save-all)
(global-set-key (kbd "C-o") 'save-all)
(global-set-key (kbd "C-S-c") 'comment-line)
;; recherche dans tous les fichiers du dossier orgmode
(global-set-key (kbd "C-S-f") 'deft)
@ -924,12 +952,10 @@ Deft
;; recherche dans le fichier courant avec ctrl + f
(global-set-key (kbd "C-f") 'isearch-forward)
(global-set-key (kbd "C-c C-f") 'org-roam-node-find)
(global-set-key (kbd "C-c C-i") 'org-roam-node-insert)
(global-set-key (kbd "C-c i") 'org-roam-node-insert)
(global-set-key (kbd "<f5>") 'org-capture)
(global-set-key (kbd "<f8>") 'org-cycle-agenda-files)
(global-set-key (kbd "<f12>") 'org-agenda)
@ -941,10 +967,8 @@ Deft
(global-set-key (kbd "<f2>") 'dir-treeview)
(global-set-key "\C-x\ \C-r" 'recentf-open-files)
(setq org-agenda-sticky t)
;; use org-bullets-mode for utf8 symbols as org bullets
(use-package org-bullets)
(require 'org-bullets)
@ -966,9 +990,6 @@ Deft
;; make available "org-bullet-face" such that I can control the font size individually
(setq org-bullets-face-name (quote org-bullet-face))
;; détail de combinaison de touches
(use-package which-key
:diminish
@ -1004,8 +1025,6 @@ Deft
'(org-level-5 ((t (:inherit outline-5 :height 1.0))))
)
#+end_src
* Heure dans la modeline
@ -1025,8 +1044,7 @@ Deft
calendar-day-abbrev-array ["dim" "lun" "mar" "mer" "jeu" "ven" "sam"]
calendar-day-name-array ["Dimanche" "Lundi" "Mardi" "Mercredi"
"Jeudi" "Vendredi" "Samedi"]
calendar-month-abbrev-array
["jan" "fév" "mar" "avr" "mai" "jun" "jul" "aou" "sep" "oct" "nov" "déc"]
calendar-month-abbrev-array ["jan" "fév" "mar" "avr" "mai" "jun" "jul" "aou" "sep" "oct" "nov" "déc"]
calendar-month-name-array ["Janvier" "Février" "Mars" "Avril" "Mai"
"Juin" "Juillet" "Août" "Septembre"
"Octobre" "Novembre" "Décembre"]
@ -1046,8 +1064,6 @@ Deft
(save-some-buffers t))
(add-hook 'focus-out-hook 'save-all)
#+end_src
** Auto format à la sauvegarde
#+begin_src emacs-lisp
@ -1060,14 +1076,22 @@ Deft
;; https://github.com/emacsorphanage/git-gutter
(use-package git-gutter)
(global-git-gutter-mode +1)
(global-set-key (kbd "C-x C-g") 'git-gutter)
#+end_src
** Auto format
#+begin_src emacs-lisp
(setq org-adapt-indentation t)
;; (setq org-adapt-indentation t)
;; *** Auto Indent
(defun indent-org-block-automatically ()
(when (org-in-src-block-p)
(org-edit-special)
(indent-region (point-min) (point-max))
(org-edit-src-exit)))
(global-set-key (kbd "C-M-f") 'indent-org-block-automatically)
#+end_src
@ -1101,7 +1125,6 @@ Deft
(setq-default truncate-lines t)
#+end_src
** Auto indentation et autres trucs
#+begin_src emacs-lisp
@ -1110,12 +1133,18 @@ Deft
(delete-selection-mode t)
;; (global-display-line-numbers-mode t)
(column-number-mode)
(add-hook 'before-save-hook #'delete-trailing-whitespace)
(add-hook 'before-save-hook #'indent-org-block-automatically)
(setq require-final-newline t)
;; hide some annoyances
(defun do-nothing (interactive))
(defalias 'view-emacs-news 'do-nothing)
(defalias 'describe-gnu-project 'do-nothing)
;; run auto indent org block sources every 10 seconds
(run-at-time 1 10 'indent-org-block-automatically)
(setq user-full-name "TyKayn"
user-mail-address "contact@cipherbliss.com")
@ -1124,11 +1153,9 @@ Deft
** Markdown
#+begin_src emacs-lisp
(use-package markdown-mode
:mode ("\\.\\(njk\\|md\\)\\'" . markdown-mode))
#+end_src
** Json
#+begin_src emacs-lisp
@ -1140,7 +1167,6 @@ Deft
(setq backup-directory-alist '(("." . "~/.config/emacs/backups")))
#+end_src
* Écriture
** Références bibliographiques
@ -1185,28 +1211,26 @@ Deft
:config
)
(setq olivetti-body-width .67
text-scale-increase 1.5
text-scale-increase 1.15
olivetti-mode t
)
;; change font size on load of text files
(add-hook 'text-mode-hook (lambda ()
(interactive)
(message "Olivetti text-mode-hook")
(text-scale-increase 1.5)
;; (text-scale-increase 1.5)
(olivetti-set-width .67)
;; (hidden-mode-line-mode)
(olivetti-mode 1)))
;; focus on text in fullscreen
(use-package writeroom-mode)
#+end_src
** Auto complétion
#+begin_src emacs-lisp
;; Auto completion
(use-package company
:config
@ -1215,7 +1239,6 @@ Deft
company-selection-wrap-around t))
(global-company-mode)
;; Helm configuration
(use-package helm
:config
@ -1237,6 +1260,9 @@ Deft
** Exporter vers HTML avec un style commun
#+begin_src emacs-lisp
;; exporter sans nombres ajoutés dans les titres de section
(setq org-export-with-section-numbers nil)
;; export with default modern css
(defun my-org-inline-css-hook (exporter)
"Insert custom inline css"
@ -1283,7 +1309,7 @@ Deft
(require 'ox-reveal)
#+end_src
*** publication de site web du wiki
*** publication de site web du wiki FIXME
Ox-Hugo https://ox-hugo.scripter.co/doc/installation/
#+begin_src emacs-lisp
;; ----- hugo export to publish website
@ -1313,26 +1339,36 @@ Deft
#+end_src
* Mystères
trucs à trouver comment faire
* Mystères trucs à trouver comment faire
faire de la recherche avec Ctrl + F
faire du remplacement avec Ctrl + H
#+begin_src emacs-lisp
;; non pris en compte pour l'ajout d'une deadline ou schedule
(setq calendar-day-abbrev-array ["Dim" "Lun" "Mar" "Mer" "Jeu" "Ven" "Sam"])
#+end_src
uuuuehh
* Autre
La suite est à inventer.
Pour installer cette configuration d'emacs, lancez le script
#+begin_quote bash
# bash install_emacs_config.sh
#!/bin/bash
echo "installation d'emacs version snap"
sudo apt install snapd
snap install emacs --channel=beta --classic
mkdir -p ~/Nextcloud/textes/orgmode
mkdir -p ~/Nextcloud/textes/orgmode/org-roam
mkdir -p ~/Nextcloud/textes/orgmode
touch ~/.emacs
touch ~/Nextcloud/textes/orgmode/config.org
touch ~/Nextcloud/textes/orgmode/tasks.org