diff options
Diffstat (limited to '.emacs.d/rul-lisp/packages')
18 files changed, 563 insertions, 123 deletions
diff --git a/.emacs.d/rul-lisp/packages/rul-bindings.el b/.emacs.d/rul-lisp/packages/rul-bindings.el new file mode 100644 index 0000000..96d14b0 --- /dev/null +++ b/.emacs.d/rul-lisp/packages/rul-bindings.el @@ -0,0 +1,64 @@ +;; Global keybindings +(global-set-key (kbd "C-c R") 'revert-buffer) +(global-set-key (kbd "C-c w") 'whitespace-cleanup) + +(defun help/insert-em-dash () + "Inserts an EM-DASH (not a HYPEN, not an N-DASH)" + (interactive) + (insert "—")) + +(global-set-key (kbd "C--") #'help/insert-em-dash) + +(use-package hydra + :ensure t + :defer 1) + +;; tab-bar +(defhydra hydra-tab-bar (:color amaranth) + "Tab Bar Operations" + ("t" tab-new "Create a new tab" :column "Creation" :exit t) + ("d" dired-other-tab "Open Dired in another tab") + ("f" find-file-other-tab "Find file in another tab") + ("x" tab-close "Close current tab") + ("m" tab-move "Move current tab" :column "Management") + ("r" tab-rename "Rename Tab") + ("<return>" tab-bar-select-tab-by-name "Select tab by name" :column "Navigation") + ("l" tab-next "Next Tab") + ("j" tab-previous "Previous Tab") + ("q" nil "Exit" :exit t)) + +(global-set-key (kbd "C-x t") 'hydra-tab-bar/body) + +;; Zoom +(defhydra hydra-zoom () + "zoom" + ("g" text-scale-increase "in") + ("l" text-scale-decrease "out")) + +(global-set-key (kbd "C-c z") 'hydra-zoom/body) + +;; Go +(defhydra hydra-go () + "zoom" + ("=" gofmt :exit t) + ("c" go-coverage :exit t)) + +;; vterm +(defhydra hydra-vterm () + "zoom" + ("t" multi-vterm "Open a terminal" :exit t) + ("d" multi-vterm-dedicated-open "Dedicated" :exit t) + ("p" multi-vterm-prev "Previous terminal") + ("n" multi-vterm-next "Next terminal") + ("r" multi-vterm-rename-buffer "Rename buffer" :exit t) + ) + +(global-set-key (kbd "C-c t") 'hydra-vterm/body) +(global-set-key (kbd "C-c m") 'hydra-go/body) + +(use-package which-key + :ensure t + :config + (which-key-mode)) + +(provide 'rul-bindings) diff --git a/.emacs.d/rul-lisp/packages/rul-completion.el b/.emacs.d/rul-lisp/packages/rul-completion.el index 2b3afa1..3412354 100644 --- a/.emacs.d/rul-lisp/packages/rul-completion.el +++ b/.emacs.d/rul-lisp/packages/rul-completion.el @@ -1,5 +1,14 @@ (use-package orderless :ensure t) +(setq completion-styles '(basic substring initials orderless)) +(setq completion-category-overrides + '( + (file (styles . (basic partial-completion orderless))) + (project-file (styles . (flex basic substring partial-completion orderless))) + )) + +(setq completion-ignore-case t) + ;; Enable vertico (use-package vertico :ensure t @@ -7,50 +16,18 @@ (vertico-mode) :config - (add-hook 'rfn-eshadow-update-overlay-hook #'vertico-directory-tidy) - - ;; Different scroll margin - ;; (setq vertico-scroll-margin 0) - - ;; Show more candidates - ;; (setq vertico-count 20) - - ;; Grow and shrink the Vertico minibuffer - ;; (setq vertico-resize t) - - ;; Optionally enable cycling for `vertico-next' and `vertico-previous'. - ;; (setq vertico-cycle t) - ) + (add-hook 'rfn-eshadow-update-overlay-hook #'vertico-directory-tidy)) ;; Enable rich annotations using the Marginalia package (use-package marginalia :ensure t - ;; Bind `marginalia-cycle' locally in the minibuffer. To make the binding - ;; available in the *Completions* buffer, add it to the - ;; `completion-list-mode-map'. :bind (:map minibuffer-local-map ("M-A" . marginalia-cycle)) - - ;; The :init section is always executed. :init - - ;; Marginalia must be actived in the :init section of use-package such that - ;; the mode gets enabled right away. Note that this forces loading the - ;; package. (marginalia-mode)) -(setq completion-styles '(basic substring initials orderless)) -(setq completion-category-overrides - '( - (file (styles . (basic partial-completion orderless))) - (project-file (styles . (flex basic substring partial-completion orderless))) - )) - -(setq completion-ignore-case t) - (use-package consult :ensure t - ;; Replace bindings. Lazily loaded due by `use-package'. :bind (;; C-c bindings in `mode-specific-map' ("C-c M-x" . consult-mode-command) ("C-c h" . consult-history) @@ -126,7 +103,7 @@ :bind (("C-." . embark-act) ;; pick some comfortable binding - ("C-;" . embark-dwim) ;; good alternative: M-. + ("M-." . embark-dwim) ;; good alternative: M-. ("C-h B" . embark-bindings)) ;; alternative for `describe-bindings' :init @@ -139,9 +116,8 @@ nil (window-parameters (mode-line-format . none))))) -;; Consult users will also want the embark-consult package. (use-package embark-consult - :ensure t ; only need to install it, embark loads it after consult if found + :ensure t :hook (embark-collect-mode . consult-preview-at-point-mode)) diff --git a/.emacs.d/rul-lisp/packages/rul-elfeed.el b/.emacs.d/rul-lisp/packages/rul-elfeed.el deleted file mode 100644 index 22aacdd..0000000 --- a/.emacs.d/rul-lisp/packages/rul-elfeed.el +++ /dev/null @@ -1,6 +0,0 @@ -(use-package elfeed -:ensure t -:config -(require 'rul-config-elfeed)) - -(provide 'rul-elfeed) diff --git a/.emacs.d/rul-lisp/packages/rul-fm.el b/.emacs.d/rul-lisp/packages/rul-fm.el new file mode 100644 index 0000000..83aaf37 --- /dev/null +++ b/.emacs.d/rul-lisp/packages/rul-fm.el @@ -0,0 +1,19 @@ +;;; rul-fm.el --- File management + +;; dired +(add-hook 'dired-mode-hook #'dired-hide-details-mode) +(setq dired-guess-shell-alist-user + '(("\\.\\(png\\|jpe?g\\|tiff\\)" "feh" "xdg-open") + ("\\.\\(mp[34]\\|m4a\\|ogg\\|flac\\|webm\\|mkv\\)" "mpv" "xdg-open") + (".*" "xdg-open"))) + +(setq dired-kill-when-opening-new-dired-buffer t) +(put 'dired-find-alternate-file 'disabled nil) + +;;; Icons +(use-package nerd-icons :ensure t ) +(use-package nerd-icons-dired :ensure t + :config + (add-hook 'dired-mode-hook #'nerd-icons-dired-mode)) + +(provide 'rul-fm) diff --git a/.emacs.d/rul-lisp/packages/rul-fonts.el b/.emacs.d/rul-lisp/packages/rul-fonts.el new file mode 100644 index 0000000..8395292 --- /dev/null +++ b/.emacs.d/rul-lisp/packages/rul-fonts.el @@ -0,0 +1,34 @@ +;;; rul-fonts.el --- Fonts configuration + +(use-package fontaine + :ensure t + :config + (setq fontaine-presets + '((tiny + :default-height 100) + (small + :default-height 120) + (medium + :default-height 140) + (large + :default-weight semilight + :default-height 180 + :bold-weight extrabold) + (presentation + :default-weight semilight + :default-height 200 + :bold-weight extrabold) + (jumbo + :default-weight semilight + :default-height 230 + :bold-weight extrabold) + (t + :default-family "Iosevka" + :default-weight regular + :default-height 140 + :variable-pitch-family "Iosevka Aile"))) + + ;; Set desired style from `fontaine-presets' + (fontaine-set-preset 'medium)) + +(provide 'rul-fonts) diff --git a/.emacs.d/rul-lisp/packages/rul-media.el b/.emacs.d/rul-lisp/packages/rul-io.el index b2f8db1..eb2c1c7 100644 --- a/.emacs.d/rul-lisp/packages/rul-media.el +++ b/.emacs.d/rul-lisp/packages/rul-io.el @@ -1,3 +1,8 @@ +;;; rul-io.el --- Configuration for Internet and media packages + +(use-package elfeed :ensure t) +(provide 'rul-feeds) + (use-package empv :ensure t :config @@ -9,7 +14,6 @@ ("SomaFM - Metal" . "https://somafm.com/metal.pls") ("SomaFM - Lush" . "https://somafm.com/lush130.pls") ("KCSM Jazz 91" . "http://ice5.securenetsystems.net/KCSM") - )) - ) + ))) -(provide 'rul-media) +(provide 'rul-io) diff --git a/.emacs.d/rul-lisp/packages/rul-mail.el b/.emacs.d/rul-lisp/packages/rul-mail.el new file mode 100644 index 0000000..dbf9c9b --- /dev/null +++ b/.emacs.d/rul-lisp/packages/rul-mail.el @@ -0,0 +1,140 @@ +;;; rul-mail.el --- Email configuration + +;; mml-sec.el +;; Use sender to find GPG key. +(setq mml-secure-openpgp-sign-with-sender t) + +(use-package notmuch + :ensure t + :config + ;; UI + (setq notmuch-show-logo nil + notmuch-column-control 1.0 + notmuch-hello-auto-refresh t + notmuch-hello-recent-searches-max 20 + notmuch-hello-thousands-separator "" + notmuch-show-all-tags-list t) + + ;; Keymaps + (defun rul/capture-mail() + "Capture mail to org mode." + (interactive) + (org-store-link nil) + (org-capture nil "m") + ) + + (bind-key "c" 'rul/capture-mail notmuch-show-mode-map) + + (define-key notmuch-show-mode-map "R" 'notmuch-show-reply) + (define-key notmuch-search-mode-map "R" 'notmuch-search-reply-to-thread) + + ;; Spam + (define-key notmuch-show-mode-map "S" + (lambda () + "mark message as spam" + (interactive) + (notmuch-show-tag (list "+spam" "-inbox" "-unread")))) + + (define-key notmuch-search-mode-map "S" + (lambda (&optional beg end) + "mark thread as spam" + (interactive (notmuch-search-interactive-region)) + (notmuch-search-tag (list "+spam" "-inbox" "-unread") beg end))) + + ;; Archive + (setq notmuch-archive-tags (list "-inbox" "+archive")) + (define-key notmuch-show-mode-map "A" + (lambda () + "archive" + (interactive) + (notmuch-show-tag (list "+archive" "-inbox" "-unread")) + (notmuch-refresh-this-buffer))) + + (define-key notmuch-search-mode-map "A" + (lambda (&optional beg end) + "archive thread" + (interactive (notmuch-search-interactive-region)) + (notmuch-search-tag (list "+archive" "-inbox" "-unread") beg end) + (notmuch-refresh-this-buffer))) + + ;; Mark as read + (define-key notmuch-search-mode-map "r" + (lambda (&optional beg end) + "mark thread as read" + (interactive (notmuch-search-interactive-region)) + (notmuch-search-tag (list "-unread") beg end) + (notmuch-search-next-thread))) + + (define-key notmuch-search-mode-map (kbd "RET") + (lambda () + "Show the selected thread with notmuch-tree if it has more +than one email. Use notmuch-show otherwise." + (interactive) + (if (= (plist-get (notmuch-search-get-result) :total) 1) + (notmuch-search-show-thread) + (notmuch-tree (notmuch-search-find-thread-id) + notmuch-search-query-string + nil + (notmuch-prettify-subject (notmuch-search-find-subject)))))) + + (defun color-inbox-if-unread () (interactive) + (save-excursion + (goto-char (point-min)) + (let ((cnt (car (process-lines "notmuch" "count" "tag:inbox and tag:unread")))) + (when (> (string-to-number cnt) 0) + (save-excursion + (when (search-forward "inbox" (point-max) t) + (let* ((overlays (overlays-in (match-beginning 0) (match-end 0))) + (overlay (car overlays))) + (when overlay + (overlay-put overlay 'face '((:inherit bold) (:foreground "green"))))))))))) + + (defvar notmuch-hello-refresh-count 0) + (defun notmuch-hello-refresh-status-message () + (let* ((new-count + (string-to-number + (car (process-lines notmuch-command "count")))) + (diff-count (- new-count notmuch-hello-refresh-count))) + (cond + ((= notmuch-hello-refresh-count 0) + (message "You have %s messages." + (notmuch-hello-nice-number new-count))) + ((> diff-count 0) + (message "You have %s more messages since last refresh." + (notmuch-hello-nice-number diff-count))) + ((< diff-count 0) + (message "You have %s fewer messages since last refresh." + (notmuch-hello-nice-number (- diff-count))))) + (setq notmuch-hello-refresh-count new-count))) + + (add-hook 'notmuch-hello-refresh-hook 'color-inbox-if-unread) + (add-hook 'notmuch-hello-refresh-hook 'notmuch-hello-refresh-status-message) + + (setq notmuch-hello-sections '(notmuch-hello-insert-saved-searches + notmuch-hello-insert-search + notmuch-hello-insert-recent-searches + notmuch-hello-insert-alltags + )) + + ;; https://git.sr.ht/~tslil/dotfiles/tree/4e51afbb/emacs/notmuch-config.el#L76-82 + (defmacro make-binds (mode-map binds argfunc &rest body) + "Create keybindings in `mode-map' using a list of (keystr . arg) +pairs in `binds' of the form ( ... (argfunc arg) body)." + `(progn ,@(mapcar (lambda (pair) + `(define-key ,mode-map (kbd ,(car pair)) + (lambda () (interactive) (,argfunc ,(cdr pair)) ,@body))) + (eval binds)))) + + (defvar notmuch-hello-tree-searches '(("u" . "tag:unread") + ("i" . "tag:inbox") + ("*" . "*")) + "List of (key . query) pairs to bind in notmuch-hello.") + + (make-binds notmuch-hello-mode-map + notmuch-hello-tree-searches + notmuch-search) +) ;; ends use-package notmuch + +(use-package notmuch-indicator :ensure t) + +(provide 'rul-mail) diff --git a/.emacs.d/rul-lisp/packages/rul-modeline.el b/.emacs.d/rul-lisp/packages/rul-modeline.el index ae250c4..e20bb2c 100644 --- a/.emacs.d/rul-lisp/packages/rul-modeline.el +++ b/.emacs.d/rul-lisp/packages/rul-modeline.el @@ -1,3 +1,5 @@ +;;; rul-modeline.el --- Modeline configuration + ;; Most of the code in this file is based on: ;; https://git.sr.ht/~protesilaos/dotfiles/tree/cf26bc34/item/emacs/.emacs.d/prot-lisp/prot-modeline.el ;; diff --git a/.emacs.d/rul-lisp/packages/rul-org-agenda.el b/.emacs.d/rul-lisp/packages/rul-org-agenda.el index bfdc8d3..d280d95 100644 --- a/.emacs.d/rul-lisp/packages/rul-org-agenda.el +++ b/.emacs.d/rul-lisp/packages/rul-org-agenda.el @@ -1,3 +1,4 @@ +;;; rul-org-agenda.el --- Org agenda configuration (require 'org) (global-set-key (kbd "<f12>") #'org-agenda) diff --git a/.emacs.d/rul-lisp/packages/rul-org-journal.el b/.emacs.d/rul-lisp/packages/rul-org-journal.el deleted file mode 100644 index 46fcebf..0000000 --- a/.emacs.d/rul-lisp/packages/rul-org-journal.el +++ /dev/null @@ -1,19 +0,0 @@ -(use-package org-journal - :ensure t - :init - ;; Change default prefix key; needs to be set before loading org-journal - (setq org-journal-prefix-key "C-c j ") - :config - (require 'rul-config-org) - (setq org-journal-date-format "%A, %d %B %Y") - - (global-set-key (kbd "C-c j o") 'org-journal-open-current-journal-file) - (global-set-key (kbd "C-c j j") 'org-journal-new-entry) - (global-set-key (kbd "C-c j J") 'org-journal-new-scheduled-entry) - - (define-key org-journal-mode-map (kbd "C-c j n") 'org-journal-next-entry) - (define-key org-journal-mode-map (kbd "C-c j p") 'org-journal-previous-entry) - (define-key org-journal-mode-map (kbd "C-c j r") 'org-journal-reschedule-scheduled-entry) - ) - -(provide 'rul-org-journal) diff --git a/.emacs.d/rul-lisp/packages/rul-org-notify.el b/.emacs.d/rul-lisp/packages/rul-org-notify.el deleted file mode 100644 index 50c35a0..0000000 --- a/.emacs.d/rul-lisp/packages/rul-org-notify.el +++ /dev/null @@ -1,9 +0,0 @@ -(use-package org-notify - :ensure t - :config - (org-notify-start) - (org-notify-add 'default - '(:time "-1s" :period "20s" :duration 10 - :actions (-message -ding)) - '(:time "1d" :actions -notify/window - :duration 60))) diff --git a/.emacs.d/rul-lisp/packages/rul-org.el b/.emacs.d/rul-lisp/packages/rul-org.el index d076948..b5eae02 100644 --- a/.emacs.d/rul-lisp/packages/rul-org.el +++ b/.emacs.d/rul-lisp/packages/rul-org.el @@ -1,24 +1,22 @@ -;; Debian packages: elpa-org -;; Elpa packages: org-modern +;;; rul-org.el --- Org configuration (require 'org) (require 'org-capture) (require 'org-protocol) (require 'org-habit) -(require 'rul-config-org) - (require 'rul-org-agenda) -(require 'rul-org-journal) +(setq org-attach-use-inheritance t) (setq org-cycle-separator-lines 0) -(setq org-startup-indented t) (setq org-hide-leading-stars nil) +(setq org-startup-indented t) +(setq org-edit-src-content-indentation 0) (use-package org-modern :ensure t) (use-package org-pomodoro :ensure t) -(add-hook 'org-mode-hook 'turn-off-auto-fill) -(add-hook 'auto-save-hook 'org-save-all-org-buffers) +;; (add-hook 'org-mode-hook 'turn-off-auto-fill) +;; (add-hook 'auto-save-hook 'org-save-all-org-buffers) (add-hook 'org-mode-hook 'visual-line-mode) (use-package org-download @@ -61,14 +59,13 @@ (setq org-log-reschedule (quote time)) ;; CAPTURE ;; -(setq org-default-notes-file org-refile-path) (setq org-capture-templates (quote ( ("w" "Todo" entry (file+headline org-refile-path "Tasks") - "* TODO " + "* TODO %?" :empty-lines 1) ("m" @@ -84,39 +81,15 @@ ("L" "Web Link" entry (file+headline org-refile-path "Read later") - "* %?[[%:link][%:description]] %(progn (setq rul/delete-frame-after-capture 1) \"\")\n %:initial\n \nCaptured On: %U" + "* %?[[%:link][%:description]] \"\")\n %:initial\n \nCaptured On: %U" ) ("l" "Web Link with Selection" entry (file+headline org-refile-path "Read later") - "* [[%:link][%:description]] %(progn (setq rul/delete-frame-after-capture 1) \"\")\n %:initial\n \nCaptured On: %U") + "* [[%:link][%:description]] \n %:initial\n \nCaptured On: %U") ))) -(defvar rul/delete-frame-after-capture 0 "Whether to delete the last frame after the current capture") - -(defun rul/delete-frame-if-necessary () - "Delete the last frame if necessary." - (cond - ((= rul/delete-frame-after-capture 0) nil) - ((> rul/delete-frame-after-capture 1) - (setq rul/delete-frame-after-capture (- rul/delete-frame-after-capture 1))) - (t - (setq rul/delete-frame-after-capture 0) - (delete-frame)))) - -(defun rul/org-capture-before () - "Function to run before org capture." - (setq rul/delete-frame-after-capture (1+ rul/delete-frame-after-capture))) - -(defun rul/org-capture-after () - "Function to run after org capture." - (rul/delete-frame-if-necessary)) - -(advice-add 'org-capture-finalize :after 'rul/delete-frame-if-necessary) -(advice-add 'org-capture-kill :after 'rul/delete-frame-if-necessary) -(advice-add 'org-capture-refile :after 'rul/delete-frame-if-necessary) - ;; REFILE ;; ; Targets include this file and any file contributing to the agenda - up to 3 levels deep diff --git a/.emacs.d/rul-lisp/packages/rul-prog.el b/.emacs.d/rul-lisp/packages/rul-prog.el index eb9c676..581dbc1 100644 --- a/.emacs.d/rul-lisp/packages/rul-prog.el +++ b/.emacs.d/rul-lisp/packages/rul-prog.el @@ -1,14 +1,44 @@ +;;; rul-prog.el --- Configuration related to programming and markup +;;; languages (use-package eglot :ensure t) -;; Dart -(setq dart-server-format-on-save t) -(add-hook 'dart-mode-hook 'lsp) +;; Go +(use-package go-mode + :ensure t + :init + (progn + (bind-key [remap find-tag] #'godef-jump)) + :config + (add-hook 'go-mode-hook #'yas-minor-mode) + (add-hook 'go-mode-hook 'electric-pair-mode) + (add-hook 'go-mode-hook 'my-go-mode-hook) + (add-hook 'before-save-hook 'gofmt-before-save)) -(setq gc-cons-threshold (* 100 1024 1024) - read-process-output-max (* 1024 1024)) +(use-package go-eldoc + :ensure t + :init + (add-hook 'go-mode-hook 'go-eldoc-setup)) + +;; Latex +(add-hook 'latex-mode-hook 'flyspell-mode) +(setq TeX-PDF-mode t) + +(defun pdfevince () + (add-to-list 'TeX-output-view-style + '("^pdf$" "." "evince %o %(outpage)"))) + +(add-hook 'LaTeX-mode-hook 'pdfevince t) ; AUCTeX LaTeX mode + +;; Markdown +(use-package markdown-mode + :ensure t + :config + (setq auto-mode-alist + (cons '("\\.mdwn" . markdown-mode) auto-mode-alist))) ;; Python -(use-package blacken :ensure t) +(use-package blacken :ensure t :defer t) +(add-hook 'python-mode-hook 'py-autopep8-enable-on-save) ;; Terraform (use-package terraform-mode :ensure t :defer t) @@ -16,4 +46,12 @@ ;; YAML (use-package yaml-mode :ensure t :defer t) +;; Rust +(use-package rust-mode + :defer t + :init + (setq rust-mode-treesitter-derive t) + :config + (add-hook 'rust-mode-hook 'eglot-ensure)) + (provide 'rul-prog) diff --git a/.emacs.d/rul-lisp/packages/rul-terminals.el b/.emacs.d/rul-lisp/packages/rul-terminals.el new file mode 100644 index 0000000..9678b55 --- /dev/null +++ b/.emacs.d/rul-lisp/packages/rul-terminals.el @@ -0,0 +1,9 @@ +(use-package multi-vterm + :ensure t + :init + (setq vterm-always-compile-module t) + :config + (setq vterm-max-scrollback 100000) + (add-hook 'vterm-mode-hook 'goto-address-mode)) + +(provide 'rul-terminals) diff --git a/.emacs.d/rul-lisp/packages/rul-themes.el b/.emacs.d/rul-lisp/packages/rul-themes.el new file mode 100644 index 0000000..2c696ec --- /dev/null +++ b/.emacs.d/rul-lisp/packages/rul-themes.el @@ -0,0 +1,51 @@ +(use-package ef-themes :ensure t) +(use-package modus-themes + :ensure t + :config + (setq + modus-themes-mode-line '(accented borderless padded) + modus-themes-region '(bg-only) + modus-themes-bold-constructs t + modus-themes-italic-constructs t + modus-themes-paren-match '(bold intense) + modus-themes-headings (quote ((1 . (rainbow variable-pitch 1.3)) + (2 . (rainbow 1.1)) + (t . (rainbow)))) + modus-themes-org-blocks 'tinted)) + +(use-package dbus) +(defun mf/set-theme-from-dbus-value (value) + "Set the appropiate theme according to the color-scheme setting value." + (message "value is %s" value) + (if (equal value '1) + (progn (message "Switch to dark theme") + (modus-themes-select 'modus-vivendi)) + (progn (message "Switch to light theme") + (modus-themes-select 'modus-operandi)))) + +(defun mf/color-scheme-changed (path var value) + "DBus handler to detect when the color-scheme has changed." + (when (and (string-equal path "org.freedesktop.appearance") + (string-equal var "color-scheme")) + (mf/set-theme-from-dbus-value (car value)) + )) + +;; Register for future changes +(dbus-register-signal + :session "org.freedesktop.portal.Desktop" + "/org/freedesktop/portal/desktop" "org.freedesktop.portal.Settings" + "SettingChanged" + #'mf/color-scheme-changed) + +;; Request the current color-scheme +(dbus-call-method-asynchronously + :session "org.freedesktop.portal.Desktop" + "/org/freedesktop/portal/desktop" "org.freedesktop.portal.Settings" + "Read" + (lambda (value) (mf/set-theme-from-dbus-value (caar value))) + "org.freedesktop.appearance" + "color-scheme" + ) + + +(provide 'rul-themes) diff --git a/.emacs.d/rul-lisp/packages/rul-vc.el b/.emacs.d/rul-lisp/packages/rul-vc.el new file mode 100644 index 0000000..a2ab563 --- /dev/null +++ b/.emacs.d/rul-lisp/packages/rul-vc.el @@ -0,0 +1,19 @@ +(use-package magit + :ensure t + :bind + (("C-c g s" . magit-status) + ("C-c g F" . magit-pull-from-upstream) + ("C-c g b" . magit-blame)) + :config + (progn + (defun inkel/magit-log-edit-mode-hook () + (flyspell-mode t) + (turn-on-auto-fill)) + (defadvice magit-status (around magit-fullscreen activate) + (window-configuration-to-register :magit-fullscreen) + ad-do-it + (delete-other-windows)))) + +(add-to-list 'project-switch-commands '(magit-project-status "Magit" "m")) + +(provide 'rul-vc) diff --git a/.emacs.d/rul-lisp/packages/rul-wm.el b/.emacs.d/rul-lisp/packages/rul-wm.el index cea3a76..99480c3 100644 --- a/.emacs.d/rul-lisp/packages/rul-wm.el +++ b/.emacs.d/rul-lisp/packages/rul-wm.el @@ -21,14 +21,112 @@ (setq tab-bar-new-tab-to 'rightmost) (setq tab-bar-close-button-show nil) (set-face-attribute 'tab-bar nil :height 0.8) -(tab-bar-mode 1) + +;; I've moved to a frame oriented workflow, so I no longer use tabs. +;; (tab-bar-mode 1) + +;; Pop-up buffers +;; https://protesilaos.com/codelog/2024-09-19-emacs-command-popup-frame-emacsclient/ +(defun prot-window-delete-popup-frame (&rest _) + "Kill selected selected frame if it has parameter `prot-window-popup-frame'. +Use this function via a hook." + (when (frame-parameter nil 'prot-window-popup-frame) + (delete-frame))) + +(defmacro prot-window-define-with-popup-frame (command) + "Define interactive function which calls COMMAND in a new frame. +Make the new frame have the `prot-window-popup-frame' parameter." + `(defun ,(intern (format "prot-window-popup-%s" command)) () + ,(format "Run `%s' in a popup frame with `prot-window-popup-frame' parameter. +Also see `prot-window-delete-popup-frame'." command) + (interactive) + (let ((frame (make-frame '((prot-window-popup-frame . t))))) + (select-frame frame) + ;; Placeholder for frame, otherwise it'll get autoclosed. + (switch-to-buffer " prot-window-hidden-buffer-for-popup-frame") + (condition-case nil + (call-interactively ',command) + ((quit error user-error) + (delete-frame frame)))))) + +(declare-function org-capture "org-capture" (&optional goto keys)) +(defvar org-capture-after-finalize-hook) + +;;;###autoload (autoload 'prot-window-popup-org-capture "prot-window") +(prot-window-define-with-popup-frame org-capture) + +(add-hook 'org-capture-after-finalize-hook #'prot-window-delete-popup-frame) (use-package olivetti :ensure t :defer t :config - (setq - olivetti-body-width 100 - )) + (setq olivetti-body-width 100)) + +(use-package logos +:ensure t +:config + +;; If you want to use outlines instead of page breaks (the ^L) +(setq logos-outlines-are-pages t) +(setq logos-outline-regexp-alist + `((emacs-lisp-mode . "^;;;+ ") + (org-mode . "^\\*+ +") + (markdown-mode . "^\\#+ +") + )) + +;; These apply when `logos-focus-mode' is enabled. Their value is +;; buffer-local. +(setq-default logos-hide-mode-line t + logos-hide-buffer-boundaries t + logos-hide-fringe t + logos-variable-pitch nil + logos-buffer-read-only nil + logos-scroll-lock nil + logos-olivetti t + olivetti-body-width 100 + ) + + +(let ((map global-map)) + (define-key map [remap narrow-to-region] #'logos-narrow-dwim) + (define-key map [remap forward-page] #'logos-forward-page-dwim) + (define-key map [remap backward-page] #'logos-backward-page-dwim) + (define-key map (kbd "<f9>") #'logos-focus-mode)) +) + +(use-package beframe + :ensure t + :hook (after-init . beframe-mode) + :config + (setq beframe-functions-in-frames '(project-prompt-project-dir)) + (setq beframe-global-buffers nil) + (define-key global-map (kbd "C-c b") beframe-prefix-map) + + ;;Integration with Consult + (defvar consult-buffer-sources) + (declare-function consult--buffer-state "consult") + + (with-eval-after-load 'consult + (defface beframe-buffer + '((t :inherit font-lock-string-face)) + "Face for `consult' framed buffers.") + + (defun my-beframe-buffer-names-sorted (&optional frame) + "Return the list of buffers from `beframe-buffer-names' sorted by visibility. +With optional argument FRAME, return the list of buffers of FRAME." + (beframe-buffer-names frame :sort #'beframe-buffer-sort-visibility)) + + (defvar beframe-consult-source + `( :name "Frame-specific buffers (current frame)" + :narrow ?F + :category buffer + :face beframe-buffer + :history beframe-history + :items ,#'my-beframe-buffer-names-sorted + :action ,#'switch-to-buffer + :state ,#'consult--buffer-state)) + + (add-to-list 'consult-buffer-sources 'beframe-consult-source))) (provide 'rul-wm) diff --git a/.emacs.d/rul-lisp/packages/rul-write.el b/.emacs.d/rul-lisp/packages/rul-write.el index 16eae84..719baaf 100644 --- a/.emacs.d/rul-lisp/packages/rul-write.el +++ b/.emacs.d/rul-lisp/packages/rul-write.el @@ -7,7 +7,14 @@ (use-package denote :ensure t + :hook (dired-mode . denote-dired-mode) + :bind + (("C-c n n" . denote) + ("C-c n r" . denote-rename-file) + ("C-c n l" . denote-link) + ("C-c n b" . denote-backlinks)) :config + (denote-rename-buffer-mode 1) (setq denote-infer-keywords t) (setq denote-sort-keywords t) (setq denote-file-type 'org) @@ -16,16 +23,14 @@ (setq denote-link-fontify-backlinks t) (setq denote-rename-no-confirm t) - (add-hook 'find-file-hook #'denote-link-buttonize-buffer) - (add-hook 'dired-mode-hook #'denote-dired-mode-in-directories) - (let ((map global-map)) (define-key map (kbd "C-c n j") #'rul/denote-journal) (define-key map (kbd "C-c n n") #'denote) (define-key map (kbd "C-c n f") #'denote-open-or-create) (define-key map (kbd "C-c n i") #'denote-link) (define-key map (kbd "C-c n r") #'denote-rename-file) - )) + ) +) (defun rul/denote-journal () "Create an entry tagged 'journal' with the date as its title. @@ -46,4 +51,45 @@ Else create a new file." today '("journal")))))) +;; auto-fill mode +(add-hook 'text-mode-hook 'turn-on-auto-fill) + +;; Flycheck +(use-package flycheck + :ensure t + :config + +(flycheck-define-checker proselint + "A linter for prose." + :command ("proselint" source-inplace) + :error-patterns + ((warning line-start (file-name) ":" line ":" column ": " + (id (one-or-more (not (any " ")))) + (message) line-end)) + :modes (text-mode markdown-mode gfm-mode org-mode)) + +(add-to-list 'flycheck-checkers 'proselint) + +;; TODO: docker run --rm -p 8010:8010 erikvl87/languagetool +(use-package flycheck-languagetool + :ensure t + :hook (message-mode . flycheck-languagetool-setup) + :init + (setq flycheck-languagetool-url "http://localhost:8010") +)) + +;; Flyspell +(defcustom flyspell-delayed-commands nil + "List of commands that are \"delayed\" for Flyspell mode. +After these commands, Flyspell checking is delayed for a short time, +whose length is specified by `flyspell-delay'." + :group 'flyspell + :type '(repeat (symbol))) + +(setq ispell-dictionary "en") +(setq flyspell-default-dictionary "en") + +(setq flyspell-issue-welcome-flag nil) +(setq-default ispell-list-command "list") + (provide 'rul-write) |