diff --git a/pkgs/emacs/default.nix b/pkgs/emacs/default.nix index 37b53bb..b7380bf 100644 --- a/pkgs/emacs/default.nix +++ b/pkgs/emacs/default.nix @@ -22,6 +22,9 @@ emacsWithPackages ( fira-code-mode org-superstar org-roam + org-download + visual-fill-column + writegood-mode nix-mode lsp-python-ms lispy @@ -40,10 +43,9 @@ emacsWithPackages ( ) ++ ( with epkgs.elpaPackages; [ modus-themes + minimap ] ) ++ ( - with pkgs; [ - pkgs.graphviz-nox - ] + with pkgs; [] ) ) diff --git a/users/ccr/default.nix b/users/ccr/default.nix index d2b3e85..fb9ee37 100644 --- a/users/ccr/default.nix +++ b/users/ccr/default.nix @@ -5,6 +5,7 @@ home.packages = with pkgs; [ ack ranger + imv calibre element-desktop gtk-engine-murrine diff --git a/users/profiles/emacs/default.nix b/users/profiles/emacs/default.nix index 63532ff..ae951d6 100644 --- a/users/profiles/emacs/default.nix +++ b/users/profiles/emacs/default.nix @@ -17,11 +17,14 @@ ag nixpkgs-fmt rnix-lsp + graphviz-nox + hunspell + hunspellDicts.en_US + hunspellDicts.it_IT ( makeDesktopItem { name = "org-protocol"; - exec = "emacs %u"; - #exec = "emacsclient %u"; + exec = "emacsclient %u"; comment = "Org protocol"; desktopName = "org-protocol"; type = "Application"; diff --git a/users/profiles/emacs/emacs.d/config/aesthetics.el b/users/profiles/emacs/emacs.d/config/aesthetics.el index 30e2e63..71680a5 100644 --- a/users/profiles/emacs/emacs.d/config/aesthetics.el +++ b/users/profiles/emacs/emacs.d/config/aesthetics.el @@ -14,6 +14,23 @@ (fira-code-mode-set-font) (global-fira-code-mode)) +(use-package visual-fill-column + :commands (visual-fill-column-mode) + :hook + (markdown-mode . activate-visual-fill-column) + (org-mode . activate-visual-fill-column) + :init + (defun activate-visual-fill-column () + (interactive) + (setq-local fill-column 80) + (visual-line-mode t) + (visual-fill-column-mode t)) + :config + (setq-default visual-fill-column-center-text t + visual-fill-column-fringes-outside-margins nil)) + +(use-package minimap) + (defalias 'yes-or-no-p 'y-or-n-p) (setq use-dialog-box nil diff --git a/users/profiles/emacs/emacs.d/config/config-lsp.el b/users/profiles/emacs/emacs.d/config/config-lsp.el index 4c08863..5889ecf 100644 --- a/users/profiles/emacs/emacs.d/config/config-lsp.el +++ b/users/profiles/emacs/emacs.d/config/config-lsp.el @@ -7,7 +7,6 @@ (python-mode . lsp) ;; if you want which-key integration (lsp-mode . lsp-enable-which-key-integration)) - (before-save . lsp-format-buffer) :commands lsp) ;; optionally diff --git a/users/profiles/emacs/emacs.d/config/config-org.el b/users/profiles/emacs/emacs.d/config/config-org.el index f1cc033..83dbf29 100644 --- a/users/profiles/emacs/emacs.d/config/config-org.el +++ b/users/profiles/emacs/emacs.d/config/config-org.el @@ -2,17 +2,36 @@ :init (setq fill-column 80) (require 'org-protocol) + :custom + (org-startup-folded 'fold) :hook - ((org-mode . refill-mode) + ((org-mode . auto-fill-mode) ;refill-mode breaks org headings (org-mode . (lambda () (org-superstar-mode 1))) (org-mode . prettify-symbols-mode))) +(use-package org-download + :hook + ((org-mode . (lambda () (setq-local org-download-image-dir "~/roam/images/"))))) + (use-package org-roam :init (setq org-roam-v2-ack t) :custom (org-roam-directory (file-truename "~/roam/")) (org-roam-graph-executable "dot") + (org-roam-db-location (file-truename "roam/org-roam.db")) + (org-roam-capture-templates + '( + ("i" "incremental" plain + #'org-roam-capture--get-point + "${body}\n%?" ;; this reads from + ; "%i%?" + :empty-lines-before 1 + :file-name "web/${slug}" + :head "#+title: ${title}\n#+roam_key ${ref}\n#+CREATED: %U\n#+LAST_MODIFIED: %U\n\n" + :unnarrowed t) + ("r" "roam-ref" plain #'org-roam-capture--get-point "%i%?" :target (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}")))) + :bind (("C-c n l" . org-roam-buffer-toggle) ("C-c n f" . org-roam-node-find) ("C-c n g" . org-roam-graph) @@ -22,7 +41,7 @@ ("C-c n j" . org-roam-dailies-capture-today)) :config (org-roam-db-autosync-mode) - ;; If using org-roam-protocol - (require 'org-roam-protocol)) + (require 'org-roam-protocol) + (provide 'config-org) diff --git a/users/profiles/emacs/emacs.d/config/config-spelling.el b/users/profiles/emacs/emacs.d/config/config-spelling.el new file mode 100644 index 0000000..37338bf --- /dev/null +++ b/users/profiles/emacs/emacs.d/config/config-spelling.el @@ -0,0 +1,31 @@ +(use-package ispell + :bind + (("C-c s c" . ispell-complete-word) + ("C-c s d" . switch-dictionary-it-en)) + :hook + ((org-mode . flyspell-mode) + (prog-mode . flyspell-prog-mode) + ) + :custom + ((ispell-program-name "hunspell") + (ispell-dictionary "it_IT")) + :config + ;(add-to-list 'ispell-hunspell-dictionary-alist '("italian-hunspell" "[[:alpha:]]" "[^[:alpha:]]" "[']" t ("-d" "it_IT") nil iso-8859-1)) + ;(add-to-list 'ispell-hunspell-dictionary-alist '("english-hunspell" "[[:alpha:]]" "[^[:alpha:]]" "[']" t ("-d" "en_US") nil iso-8859-1)) + (defun switch-dictionary-it-en () + (interactive) + (let* ((dict ispell-current-dictionary) + (new (if (string= dict "it_IT") "en_US" + "it_IT"))) + (ispell-change-dictionary new) + (message "Switched dictionary from %s to %s" dict new)))) + +(use-package writegood-mode + :bind + (("C-c s g" . writegood-grade-level) + ("C-c s r" . writegood-reading-ease) + ("C-c s w" . writegood-mode))) + + + +(provide 'config-spelling) diff --git a/users/profiles/emacs/emacs.d/config/nix.el b/users/profiles/emacs/emacs.d/config/nix.el index 9805f51..957d891 100644 --- a/users/profiles/emacs/emacs.d/config/nix.el +++ b/users/profiles/emacs/emacs.d/config/nix.el @@ -1,6 +1,8 @@ (use-package nix-mode - :mode "\\.nix\\'") - + :mode "\\.nix\\'" + ;:hook + ;(before-save . lsp-format-buffer)) +) (require 'sudo-utils) (defun nixos-rebuild-switch () diff --git a/users/profiles/emacs/emacs.d/init.el b/users/profiles/emacs/emacs.d/init.el index a89a3cb..fc7a3b5 100644 --- a/users/profiles/emacs/emacs.d/init.el +++ b/users/profiles/emacs/emacs.d/init.el @@ -3,6 +3,14 @@ (setq gc-cons-threshold 100000000 read-process-output-max (* 1024 1024)) +(defun executable-find (command) ;; to move + "Search for COMMAND in `exec-path' and return the absolute file name. +Return nil if COMMAND is not found anywhere in `exec-path'." + ;; Use 1 rather than file-executable-p to better match the behavior of + ;; call-process. + (locate-file command exec-path exec-suffixes 1)) + + (require 'aesthetics) (require 'config-emacs) (require 'config-evil) @@ -14,4 +22,7 @@ (require 'config-treemacs) (require 'config-lsp) (require 'config-python) +(require 'config-spelling) (require 'nix) + +(server-start)