58 KiB
Executable File
My Emacs Configuration
- Ma config emacs - config.org
- Introduction
- Préconfiguration
- List packages
- Orgmode
- Global
- Contextes d'agenda
- Séquences de choses à faire
- Vue d'agenda Orgmode
- Ménage dans les tâches réalisées
- Revue mensuelle (FIXME)
- Pimper les couleurs
- Définir l'effort sur une tâche
- Deadlines et Schedules
- Listes de tags
- Template de capture
- Org Roam, wiki personnel
- Images incluses dans les fichiers org
- Refile des tâches
- Liste de fichiers à considérer pour l'Agenda
- Macros pour lister et archiver les tâches finies
- Ajout de date de création d'une tâche
- Raccourcis
- Lecture
- Syncronisation
- Démarrage
- IDE et Code - Environnement de Développement Intégré
- Interface
- Traduction - Fr
- Sauvegarde et historique
- Développement
- Écriture
- Exports
- À suivre
- Désactivées
- WIP - configuration non testées
- Mastodon post
- copier coller d'images
- Modernité de l'éditeur
- Bibliographie
- Projectile, gestion de projets
- Ajout de majuscule aux entêtes (FIXME)
- Traduction du mini agenda FIXME
- Auto refresh d'agenda FIXME
- Ménage dans les fichiers
- publication de site web du wiki FIXME
- Faire un log de toutes les commandes réalisées en live (FIXME)
- Frame suivante et précédente
- UTF 8
- Supprimer les espaces de fin
- Dired - vue des dossiers et fichiers dans Emacs
- Best default settings
- Dossiers dirvish
- Export d'un site web hugo
- Template vierge
- Have fun!
Ma config emacs - 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 de tâches /tykayn/scripts/src/commit/05f971797ca162197b9bb6d9bee01b2c7e01d895/assets/org/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
- /tykayn/scripts/src/commit/05f971797ca162197b9bb6d9bee01b2c7e01d895/assets/org/reunions.org.
- /tykayn/scripts/src/commit/05f971797ca162197b9bb6d9bee01b2c7e01d895/assets/org/journal.org.
- boulot
- lemonway
Contenu du fichier de config /tykayn/scripts/src/commit/05f971797ca162197b9bb6d9bee01b2c7e01d895/assets/org/~/.emacs
;; -- lexical-binding: t; --
;; The default is 800 kilobytes. Measured in bytes. (setq gc-cons-threshold (* 50 1000 1000))
;; Profile emacs startup (add-hook 'emacs-startup-hook (lambda () (message "* Emacs loaded in %s seconds with %d garbage collections." (emacs-init-time "%.2f") gcs-done)))
;; 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)) (bootstrap-version 5)) (unless (file-exists-p bootstrap-file) (with-current-buffer (url-retrieve-synchronously "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el" 'silent 'inhibit-cookies) (goto-char (point-max)) (eval-print-last-sexp))) (load bootstrap-file nil 'nomessage))
(straight-use-package 'use-package) (setq straight-use-package-by-default t) (use-package org)
(setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3") (set-default-coding-systems 'utf-8)
(org-babel-load-file "~/Nextcloud/textes/orgmode/config.org") (server-start)
(global-set-key (kbd "<escape>") 'keyboard-escape-quit)
Introduction
Ma configuration d'Emacs. Voir la doc personnelle des concepts généraux d'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.
Préconfiguration
;; -*- coding: utf-8; lexical-binding: t -*-
;; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - toujours s'assurer que les packages sont installés - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
;; fait par tykayn le 7-04-2022
;; version GNU Emacs 28.2
Gestion de paquets Straight.el
;; on utilise straight.el pour déclarer les packages à utiliser
Charset UTF-8
List packages
Adding Melpa
;; add melpa packages
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
;; Comment/uncomment this line to enable MELPA Stable if desired. See `package-archive-priorities`
;; and `package-pinned-packages`. Most users will not need or want to do this.
;;(add-to-list 'package-archives '("melpa-stable" . "https://stable.melpa.org/packages/") t)
(package-initialize)
Orgmode
Global
;; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
;; Org-Mode
; Things we can't set as defaults above, we can set here
(defun org-setup ()
(setq line-spacing 3)
(setq global-hl-line-mode nil)
(set-fringe-mode 0)
; Enable habit tracking (and a bunch of other modules)
;;; position the habit graph on the agenda to the right of the default
(setq org-habit-graph-column 50)
(setq header-line-format " ")
(setq org-ellipsis "⤵")
(setq org-catch-invisible-edits 'show-and-error)
(setq org-hide-emphasis-markers t)
(setq org-fontify-whole-heading-line t)
(setq org-tags-column 0)
(setq org-adapt-indentation t)
(setq org-deadline-warning-days 0)
(setq line-move-visual t)
;; Keep tasks with dates on the global todo lists
(setq org-agenda-todo-ignore-with-date nil)
;; Keep tasks with deadlines on the global todo lists
(setq org-agenda-todo-ignore-deadlines nil)
;; Keep tasks with scheduled dates on the global todo lists
(setq org-agenda-todo-ignore-scheduled nil)
;; Keep tasks with timestamps on the global todo lists
(setq org-agenda-todo-ignore-timestamp nil)
;; Remove completed deadline tasks from the agenda view
(setq org-agenda-skip-deadline-if-done t)
;; Remove completed scheduled tasks from the agenda view
(setq org-agenda-skip-scheduled-if-done t)
;; Remove completed items from search results
;; (setq org-agenda-skip-timestamp-if-done t)
;; Use sticky agenda's so they persist
(setq org-agenda-sticky t)
;; block tasks if child tasks are not done
(setq org-enforce-todo-dependencies t)
(setq org-cycle-separator-lines 0)
;; Enable display of the time grid so we can see the marker for the current time
(setq org-agenda-span 2)
(setq org-agenda-tags-column -100) ; take advantage of the screen width
(setq org-agenda-inhibit-startup t)
(setq org-agenda-use-tag-inheritance t)
(setq org-agenda-show-log t)
(setq org-agenda-skip-scheduled-if-done t)
(setq org-agenda-skip-deadline-if-done t)
(setq org-agenda-skip-deadline-prewarning-if-scheduled 'pre-scheduled)
(setq org-agenda-time-grid
'((daily today require-timed)
(800 1000 1200 1400 1600 1800 2000)
"......" "----------------"))
(setq org-columns-default-format "%14SCHEDULED %Effort{:} %1PRIORITY %TODO %50ITEM %TAGS")
;; Set default column view headings: Task Effort Clock_Summary
(setq org-columns-default-format "%80ITEM(Task) %10Effort(Effort){:} %10CLOCKSUM")
(setq
org-log-created 'time
org-log-done 'time
org-log-reschedule 'time
org-log-redeadline 'time
org-log-into-drawer t
org-log-refile 'time
))
(add-hook 'org-mode-hook #'org-setup)
;; click a link in the same frame when opening a file
(custom-set-variables
'(org-link-frame-setup
'((vm . vm-visit-folder-other-frame)
(vm-imap . vm-visit-imap-folder-other-frame)
(gnus . org-gnus-no-new-news)
(file . find-file)
(wl . wl-other-frame)))
'(git-gutter:visual-line t)
)
Contextes d'agenda
(defvar my-org-agenda-contexts
'((tags-todo "phone")
(tags-todo "work")
(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 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)
(search category-keep)))
(setq org-agenda-cmp-user-defined 'my-org-sort-agenda-items-user-defined)
(defun my-org-agenda-list-unscheduled (&rest ignore)
"Create agenda view for tasks that are unscheduled and not done."
(let* ((org-agenda-todo-ignore-with-date t)
(org-agenda-overriding-header "List of unscheduled tasks: "))
(org-agenda-get-todos)))
(setq org-stuck-projects
'("+PROJECT-MAYBE-DONE"
("TODO")
nil
"\\<IGNORE\\>"))
Séquences de choses à faire
(setq org-todo-keywords
'((sequence
"SOMEDAY(.!)"
"TODO(t!)"
"NEXT(n!)"
"|"
"DONE(x!)" "CANCELLED(c!)")
(sequence
"TORELAUNCH(r@/!)" "TODELEGATE(-!)" "DELEGATED(d!)" "|" "DONE(1!)")))
Vue d'agenda Orgmode
Présentation personnalisée d'agenda, "custom views".
;; Custom agenda command definitions --------------------------
;; https://orgmode.org/worg/org-tutorials/org-custom-agenda-commands.html
(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]+>"))
(setq org-agenda-prefix-format
'((agenda . " %i %-12:c%?-12t% s")
(todo . " ")
(tags . " %i %-12:c")
(search . " %i %-12:c")))
(setq org-agenda-custom-commands
(quote (
;; ("s" "Super Agenda" agenda "FIXXME: does work but w/o super-agenda"
;; (org-super-agenda-mode)
;; (org-agenda nil "a"))
("c" "Classique Agenda et Todos"
((agenda "" ((org-agenda-span 2)))
(alltodo
""
((org-agenda-overriding-header "")
(org-super-agenda-groups
'((:name "Important, unscheduled"
:and (:priority "A"
:scheduled nil)
:order 2)
(:name "Inbox"
:file-path "Inbox.org"
:order 1)
(:name "Project-related, unscheduled"
:and (:tag "project" :date nil :todo ("STARTED" "WAITING" "TODO"))
:order 3)
(:name "Waiting"
:and (:todo "WAITING"
:scheduled nil)
:order 4)
(:discard (:todo "SOMEDAY"
:category "cooking"
:date t))
(:name "Unscheduled"
:scheduled nil
:order 5)
(:discard (:anything t))
)
)))
))
("x" "Unscheduled, untagged tasks" tags-todo "-someday-TODO=\"SOMEDAY\"-TODO=\"DELEGATED\"-TODO=\"WAITING\"-project-cooking-routine-evilplans-computer-writing-phone-sewing-home-errands-shopping"
((org-agenda-skip-function 'my-org-agenda-skip-scheduled)
(org-agenda-view-columns-initially nil)
(org-tags-exclude-from-inheritance '("project"))
(org-agenda-overriding-header "Unscheduled TODO entries: ")
(org-columns-default-format "%50ITEM %TODO %3PRIORITY %Effort{:} %TAGS")
(org-agenda-sorting-strategy '(todo-state-up priority-down effort-up tag-up category-keep))))
("b" "Boulot" tags-todo "+boulot")
("c" "Cancelled" tags-todo "CANCELLED")
("D" "Done tasks" tags-todo "DONE")
("i" "Inbox to sort" tags "+inbox")
("g". "GTD Searches") ;; category searches
("gd" "Daily"
agenda "" (
(org-agenda-overriding-header "\n-------------- Agenda du jour ------------------\n")
;; (org-agenda-todo-keyword-format "[ ]")
(org-agenda-span 1)
(tags-todo "+PRIORITY=\"A\"")
)
;; montrer aussi ce qui est dans l'inbox pour le trier
(tags-todo "+inbox")
)
("gw" "Weekly review"
agenda "" (
(org-agenda-overriding-header "\n-------------- Revue hebdomadaire\n------------------\n")
(org-agenda-start-day "-7d")
(org-agenda-span 7)
(org-agenda-start-on-weekday 1)
(org-agenda-start-with-log-mode '(closed))
(org-agenda-archives-mode t)
(org-agenda-todo-keyword-format "[X]")
(org-agenda-skip-function
'(org-agenda-skip-entry-if 'notregexp "^\\*\\* DONE ")
)
)
)
("g2" "Bi-weekly review" agenda "" ((org-agenda-span 14) (org-agenda-log-mode 1)))
("0" "Unestimated tasks" tags-todo "EFFORT=\"\"")
("5" "Quick tasks" tags-todo "EFFORT>=\"5\"&EFFORT<=\"15\"")
("8" "Medium tasks" tags-todo "EFFORT>=\"15\"&EFFORT<=\"60\"")
("9" "Unscheduled top 3 by context" my-org-agenda-contexts
((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\"")
(tags-todo "+PRIORITY=\"\"")
(tags-todo "+PRIORITY=\"C\"")
)
((org-agenda-prefix-format "%-10c %-10T %e ")
(org-agenda-sorting-strategy '(priority-down tag-up category-keep effort-down))))
("P" "Printed paper agenda"
(
(agenda "" (
(org-agenda-span 7) ;; overview of appointments
(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
(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")
)
)
(todo "TODO" ;; todos sorted by context
(
(org-agenda-prefix-format "[ ] %T: ")
(org-agenda-sorting-strategy '(tag-up priority-down))
(org-agenda-todo-keyword-format "")
(org-agenda-overriding-header "\nTasks by Context\n------------------\n")
)
)
)
((org-agenda-with-colors nil)
(org-agenda-compact-blocks t)
(org-agenda-remove-tags t)
(ps-number-of-columns 2)
(ps-landscape-mode t))
("~/agenda.ps"))
("f". "Filter Searches") ;; category searches
("fc" tags "+claire")
("fh" tags "+helia")
("fv" tags "+vovo")
("fs" tags "+social")
("n" "Non boulot" tags-todo "-boulot+TODO=TODO"
(todo "TODO"
((org-agenda-prefix-format "[ ] %T: ")
(org-agenda-overriding-header "Tâches pour le fun")
(org-agenda-sorting-strategy
'(todo-state-down effort-up category-keep)
))
)
)
("h" "Habits" tags-todo "STYLE=\"habit\""
((org-agenda-overriding-header "Habitudes")
(org-agenda-todo-keyword-format "[ ]")
(org-agenda-sorting-strategy
'(todo-state-down effort-up category-keep)))
)
)
)
)
Ménage dans les tâches réalisées
(defun my-org-clean-up-inbox ()
"Archive all DONE tasks and sort the remainder by TODO order."
(interactive)
(with-current-buffer (find-file "~/Nextcloud/textes/orgmode/tasks.org")
(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))))
Revue mensuelle (FIXME)
Pimper les couleurs
;; pimp my agenda colors
(setq org-todo-keyword-faces
'(
("TODO" . org-warning)
("STARTED" . "yellow")
;; ("DONE" . (:foreground "#B4EB89") )
("WAITING" . (:foreground "red" :weight bold))
("SOMEDAY" . (:foreground "gray" :weight bold))
;; ("CANCELED" . (:foreground "#234" :weight bold))
)
)
Définir l'effort sur une tâche
Raccourci pour définir un effort compté en nombre de minutes à consacrer à une tâche: F6.
;; org-set-effort
(global-set-key (kbd "<f6>") 'org-set-effort)
Deadlines et Schedules
Cacher les avertissements de deadline les jours précédents pour ne pas encombrer l'agenda.
;; Hide the deadline prewarning prior to scheduled date.
;;(setq org-agenda-skip-deadline-prewarning-if-scheduled 'pre-scheduled)
(defun my-org-summarize-task-status ()
"Count number of tasks by status.
Probably should make this a dblock someday."
(interactive)
(let (result)
(org-map-entries
(lambda ()
(let ((todo (elt (org-heading-components) 2)))
(if todo
(if (assoc todo result)
(setcdr (assoc todo result)
(1+ (cdr (assoc todo result))))
(setq result (cons (cons todo 1) result)))))))
(message "%s" (mapconcat (lambda (x) (format "%s: %d" (car x) (cdr x)))
result "\n"))))
Listes de tags
tags prédéfinis au choix lors de la qualification avec C-c C-q sur une tâche
(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))))
Template de capture
https://orgmode.org/manual/Template-expansion.html
La tâche à faire par défaut n'a pas de date prédéfinie et n'est pas actée comme étant vraiment un truc à réaliser, son mot clé d'action est donc SOMEDAY, un un truc à faire un jour peut être. méthode gtd
;; full screen captures
;; (add-hook 'org-capture-mode-hook 'delete-other-windows)
;;; templates de capture pour les nouvelles tâches
(setq org-capture-templates
'(
("t" "Todo someday"
entry (file+headline "~/Nextcloud/textes/orgmode/tasks.org" "Inbox")
"* SOMEDAY %? \n")
("d" "Todo this Day" entry (file+headline "~/Nextcloud/textes/orgmode/tasks.org" "Inbox")
"* TODO %?\nDEADLINE:%T \n")
("b" "Boulot" entry (file+headline "~/Nextcloud/textes/orgmode/boulot.org" "Inbox")
"* TODO %?\n :boulot:work: \n\n")
;; (file "~/Nextclod/textes/orgmode/org-roam/20220620110632-meeting_template.org")
("m" "Meeting" entry (file+datetree "~/Nextcloud/textes/orgmode/reunions.org" "Réunions")
"* Réunion %T - %U \n :[[id:d8636e1d-0137-4502-9384-767b41c892b0][boulot:meeting:]] \n\n**** Gens présents\n**** Notes\n - %?\n**** Choses à investiguer\n -\n**** Prochaines actions\n - Fin de la réunion: \n"
)
("e" "E-mail" entry (file+headline "~/Nextcloud/textes/orgmode/tasks.org" "Inbox")
"* TODO %? :mail:écriture: \n\n")
("n" "Next Task" entry (file+headline "~/Nextcloud/textes/orgmode/tasks.org" "Inbox")
"** NEXT %? \nDEADLINE: %t \n\n")
("p" "Phone call" entry (file+headline "~/Nextcloud/textes/orgmode/tasks.org" "Tel")
"* PHONE %? :tel:\n%U \n\n" :clock-in t :clock-resume t)
("j" "Journal" entry (file+datetree "~/Nextcloud/textes/orgmode/journal.org")
"* %?\nÉcrit le %U\n ")
;; ajouter une ligne dans un tableau
("v" "Table" table-line
(file+headline "~/Nextcloud/textes/orgmode/tasks.org" "Table")
"| %U | %? | auto-capture |")
)
)
;; raccourci custom pour clavier sans pavé numérique
(global-set-key (kbd "C-T") 'org-capture)
;; raccourci custom pour clavier sans pavé numérique
(global-set-key (kbd "C-T") 'org-capture)
Org Roam, wiki personnel
https://systemcrafters.net/build-a-second-brain-in-emacs/capturing-notes-efficiently/
Raccourcis Org Roam généraux
(use-package org-roam
:init
(setq org-roam-v2-ack t)
:custom
(org-roam-capture-templates
'(("d" "default" plain
"%?"
: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")
:unnarrowed t
)
("b" "book notes" plain
"\n* Source\n\nAuthor: %^{Author}\nTitle: ${title}\nYear: %^{Year}\n\n* Summary\n\n%?"
:if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n")
:unnarrowed t))
)
:bind (
("C-c n l" . org-roam-buffer-toggle)
("C-c n f" . org-roam-node-find)
("C-c n i" . org-roam-node-insert)
("C-c n g" . org-roam-graph)
("C-c n t" . org-roam-tag-add)
("C-c n a" . org-roam-alias-add)
:map org-roam-dailies-map
("Y" . org-roam-dailies-capture-yesterday)
("T" . org-roam-dailies-capture-tomorrow)
)
:bind-keymap
("C-c n d" . org-roam-dailies-map)
:config
(require 'org-roam-dailies)
(org-roam-db-autosync-mode)
)
(setq org-roam-directory "~/Nextcloud/textes/orgmode/org-roam")
(setq org-roam-completion-everywhere t)
Roam graph
Graph naviguable des liens entre les notes Org Roam.
(use-package org-roam-ui
:straight
(:host github :repo "org-roam/org-roam-ui" :branch "main" :files ("*.el" "out"))
:after org-roam
;; normally we'd recommend hooking orui after org-roam, but since org-roam does not have
;; a hookable mode anymore, you're advised to pick something yourself
;; if you don't care about startup time, use
;; :hook (after-init . org-roam-ui-mode)
:config
(setq org-roam-ui-sync-theme t
org-roam-ui-follow t
org-roam-ui-update-on-save t
org-roam-ui-open-on-start t))
Images incluses dans les fichiers org
(setq org-startup-with-inline-images t)
(global-set-key (kbd "M-<f12>") 'org-toggle-inline-images)
(global-set-key (kbd "C-M-<f12>") 'org-toggle-inline-images)
;; show details to edit links
(global-set-key (kbd "S-<f12>") 'visible-mode)
(global-set-key (kbd "C-S-<f12>") 'visible-mode)
Refile des tâches
Ctrl + R
(global-set-key (kbd "C-R") 'org-refile)
Liste de fichiers à considérer pour l'Agenda
- Refiled on [2022-11-06 dim. 18:36]
;; 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 . 3)))
Macros pour lister et archiver les tâches finies
- Refiled on [2023-02-03 ven. 23:16]
;; voir la liste des tâches à l'état DONE
(fset 'done-tasks-list
(kmacro-lambda-form [?\C-c ?a ?t kp-4 ?r] 0 "%d"))
;; archiver les tâches à l'état DONE
(fset 'archive-done-tasks-list
(kmacro-lambda-form [?\C-c ?a ?t kp-4 ?r] 0 "%d"))
Ajout de date de création d'une tâche
- Refiled on [2023-02-03 ven. 23:22]
- Refiled on [2023-01-08 dim. 10:10]
(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 " \n :PROPERTIES:\n:CREATED: [%F %T] \n:END:\n")
)
)
(org-back-to-heading)
(move-end-of-line())
)
; add to the org-capture hook
(add-hook
'org-capture-before-finalize-hook
#'insert-created-date
)
; hook it to adding headings with M-S-RET
; do not add this to org-insert-heading-hook, otherwise this also works in non-TODO items
;; and Org-mode has no org-insert-todo-heading-hook
;; désactivé
(advice-add 'org-insert-todo-heading :after #'insert-created-date)
Raccourcis
Retirer les mauvais raccourcis
;; remove bad shortcuts
(-map (lambda (x) (unbind-key x)) '(
"C-x C-b";; basic buffer list ibuffer
"C-x C-d" ;; list-directory
"C-z" ;; suspend-frame
"C-x C-z" ;; again
"M-o" ;; facemenu-mode
"<mouse-2>" ;; pasting with mouse-wheel click
"<C-wheel-down>" ;; text scale adjust
"<C-wheel-up>" ;; ditto
"s-n" ;; make-frame
"C-i" ;; tab ?
"C-x C-q" ;; read-only-mode
))
Go to line
;; (global-set-key (kbd "C-G") 'goto-line)
Lister les buffers avec Helm
(global-set-key (kbd "C-x C-b") 'helm-buffers-list)
Commenter une ligne
Avec Ctrl+Shift+C
;; commenter une ligne de code, Ctrl Shift C.
(defun comment-eclipse ()
(interactive)
(let ((start (line-beginning-position))
(end (line-end-position)))
(when (or (not transient-mark-mode) (region-active-p))
(setq start (save-excursion
(goto-char (region-beginning))
(beginning-of-line)
(point))
end (save-excursion
(goto-char (region-end))
(end-of-line)
(point))))
(comment-or-uncomment-region start end)))
(global-set-key (kbd "C-S-c") 'comment-eclipse)
(global-set-key (kbd "C-s-c") 'comment-eclipse)
Tout sélectionner
(global-set-key (kbd "C-a") 'mark-whole-buffer)
Lecture
Thème Doom nord
(use-package doom-themes
:config
;; Global settings (defaults)
(setq doom-themes-enable-bold t ; if nil, bold is universally disabled
doom-themes-enable-italic t) ; if nil, italics is universally disabled
;; thème principal https://github.com/doomemacs/themes
(load-theme 'doom-nord t)
;; Enable flashing mode-line on errors
(doom-themes-visual-bell-config)
;; Enable custom neotree theme (all-the-icons must be installed!)
(doom-themes-neotree-config)
;; or for treemacs users
(setq doom-themes-treemacs-theme "doom-atom") ; use "doom-colors" for less minimal icon theme
(doom-themes-treemacs-config)
;; Corrects (and improves) org-mode's native fontification.
(doom-themes-org-config))
(use-package doom-modeline
:config (doom-modeline-mode))
Random note
Voir une note au hasard https://github.com/mwfogleman/org-randomnote
(use-package org-randomnote
:ensure t
:bind ("C-c r" . org-randomnote))
(load-library "find-lisp")
(setq org-randomnote-candidates
(find-lisp-find-files "~/Nextcloud/textes/orgmode/org-roam" "\.org$"))
Raccourcis d'agenda perso
;; - - - - - - - - - - - - - - - - - - - - - - - - - custom keys - - - - - - - - - - - - - - - - - - - - - - - - -
(global-set-key (kbd "C-c l") 'org-store-link)
(global-set-key (kbd "C-c a") 'org-agenda)
(global-set-key (kbd "C-c c") 'org-capture)
Tout
(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"))
;; alias
(defalias 'yes-or-no-p 'y-or-n-p)
;; - - - - - - - - - - - - - - - - - - - - - - - - - custom keys - - - - - - - - - - - - - - - - - - - - - - - - -
(global-set-key (kbd "C-c l") 'org-store-link)
(global-set-key (kbd "C-c a") 'org-agenda)
(global-set-key (kbd "C-c c") 'org-capture)
(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)
(global-set-key (kbd "C-x C-b") 'ibuffer)
(global-set-key (kbd "C-S-d") 'done-tasks-list)
(global-set-key (kbd "C-M-d") 'archive-done-tasks-list)
;; raccourcis issus d'habitudes de netbeans
;; 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)
(global-set-key (kbd "<f1>") 'deft)
;; recherche dans le fichier courant avec ctrl + f
(global-set-key (kbd "C-f") 'isearch-forward)
(global-set-key (kbd "<f5>") 'org-capture)
(global-set-key (kbd "<f8>") 'org-cycle-agenda-files)
(global-set-key (kbd "<f12>") 'org-agenda)
(global-set-key (kbd "C-c <f9>") 'org-agenda-clock-goto)
(global-set-key (kbd "<f9>") 'org-clock-in)
(global-set-key (kbd "<f10>") 'org-clock-out)
(global-set-key (kbd "<f11>") 'org-clock-goto)
(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)
;; make available "org-bullet-face" such that I can control the font size individually
(setq org-bullets-face-name (quote org-bullet-face))
(add-hook 'org-mode-hook (lambda () (org-bullets-mode 1)))
(setq org-bullets-bullet-list '("·" "○"
"✸"
"✿"
"◇"
"✚"
"○"
))
;; org ellipsis options, other than the default Go to Node...
;; not supported in common font, but supported in Symbola (my fall-back font) ⬎, ⤷, ⤵
(setq org-ellipsis "⤵");; ≫
;; 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
:custom
(which-key-enable-extended-define-key t)
:config
(which-key-mode)
(which-key-setup-minibuffer))
(defun display-startup-echo-area-message ()
"Override the normally tedious startup message."
(message "Squalala!."))
Syncronisation
Auto revert les fichiers modifiés extérieurement
- Refiled on [2023-02-03 ven. 23:20]
- Refiled on [2023-02-03 ven. 23:13]
Résout les probl de syncro de workflow nextcloud.
;; Revert Dired and other buffers
(setq global-auto-revert-non-file-buffers t)
;; Revert buffers when the underlying file has changed
(global-auto-revert-mode 1)
Démarrage
Barres d'outil cachées et choix de plein écran au démarrage
(menu-bar-mode 0)
(tool-bar-mode 0)
(scroll-bar-mode 0)
;; (add-to-list 'default-frame-alist '(fullscreen . maximized))
Centrer la fenêtre
(use-package centered-window
:custom
(cwm-centered-window-width 120))
Fichier par défaut à l'ouverture
Montrer la liste des tâches par défaut
(setq initial-buffer-choice "~/Nextcloud/textes/orgmode/config.org")
;; (setq initial-buffer-choice "~/Nextcloud/textes/orgmode/tasks.org")
Voir le dashboard de tâches au démarrage
- Refiled on [2023-02-03 ven. 23:16]
;;---- open tasks list at startup
(setq initial-buffer-choice "~/Nextcloud/textes/orgmode/tasks.org")
IDE et Code - Environnement de Développement Intégré
Recherche globale
- Refiled on [2023-02-03 ven. 23:16]
Deft
(use-package deft)
(setq deft-directory "~/Nextcloud/textes/orgmode/")
(setq deft-recursive t)
(setq deft-use-filename-as-title t)
(setq deft-file-naming-rules
'((noslash . "-")
(nospace . "-")
(case-fn . downcase)))
Mise en forme des parenthèses
- Refiled on [2023-02-03 ven. 23:16]
;; - - - - - - - - - - - - - - matching parentheses - - - - - - - - - - - - - - - - - - - - - - - - - -
(use-package paren
:ensure nil
:init
(setq show-paren-delay 0)
:config
(show-paren-mode +1))
(show-paren-mode)
(use-package rainbow-delimiters
:hook ((prog-mode . rainbow-delimiters-mode)))
;; dir tree
Voir la liste des sélections copiées
- Refiled on [2023-02-03 ven. 23:16]
Afficher le kill-ring Ctrl+Shift+V
(global-set-key (kbd "C-S-v") 'helm-show-kill-ring)
Calendar framework
- Refiled on [2023-02-03 ven. 23:18]
; calendar display
(use-package calfw)
(use-package calfw-org)
;; First day of the week
(setq calendar-week-start-day 0
calendar-day-name-array ["Dimanche" "Lundi" "Mardi" "Mercredi" "Jeudi" "Vendredi" "Samedi"]
calendar-month-name-array ["Janvier" "Février" "Mars" "Avril" "Mai"
"Juin" "Juillet" "Août" "Septembre"
"Octobre" "Novembre" "Décembre"]
calendar-date-style 'european
org-icalendar-timezone "Europe/Paris"
cfw:fchar-junction ?╋
cfw:fchar-vertical-line ?┃
cfw:fchar-horizontal-line ?━
cfw:fchar-left-junction ?┣
cfw:fchar-right-junction ?┫
cfw:fchar-top-junction ?┯
cfw:fchar-top-left-corner ?┏
cfw:fchar-top-right-corner ?┓
)
;; jour de début de semaine, 1 = Lundi.
(setq calendar-week-start-day 1)
;; agenda vue calendrier avec Ctrl super F12
(global-set-key (kbd "C-s-<f12>") 'cfw:open-org-calendar)
Magit version Git
- Refiled on [2023-02-03 ven. 23:32]
(use-package magit)
;; see local log
(global-set-key (kbd "C-c m l ") 'magit-log:-L)
Interface
Heure dans la modeline
(display-time-mode 1)
Common usage CUA
- Refiled on [2023-02-03 ven. 23:15]
;; raccourcis communs pour copier coller de texte
(cua-mode t)
;; couper toute la ligne, façon Nano editor, et façon PhpStorm
(global-set-key (kbd "C-K") 'kill-whole-line)
(global-set-key (kbd "C-E") 'kill-whole-line)
;; rechercher et remplacer
(global-set-key (kbd "C-S-H") 'query-replace)
Changer la taille de font
- Refiled on [2023-02-03 ven. 23:16]
Ctrl + et Ctrl -
(global-set-key (kbd "C-+") 'text-scale-increase)
(global-set-key (kbd "C--") 'text-scale-decrease)
Font Custom et mode de ligne
- Refiled on [2023-02-03 ven. 23:16]
(add-hook 'org-mode-hook 'variable-pitch-mode)
(add-hook 'org-mode-hook 'visual-line-mode)
(add-hook 'org-mode-hook 'prettify-symbols-mode)
(defun my-org-config/setup-buffer-face ()
(setq buffer-face-mode-face '(:family "Calibri"))
(buffer-face-mode)
)
(custom-set-faces
'(org-level-1 ((t (:inherit outline-1 :height 2.0))))
'(org-level-2 ((t (:inherit outline-2 :height 1.750))))
'(org-level-3 ((t (:inherit outline-3 :height 1.5))))
'(org-level-4 ((t (:inherit outline-4 :height 1.25))))
'(org-level-5 ((t (:inherit outline-5 :height 1.0))))
)
Custom GUI sans barres
- Refiled on [2023-02-03 ven. 23:17]
Désactivez ceci si vous êtes débutant.
;; barres de GUI
(setq tool-bar-mode t)
(setq scroll-bar-mode t)
(setq menu-bar-mode t)
Icones
- Refiled on [2023-02-03 ven. 23:17]
;; - - - - - - - - - - - - - - icons - - - - - - - - - - - - - - - - - - - - - - - - - -
(use-package all-the-icons)
(require 'all-the-icons)
(use-package all-the-icons-dired
:after all-the-icons
:hook (dired-mode . all-the-icons-dired-mode))
Fenêtres, buffers
- Refiled on [2023-02-03 ven. 23:17]
Fermer tous les buffers.
(defun kill-all-buffers ()
"Close all buffers."
(interactive)
(let ((lsp-restart 'ignore))
;; (maybe-unset-buffer-modified)
(delete-other-windows)
(save-some-buffers)
(let
((kill-buffer-query-functions '()))
(mapc 'kill-buffer (buffer-list)))))
(bind-key "C-c K" #'kill-all-buffers)
(bind-key "C-x !" #'delete-other-windows) ;; Access to the old keybinding.
Traduction - Fr
Locale des dates en Fr
;; localise dates
;; https://www.emacswiki.org/emacs/CalendarLocalization#h5o-11
(setq org-agenda-span 7
org-agenda-start-on-weekday 1
european-calendar-style t
display-time-24hr-format t
display-time-day-and-date t
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-name-array ["Janvier" "Février" "Mars" "Avril" "Mai"
"Juin" "Juillet" "Août" "Septembre"
"Octobre" "Novembre" "Décembre"]
org-agenda-start-day "-0d"
org-hierarchical-todo-statistics nil ;; count all TODO as checkboxes
org-scheduled-delay-days 1
org-cycle-separator-lines 0
)
Sauvegarde et historique
Sauvegarde à la perte de focus
;; sauvegarder les frames quand on change de focus
(defun save-all ()
(interactive)
(org-update-all-dblocks)
(save-some-buffers t))
(add-hook 'focus-out-hook 'save-all)
Développement
Gestion de version
;; https://github.com/emacsorphanage/git-gutter
(use-package git-gutter)
(global-git-gutter-mode +1)
Auto format
;; (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-S-f") 'indent-org-block-automatically)
Tab avec largeur de 2 espaces
(setq-default tab-width 2)
Dupliquer la ligne
;; --- dupliquer la sélection
(use-package duplicate-thing
:init
(defun pt/duplicate-thing ()
"Duplicate thing at point without changing the mark."
(interactive)
(save-mark-and-excursion (duplicate-thing 1))
(call-interactively #'next-line))
:bind ("C-d" . pt/duplicate-thing)
)
Ne pas montrer de messages au démarrage
;; hide some annoyances
(defun do-nothing (interactive))
(defalias 'view-emacs-news 'do-nothing)
(defalias 'describe-gnu-project 'do-nothing)
(setq user-full-name "TyKayn"
user-mail-address "contact@cipherbliss.com")
Markdown
(use-package markdown-mode
:mode ("\\.\\(njk\\|md\\)\\'" . markdown-mode))
Json
(use-package json-mode)
Sauvegardes des fichiers
(setq backup-directory-alist '(("." . "~/.config/emacs/backups")))
Écriture
Centrer le texte - Olivetti
;; olivetti
;; Distraction-free screen
(use-package olivetti
:straight t
:init
(setq
olivetti-body-width 85
text-scale-increase 1.15
olivetti-mode t
)
:config
)
;; change font size on load of text files
(
add-hook 'org-mode-hook
(lambda ()
(interactive)
(message "Olivetti text-mode-hook")
;; (olivetti-set-width .75)
;; (hidden-mode-line-mode)
(olivetti-mode 1)
)
)
;; focus on text in fullscreen
(use-package writeroom-mode)
Auto complétion
;; Auto completion
(use-package company
:config
(setq company-idle-delay 0.15
company-minimum-prefix-length 4
company-selection-wrap-around t))
(global-company-mode)
;; Helm configuration
(use-package helm
:config
(require 'helm-config)
:init
(helm-mode 1)
:bind
(("M-x" . helm-M-x) ;; Evaluate functions
("C-x C-f" . helm-find-files) ;; Open or create files
("C-x b" . helm-mini) ;; Select buffers
("C-x C-r" . helm-recentf) ;; Select recently saved files
("C-c i" . helm-imenu) ;; Select document heading
("M-y" . helm-show-kill-ring) ;; Show the kill ring
:map helm-map
;; ("C-z" . helm-select-action)
;; ("<tab>" . helm-execute-persistent-action)
) )
Abbréviations
- Refiled on [2023-01-05 jeu. 14:17]
(add-hook 'text-mode-hook #'abbrev-mode)
(define-abbrev-table 'global-abbrev-table '(
("afaict" "as far as I can tell" nil 0)
("poru" "pour" nil 0)
("sdep" "soit dit en passant" nil 0)
("jspcs" "j'en suis pas complètement sûr" nil 0)
("psa" "pas" nil 0)
("aç" "ça" nil 0)
("osmm" "OpenStreetMap" nil 0)
("cb" "CipherBliss" nil 0)
("tyk" "TyKayn" nil 0)
("omuse" "http://www.emacswiki.org/cgi-bin/oddmuse.pl" nil 0)
("btw" "by the way" nil 0)
("wether" "whether" nil 0)
("ewiki" "http://www.emacswiki.org/cgi-bin/wiki.pl" nil 0)
("pov" "point of view" nil 1)
))
Rangement Org
- Refiled on [2023-01-10 mar. 08:40]
Ranger les headers ou tâches par alphabet, priorité, etc.
;; rangement des headers et tâches
(global-set-key (kbd "C-c C-ç") 'org-sort)
Tabulations
- Refiled on [2023-02-03 ven. 23:13]
- Refiled on [2023-01-05 jeu. 13:54]
(setq-default tab-width 2)
Insérer la date et l'heure
- Refiled on [2023-02-03 ven. 23:15]
raccourci: Ctrl c, ! *Ctrl U Ctrl C . exemple : <2022-06-27 lun. 18:51>
(defvar bjk-timestamp-format "<%Y-%m-%d %H:%M>"
"Format of date to insert with `bjk-timestamp' function
%Y-%m-%d %H:%M will produce something of the form YYYY-MM-DD HH:MM
Do C-h f on `format-time-string' for more info")
(defun bjk-timestamp ()
"Insert a timestamp at the current point.
Note no attempt to go to beginning of line and no added carriage return.
Uses `bjk-timestamp-format' for formatting the date/time."
(interactive)
(insert (org-format-time-string bjk-timestamp-format (current-time)))
)
;; insérer timestamp date et heure
(global-set-key "\C-c !" 'insert-current-date-time)
cliplink
- Refiled on [2023-02-03 ven. 23:23]
coller un lien formaté avec son titre
(use-package org-cliplink)
(require 'org-cliplink)
(global-set-key (kbd "C-x C-v") 'org-cliplink)
Exports
Export en JSON
Pour la création d'une page de rapport d'activités en HTML. stats orgmode
(use-package ox-json)
(require 'ox-json)
Résoudre les liens Roam manquants aux exports org
- Refiled on [2023-02-03 ven. 23:13]
kaushalmodi/ox-hugo#483 Unable to resolve link when exporting org file with r…
(setq org-id-extra-files (find-lisp-find-files org-roam-directory "\.org$"))
Exporter vers HTML avec un style commun
- Refiled on [2023-02-03 ven. 23:21]
Toujours insérer en style inline un fichier css lors des exports en html.
C-c C-e
;; 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"
(when (eq exporter 'html)
(let* ((dir (ignore-errors (file-name-directory (buffer-file-name))))
(path (concat dir "style.css"))
(homestyle (or (null dir) (null (file-exists-p path))))
(final (if homestyle "~/Nextcloud/textes/orgmode/style.css" path))) ;; <- set your own style file path
(setq org-html-head-include-default-style nil)
(setq org-html-head (concat
"<style type=\"text/css\">\n"
"<!--/*--><![CDATA[/*><!--*/\n"
(with-temp-buffer
(insert-file-contents final)
(buffer-string))
"/*]]>*/-->\n"
"</style>\n"))
)))
(add-hook 'org-export-before-processing-hook 'my-org-inline-css-hook)
Présentation reveal js
Pour faire une présentation en slides html avec Reveal JS
(straight-use-package '(ox-reveal :host github
:repo "yjwen/org-reveal"
:branch "master"))
(setq org-reveal-root "file:///home/tykayn/Nextcloud/textes/orgmode/reveal.js")
(require 'ox-reveal)
À suivre
La suite est à inventer. Pour installer cette configuration d'emacs, lancez le script qui se trouve ici https://forge.chapril.org/tykayn/scripts/src/branch/master/install_emacs_tk.sh
wget https://forge.chapril.org/tykayn/scripts/raw/branch/master/install_emacs_tk.sh | bash
Désactivées
Les configurations qui fonctionnenemt mais ont été désactivées
Recompter les cookies à la sauvegarde et mettre en DONE automatiquement [désactivé]
- Refiled on [2023-01-08 dim. 10:10]
- Refiled on [2022-11-18 ven. 23:35]
(defun org-summary-todo (n-done n-not-done)
"Switch entry to DONE when all subentries are done, to TODO otherwise."
(let (org-log-done org-log-states) ; turn off logging
(org-todo (if (= n-not-done 0) "DONE" "TODO"))))
;; (add-hook 'org-after-todo-statistics-hook #'org-summary-todo)
Clean des espaces [désactivé]
- Refiled on [2023-01-08 dim. 10:10]
- Refiled on [2023-01-05 jeu. 13:54]
apt-get install elpa-ws-butler
;; (setq ws-butler-trim-predicate
;; (lambda (beg end)
;; (not (eq 'font-lock-string-face
;; (get-text-property end 'face)))))
;; (require 'ws-butler)
;; (add-hook 'prog-mode-hook #'ws-butler-mode)
WIP - configuration non testées
Mastodon post
copier coller d'images
https://www.orgroam.com/manual.html#Full_002dtext-search-with-Deft
(use-package org-download
:after org
:bind
(:map org-mode-map
(("s-Y" . org-download-screenshot)
("s-y" . org-download-yank))))
Modernité de l'éditeur
basé sur le fichier de conf de Jax Dixit
(delete-selection-mode t)
;; (global-display-line-numbers-mode t)
(column-number-mode)
(setq
;; Double-spaces after periods is morally wrong.
sentence-end-double-space nil
;; scroll to first error
compilation-scroll-output 'first-error
;; Never ding at me, ever.
ring-bell-function 'ignore
fast-but-imprecise-scrolling t
;; prefer newer elisp files
load-prefer-newer t
;; when I say to quit, I mean quit
confirm-kill-processes nil
;; if native-comp is having trouble, there's not very much I can do
native-comp-async-report-warnings-errors 'silent
;; unicode ellipses are better
truncate-string-ellipsis "…"
)
(electric-pair-mode)
(setq require-final-newline t)
;; recherche dans un projet
(use-package deadgrep
:bind (("C-c C-h" . #'deadgrep)))
Bibliographie
C-c C-b pour ajouter une bibliothraphie.
;; BibLaTeX settings
;; bibtex-mode
https://lucidmanager.org/productivity/emacs-bibtex-mode/
Références bibliographiques
;; BibLaTeX settings
Projectile, gestion de projets
;; non pris en compte pour l'ajout d'une deadline ou schedule
;; (use-package projectile)
;; (projectile-mode +1)
;; (define-key projectile-mode-map (kbd "s-p") 'projectile-command-map)
;; (define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map)
Ajout de majuscule aux entêtes (FIXME)
- Refiled on [2022-11-04 ven. 00:30]
;; (defun org-auto-capitalize-headings-and-lists ()
"Create a buffer-local binding of sentence-end to auto-capitalize
section headings and list items."
;; (make-local-variable 'sentence-end)
;; (setq sentence-end (concat (rx (or
;; ;; headings
;; (seq line-start (1+ "*") (1+ space))
;; ;; list and checklist items
;; (seq line-start (0+ space) "-" (1+ space) (? (or "[ ]" "[X]") (1+ space)))))
;; "\\|" (sentence-end))))
;; ;; (add-hook 'org-mode-hook #'org-auto-capitalize-headings-and-lists)
Traduction du mini agenda FIXME
- Refiled on [2022-11-04 ven. 00:32]
Auto refresh d'agenda FIXME
Actuellement réalisé avec un cronjob qui lance un script bash.
- Refiled on [2022-11-04 ven. 00:34]
Toutes les 5 minutes, auto rafraîchir l'agenda si il est présent. https://orgmode.org/worg/org-hacks.html#orga494948
Ménage dans les fichiers
- Refiled on [2022-11-04 ven. 00:35]
Enlever les propriétés vides FIXME
Enlever les tags redondants avec leur Header FIXME
publication de site web du wiki FIXME
- Refiled on [2022-11-04 ven. 00:36]
Ox-Hugo https://ox-hugo.scripter.co/doc/installation/
;; ----- hugo export to publish website
;; (use-package ox-hugo
;; :straight t ;Auto-install the package from Melpa
;; :pin melpa ;`package-archives' should already have ("melpa" . "https://melpa.org/packages/")
;; :after ox)
;; (setq org-hugo-base-dir "~/Nextcloud/textes/hugo")
;; (with-eval-after-load 'ox
;; (require 'ox-hugo))
;; (require 'ox-hugo)
Faire un log de toutes les commandes réalisées en live (FIXME)
Frame suivante et précédente
(global-set-key (kbd "M-<right>") 'next-buffer)
(global-set-key (kbd "M-<left>") 'previous-buffer)
UTF 8
- Refiled on [2022-11-06 dim. 18:37]
(set-charset-priority 'unicode)
(prefer-coding-system 'utf-8-unix)
Supprimer les espaces de fin
- Refiled on [2022-11-06 dim. 18:43]
(add-hook 'before-save-hook #'delete-trailing-whitespace)
;; (setq require-final-newline t)
(defalias 'view-emacs-news 'ignore)
(defalias 'describe-gnu-project 'ignore)
(setq mouse-wheel-tilt-scroll t
mouse-wheel-flip-direction t)
(setq-default truncate-lines t)
Dired - vue des dossiers et fichiers dans Emacs
(global-set-key (kbd "C-x C-d") 'dired)
(global-set-key (kbd "C-x C-j") 'dired-jump)
;; Open dired folders in same buffer
(put 'dired-find-alternate-file 'disabled nil)
;; Sort Dired buffers
(setq dired-listing-switches "-agho --group-directories-first")
;; Move deleted files to trash
(setq delete-by-moving-to-trash t)
Filetags tags sur noms de fichiers dans Dired
Demande l'installation du paquet pip3 filetags
(defun my-dired-filetags ()
"Run \"filetags\" on current or marked files"
(interactive)
(let* ((marked-files (f-uniquify (dired-get-marked-files)))) ;; apply to single file or marked files
;; --disable-server → provides a blocking terminal window (instead of a non-blocking one which swallows the revert-buffer afterward)
(dired-do-shell-command "xfce4-terminal --disable-server --geometry=100x20+330+5 --hide-menubar -x ~/.local/bin/filetags --interactive *" nil marked-files)
)
(revert-buffer nil t t) ;; refresh listing of files
)
(define-key dired-mode-map (kbd "M-t") 'my-dired-filetags)
Best default settings
The 6 Emacs Settings Every User Should Consider - System Crafters
;; Revert buffers when the underlying file has changed
(global-auto-revert-mode 1)
;; Revert Dired and other buffers
(setq global-auto-revert-non-file-buffers t)
;; remember the files you edited most recently
(recentf-mode 1)
;; Save what you enter into minibuffer prompts
(setq history-length 25)
(savehist-mode 1)
;; Remember and restore the last cursor location of opened files
(save-place-mode 1)
;; Don't pop up UI dialogs when prompting
(setq use-dialog-box nil)
Dossiers dirvish
- Refiled on [2023-02-03 ven. 23:18]
;; (use-package dirvish
;; :init
;; ;; Let Dirvish take over Dired globally
;; (dirvish-override-dired-mode)
;; )
;; (require 'dirvish)
Accès aux fichiers courants
- Refiled on [2023-02-03 ven. 23:16]
Accéder à la config
(defun tk/switch-to-config-buffer ()
"Switch to the current session's tasks.org buffer."
(interactive)
(switch-to-buffer "config.org"))
(global-set-key (kbd "C-x c o") 'tk/switch-to-config-buffer)
Accéder aux tâches
(defun tk/switch-to-tasks-buffer ()
"Switch to the current session's tasks.org buffer."
(interactive)
(switch-to-buffer "tasks.org"))
(global-set-key (kbd "C-x C-t") 'tk/switch-to-tasks-buffer)
Fichiers récents
;; see recent files
(use-package recentf
:config
(add-to-list 'recentf-exclude "\\elpa")
(add-to-list 'recentf-exclude "private/tmp")
(recentf-mode))
;; recent files
(setq recentf-max-menu-items 25)
(setq recentf-max-saved-items 25)
Export d'un site web hugo
- Refiled on [2023-02-03 ven. 23:22]
- Refiled on [2023-02-03 ven. 23:14]
orgroam http://blog.sidhartharya.com/exporting-org-roam-notes-to-hugo/
(use-package ox-hugo
:ensure t ;Auto-install the package from Melpa
:pin melpa ;`package-archives' should already have ("melpa" . "https://melpa.org/packages/")
:after ox)
(defun org-hugo--tag-processing-fn-roam-tags(tag-list info)
"Process org roam tags for org hugo"
(if (org-roam--org-roam-file-p)
(append tag-list
'("braindump")
(mapcar #'downcase (org-roam--extract-tags)))
(mapcar #'downcase tag-list)
))
(add-to-list 'org-hugo-tag-processing-functions 'org-hugo--tag-processing-fn-roam-tags)
;; backlinks
(defun org-hugo--org-roam-backlinks (backend)
(when (equal backend 'hugo)
(when (org-roam--org-roam-file-p)
(beginning-of-buffer)
(replace-string "{" "")
(beginning-of-buffer)
(replace-string "}" "")
(end-of-buffer)
(org-roam-buffer--insert-backlinks))))
(add-hook 'org-export-before-processing-hook #'org-hugo--org-roam-backlinks)
Template vierge
Have fun!
merci! https://cipherbliss.com
- TyKayn