UPDATE emacs config

This commit is contained in:
Alexandre LUCAZEAU 2023-02-08 11:01:16 +01:00
parent 8c306a16f4
commit 0e52ad26ca
3 changed files with 50 additions and 240 deletions

View File

@ -88,105 +88,27 @@
(setq calendar-week-start-day 1)
(setq user-full-name "Alexandre LUCAZEAU")
(setq user-mail-address "alexandre@dri.fr")
(setq mail-user-agent 'gnus-user-agent)
;;(setq gnus-select-method
;; '(nnimap "dri"
;; (nnimap-address "dri.fr")
;; (nnimap-server-port 143)
;; (nnimap-stream starttls)
;; (nnimap-authinfo-file "~/.authinfo.gpg")))
;;
;;(setq gnus-message-archive-group "nnimap+dri:Sent")
;;(setq gnus-gcc-mark-as-read t)
;;(setq nnmail-expiry-target "nnimap+dri:Trash")
;;(setq nnmail-expiry-wait 'immediate)
;;(setq send-mail-function 'smtpmail-send-it)
;;(setq message-send-mail-function 'smtpmail-send-it)
;;(setq smtpmail-smtp-server "dri.fr")
;;(setq smtpmail-smtp-service 587)
;;(setq message-citation-line-function 'message-insert-formatted-citation-line)
;;(setq message-citation-line-format "On %d/%m/%Y %H:%M, %N wrote:")
;;(defun default-web-indent-mode ()
;; (setq indent-tabs-mode nil)
;; (setq tab-width 2)
;; (setq web-mode-markup-indent-offset 2)
;; (setq web-mode-css-indent-offset 2)
;; (setq web-mode-code-indent-offset 2))
(use-package direnv
:config (direnv-mode))
;; (use-package lsp-mode
;; :config (setq lsp-keymap-prefix "C-c l")
;; :config (setq lsp-signature-auto-activate t)
;; :config (setq lsp-enable-on-type-formatting nil)
;; :config (lsp-enable-which-key-integration t)
;; :hook (lsp-mode . electric-pair-mode))
;;(use-package web-mode
;; :mode ("\\.json\\'" . web-mode)
;; :mode ("\\.html?\\'" . web-mode)
;; :mode ("\\.s?css\\'" . web-mode)
;; :mode ("\\.[jt]sx?\\'" . web-mode)
;; :hook (web-mode . lsp-deferred)
;; :hook (web-mode . default-web-indent-mode))
(use-package nix-mode
:mode ("\\.nix\\'" . nix-mode)
:hook (nix-mode . lsp-deferred))
;;(use-package rust-mode
;; :hook (rust-mode . lsp-deferred)
;; :config (setq rust-format-on-save t))
(use-package magit)
(setq magit-fetch-modules-jobs 16); fetch 16 modules in parallel
(use-package company
:config (setq company-idle-delay 0.25)
:config (setq company-minimum-prefix-length 1)
:bind (:map company-active-map ("<tab>" . company-select-next))
:bind (:map company-active-map ("<backtab>" . company-select-previous)))
(use-package which-key
:init (which-key-mode)
:config (setq which-key-idle-delay 0.5))
(use-package yasnippet
:hook (lsp-mode . yas-minor-mode)
:hook (yas-minor-mode . yas-reload-all)
:config (setq yas-snippet-dirs '("/etc/nixos/programs/emacs/snippets")))
(autoload 'markdown-mode "markdown-mode"
"Major mode for editing Markdown files" t)
(add-to-list 'auto-mode-alist
'("\\.\\(?:md\\|markdown\\|mkd\\|mdown\\|mkdn\\|mdwn\\)\\'" . markdown-mode))
;;(use-package prettier-js
;; :after (web-mode)
;; :hook (web-mode . prettier-js-mode))
;;
;;(use-package smartparens
;; :bind ("C-c s s" . sp-splice-sexp)
;; :bind ("C-c s r" . sp-rewrap-sexp))
;;
;;(use-package bbdb
;; :init (bbdb-initialize 'gnus 'message)
;; :init (bbdb-mua-auto-update-init 'gnus 'message)
;; :config (setq bbdb-file "~/Nextcloud/PRIVE/13_Org/contacts/bbdb")
;; :config (setq bbdb-mua-auto-update-p 'create))
(autoload 'gfm-mode "markdown-mode"
"Major mode for editing GitHub Flavored Markdown files" t)
(add-to-list 'auto-mode-alist '("README\\.md\\'" . gfm-mode))
;;(use-package org
;; (setq org-startup-folded t)
;; (setq org-refile-use-outline-path 'file)
;; (setq org-refile-targets
;; '(("~/Nextcloud/PRIVE/13_Org/DRI.org" :maxlevel . 3)
;; ("~/Nextcloud/PRIVE/13_Org/perso.org" :level . 1)
;; ("~/Nextcloud/PRIVE/13_Org/pizajoffre.org" :level . 1)))
;; (setq org-todo-keywords
;; '((sequence "TODO(t)" "PENDING(p)" "|" "CANCELLED(c)" "DONE(d)")))
;; (setq org-todo-keyword-faces
;; '(("TODO" . (:foreground "#c678dd" :weight bold))
;; ("PENDING" . (:background "#3f444a" :foreground "#ff6c6b" :weight bold))))
;; (setq org-capture-templates
;; '(("i" "Inbox" entry (file "~/Nextcloud/PRIVE/13_Org/DRI.org") "* TODO %i%?")
;; ("a" "Agenda" entry (file "~/Nextcloud/PRIVE/13_Org/agenda-DRI.org") "* TODO %i%?\nSCHEDULED: %(org-insert-time-stamp (org-read-date nil t \"+0d\"))")))
;; (setq org-agenda-custom-commands
;; '(("t" "Today" tags-todo "+LEVEL=1+CATEGORY=\"tasks\"|+SCHEDULED<=\"<today>\"|+DEADLINE<=\"<today>\""))))
;;
(use-package org-caldav
:ensure t
:config
@ -200,102 +122,22 @@
(setq org-caldav-delete-calenda-entries 'never)
(setq org-icalendar-timezone "Europe/Paris")
)
(use-package magit)
(setq magit-fetch-modules-jobs 16); fetch 16 modules in parallel
(use-package ledger-mode)
(use-package projectile
:init (projectile-global-mode)
:config (setq projectile-enable-caching nil)
:config (setq projectile-project-search-path (cddr (directory-files "~/code" t)))
:custom (projectile-completion-system 'ivy)
:bind-keymap ("C-c p" . projectile-command-map))
(use-package counsel-projectile
:after (counsel projectile)
:init (counsel-projectile-mode))
(require 'yasnippet)
(yas-global-mode 1)
(use-package which-key
:init (which-key-mode)
:config (setq which-key-idle-delay 0.5))
(setq TeX-PDF-mode t)
(require 'mu4e)
;;store org-mode links to messages
(require 'org-mu4e)
;;store link to message if in header view, not to header query
(setq org-mu4e-link-query-in-headers-mode nil)
(setq mail-user-agent 'mu4e-user-agent)
(setq org-mu4e-link-query-in-headers-mode t)
(setq mu4e-maildir (expand-file-name "~/Maildir/dri/INBOX"))
(setq mu4e-get-mail-command "mbsync -a")
(setq mu4e-sent-folder "/Sent")
(setq mu4e-drafts-folder "/Drafts")
(setq mu4e-trash-folder "/Junk")
(setq mu4e-refile-folder "/INBOX/archives")
(setq mu4e-context-policy 'pick-first)
(setq mu4e-change-filenames-when-moving t)
(setq starttls-use-gnutls t)
(setq message-send-mail-function 'smtpmail-send-it)
(setq mu4e-update-interval 300)
(setq mu4e-use-fancy-chars t)
(setq mu4e-view-show-addresses t)
(setq mu4e-headers-show-threads t)
(setq mu4e-headers-skip-duplicates t)
(setq mail-user-agent 'mu4e-user-agent)
(defvaralias 'mu4e-compose-signature 'message-signature)
(setq-default mu4e-save-multiple-attachments-without-asking t)
(setq-default mu4e-view-show-addresses t)
(setq-default mu4e-confirm-quit nil)
(setq-default mu4e-hide-index-messages t)
(setq-default mu4e-index-update-in-background t)
(setq mu4e-compose-in-new-frame nil)
;;rename files when moving
;;NEEDED FOR MBSYNC
(setq mu4e-change-filenames-when-moving t)
(setq mu4e-html2text-command "iconv -c -t utf-8 | ${pkgs.pandoc}/bin/pandoc -f html -t plain")
(setq mu4e-view-show-images t)
(when (fboundp 'imagemagick-register-types)
(imagemagick-register-types))
(setq message-kill-buffer-on-exit t)
(require 'org-msg)
(setq org-msg-options "html-postamble:nil H:5 num:nil ^:{} toc:nil author:nil email:nil \\n:t"
org-msg-startup "hidestars indent inlineimages"
org-msg-greeting-fmt "\nHi%s,\n\n"
org-msg-recipient-names '(("alexandre@dri.fr" . "Alexandre"))
org-msg-greeting-name-limit 3
org-msg-default-alternatives '((new . (text html))
(reply-to-html . (text html))
(reply-to-text . (text)))
org-msg-convert-citation t
org-msg-signature "
Regards,
#+begin_signature
--
*Alexandre
/One Emacs to rule them all/
#+end_signature")
(org-msg-mode)
(autoload 'markdown-mode "markdown-mode"
"Major mode for editing Markdown files" t)
(add-to-list 'auto-mode-alist
'("\\.\\(?:md\\|markdown\\|mkd\\|mdown\\|mkdn\\|mdwn\\)\\'" . markdown-mode))
(autoload 'gfm-mode "markdown-mode"
"Major mode for editing GitHub Flavored Markdown files" t)
(add-to-list 'auto-mode-alist '("README\\.md\\'" . gfm-mode))
;; org-mode
(require 'org)
(require 'org-mouse)
(setq org-startup-folded t
org-pretty-entities t
org-hide-emphasis-markers t
org-startup-with-inline-images t
org-image-actual-width '(300))
;; files with ".org" open in org-mode
(add-to-list 'auto-mode-alist '("\\.org$" . org-mode))
(setq org-agenda-files '("~/Nextcloud/PRIVE/13_Org/journal"))
;;;;;;
;; Org-Roam basic configuration
(setq org-directory (concat (getenv "HOME") "/Nextcloud/PRIVE/13_Org"))
(setq org-directory (concat (getenv "HOME") "/Nextcloud/PRIVE/13_Org/notes"))
(use-package org-roam
:after org
@ -323,19 +165,7 @@
(require 'org-roam-dailies) ;; Ensure the keymap is available
(org-roam-db-autosync-mode))
;; org-mode
(require 'org)
(require 'remember)
(require 'org-mouse)
(setq org-startup-folded t
org-pretty-entities t
org-hide-emphasis-markers t
org-startup-with-inline-images t
org-image-actual-width '(300))
;; files with ".org" open in org-mode
(add-to-list 'auto-mode-alist '("\\.org$" . org-mode))
(setq org-agenda-files '("~/Nextcloud/PRIVE/13_Org/agenda-DRI.org" "~/Nextcloud/PRIVE/13_Org/perso.org"))
;; one file org
(defvar org-gtd-file "~/Nextcloud/PRIVE/13_Org/DRI.org")
@ -347,61 +177,38 @@
;; keybinding
(global-set-key "\C-cl" 'org-store-link)
(global-set-key "\C-ca" 'org-agenda)
(global-set-key "\C-cr" 'org-remember)
(global-set-key "\C-cg" 'gtd)
;; This seems like a good basic set of keywords to start out with:
(setq org-todo-keywords '((type "TODO" "SCHEDULED" "NEXT" "WAITING" "DONE")))
(setq org-todo-keywords '((type "TODO" "WAIT" "DONE")))
(setf org-todo-keyword-faces '(("NEXT" . (:foreground "yellow" :background "red" :bold t :weight bold))
("TODO" . (:foreground "cyan" :background "steelblue" :bold t :weight bold))
("WAITING" . (:foreground "yellow" :background "magenta2" :bold t :weight bold))
(setf org-todo-keyword-faces '(("TODO" . (:foreground "cyan" :background "steelblue" :bold t :weight bold))
("WAIT" . (:foreground "yellow" :background "magenta2" :bold t :weight bold))
("DONE" . (:foreground "gray50" :background "gray30"))))
;; tags
(setq org-tag-alist '(("@devis" . ?w) ("@projet" . ?h) ("@client" . ?h) ("@prospect" . ?h) ("interne" . ?l)))
(setq org-tag-alist '(("DEVIS" . ?d) ("PROJETS" . ?p) ("CLIENT" . ?c) ("PROSPECT" . ?o) ("INTERNE" . ?i) ("AO" . ?a) ("PJ" . ?z))
(setq org-tag-faces
'(
("DEVIS" . (:foreground "OrangeRed" :weight bold))
("@projet" . (:foreground "IndianRed1" :weight bold))
("interne" . (:foreground "LimeGreen" :weight bold))
)
)
;; Remember support. This creates several files:
;;
;; ~/todo.org Where remembered TODO's are stored.
;; ~/journal.org Timestamped journal entries.
;; ~/remember.org All other notes
;; and a keybinding of "C-c r" for making quick notes from any buffer.
;; These bits of Remembered information must eventually be reviewed
;; and filed somewhere (perhaps in gtd.org, or in a project-specific
;; org file.) The out-of-sight, out-of-mind rule applies here---if I
;; don't review these auxiliary org-files, I'll probably forget what's
;; in them.
(setq org-reverse-note-order t) ;; note at beginning of file by default.
(setq org-default-notes-file "~/remember.org")
(setq remember-annotation-functions '(org-remember-annotation))
(setq remember-handler-functions '(org-remember-handler))
(add-hook 'remember-mode-hook 'org-remember-apply-template)
(setq org-remember-templates
'((?t "* TODO %?\n %i\n %a" "~/Nextcloud/PRIVE/13_Org/todo.org")
(?j "* %U %?\n\n %i\n %a" "~/Nextcloud/PRIVE/13_Org/journal.org")
(?i "* %^{Title}\n %i\n %a" "~/Nextcloud/PRIVE/13_Org/remember.org" "New Ideas")))
(global-set-key "\C-cr" 'org-remember)
(global-set-key [(f12)] 'org-remember)
;; widen category field a little
(setq org-agenda-prefix-format " %-17:c%?-12t% s")
;; https://gist.github.com/dandrews/4644693
(setq org-ellipsis "")
("PJ" . (:foreground "brightyellow" :weight bold))
("PROJET" . (:foreground "IndianRed1" :weight bold))
("INTERNE" . (:foreground "LimeGreen" :weight bold))
("CLIENT" . (:foreground "Orange" :weight bold))
("PROSPECT" . (:foreground "MediumPurple3" :weight bold))
("AO" . (:foreground "HotPink2" :weight bold))
)
)
;;; Org-journal
;; https://github.com/bastibe/org-journal
;; C-c C-j
(setq org-journal-date-prefix "#+TITLE: ")
(setq org-journal-time-prefix "* ")
(setq org-journal-date-format "%a, %Y-%m-%d")
(setq org-journal-file-format "%Y-%m-%d-journal.org")
(setq org-journal-dir "~/Nextcloud/PRIVE/13_Org/journal/")
(global-set-key "\C-cnj" 'org-journal-new-entry)
(require 'org-journal)

View File

@ -7,6 +7,7 @@
extraPackages = (epkgs:
(with epkgs; [
use-package
dash
doom-themes
lsp-mode
web-mode
@ -19,6 +20,7 @@
prettier-js
smartparens
org
org-journal
org-roam
org-msg
org-caldav

View File

@ -66,6 +66,7 @@
openvpn_24
networkmanager-openvpn
python39Packages.grip
linphone
];
nixpkgs.config.permittedInsecurePackages = [
"ferdi-5.8.1"