summaryrefslogtreecommitdiff
path: root/home/dots/.emacs
diff options
context:
space:
mode:
authorMarc Coquand <marc@mccd.space>2024-11-26 11:05:50 +0200
committerMarc Coquand <marc@mccd.space>2024-11-26 11:05:50 +0200
commitd555a9c6bb8f224ac32f3d26c482fa78d3891511 (patch)
tree4561ba36c2bec9542b58cc0d0b6236a1edeaa61f /home/dots/.emacs
parentf2267f63134432923e9e7a7ad900532bec6a5bd6 (diff)
downloadguix-d555a9c6bb8f224ac32f3d26c482fa78d3891511.tar.gz
guix-d555a9c6bb8f224ac32f3d26c482fa78d3891511.tar.bz2
guix-d555a9c6bb8f224ac32f3d26c482fa78d3891511.zip
Diffstat (limited to '')
-rw-r--r--home/dots/.emacs236
1 files changed, 139 insertions, 97 deletions
diff --git a/home/dots/.emacs b/home/dots/.emacs
index 0d04e89..4be104a 100644
--- a/home/dots/.emacs
+++ b/home/dots/.emacs
@@ -298,6 +298,15 @@
(use-package window
:custom
(switch-to-buffer-obey-display-actions t)
+ :bind
+ (("C-x C-}" . enlarge-window-horizontally)
+ ("C-x C-o" . other-window)
+ :repeat-map
+ move-up-repeat-map
+ (("v" . scroll-down-command))
+ :repeat-map
+ move-down-repeat-map
+ (("v" . scroll-up-command)))
:config
(add-to-list 'display-buffer-alist '("*Async Shell Command*" display-buffer-no-window (nil))))
@@ -403,69 +412,59 @@
(:map scheme-mode-map
("C-." . nil)))
-(defun mccd/store-remarks ()
- (concat "~/personal-db/notes/"
- (file-name-base (org-remark-notes-file-name-function))
- "-remark.org"))
-
-(use-package battery
- :init
- (display-battery-mode t))
-
-(use-package comint
- :bind
- ((:repeat-map
- repeat-hist-line-map
- ("n" . comint-next-input)
- ("p" . comint-previous-input))))
-
(use-package repeat
:demand t
:bind
(("C-z" . repeat)
- :repeat-map
- repeat-basic-movement-map
+ :repeat-map move-repeat-map
("n" . next-line)
- ("p" . previous-line)
- ("f" . forward-char)
- ("M-f" . forward-word)
- ("M-b" . backward-word)
- ("o" . avy-goto-char-timer)
- ("b" . backward-char)
("e" . move-end-of-line)
- ("v" . scroll-up-command)
- ("M-v" . scroll-down-command)
- ("M-e" . forward-sentence)
("a" . move-beginning-of-line)
- :repeat-map
- repeat-repeat-map
- ("z" . repeat)
- :repeat-map
- repeat-undo-map
- ("/" . undo)
- ("?" . undo-redo)
- :repeat-map
- repeat-kill-map
- ("d" . delete-char)
- ("M-d" . kill-word)
- ("k" . kill-line)
- :repeat-map
- repeat-movement-map
+ ("b" . backward-char)
+ ("f" . forward-char)
+ ("p" . previous-line)
+ ("o" . avy-goto-char-timer)
+ :repeat-map sexp-move-repeat-map
+ ("n" . forward-list)
+ ("p" . backward-list)
("e" . end-of-defun)
+ ("a" . beginning-of-defun)
("f" . forward-sexp)
- ("n" . forward-list)
- ("p" . backward-list)
- ("d" . down-list)
- ("u" . up-list)
("b" . backward-sexp)
- ("a" . beginning-of-defun))
+ :repeat-map forward-words-repeat-map
+ ("f" . forward-word)
+ ("e" . forward-sentence)
+ ("a" . backward-sentence)
+ ("b" . backward-word)
+ :repeat-map undo-redo-repeat-map
+ ("/" . undo)
+ ("?" . redo)
+ :repeat-map kill-lines-repeat-map
+ ("k" . kill-line)
+ :repeat-map kill-lines-org-repeat-map
+ ("k" . org-kill-line)
+ :repeat-map delete-repeat-map
+ ("d" . delete-char)
+ :repeat-map kill-word-repeat-map
+ ("d" . kill-word))
:custom
(repeat-on-final-keystroke t)
(set-mark-command-repeat-pop t)
- (repeat-exit-key (kbd "<TAB>"))
+ (repeat-exit-key (kbd "i"))
:config
(repeat-mode 1))
+(use-package battery
+ :init
+ (display-battery-mode t))
+
+(use-package comint
+ :bind
+ ((:repeat-map
+ repeat-hist-line-map
+ ("n" . comint-next-input)
+ ("p" . comint-previous-input))))
+
(use-package eww
:custom
(eww-auto-rename-buffer t)
@@ -507,18 +506,6 @@
("p" . git-gutter:previous-hunk))
:ensure t)
-;; (use-package gnus
-;; :custom
-;; (gnus-select-method
-;; '(nnimap "imap.fastmail.com"
-;; (nnimap-expunge t)))
-;; (mail-sources '((file)))
-;; (gnus-secondary-select-methods '((nnml "")))
-;; (gnus-asynchronous t)
-;; (gnus-use-article-prefetch t)
-;; (gnus-agent t))
-
-
(use-package git-gutter-fringe
:ensure t)
@@ -576,8 +563,9 @@
:ensure t
:custom
(avy-timeout-seconds 0.2)
+ :bind
+ ("M-o" . avy-goto-char-timer)
:config
- (global-set-key (kbd "M-o") 'avy-goto-char-timer)
(set-face-attribute 'avy-lead-face nil :inherit 'fixed-pitch)
(set-face-attribute 'avy-lead-face-0 nil :inherit 'fixed-pitch)
(set-face-attribute 'avy-lead-face-1 nil :inherit 'fixed-pitch)
@@ -609,7 +597,6 @@
(save-excursion (yank))
t)
-
(setf (alist-get ?y avy-dispatch-alist) 'avy-action-yank
(alist-get ?w avy-dispatch-alist) 'avy-action-copy
(alist-get ?W avy-dispatch-alist) 'avy-action-copy-whole-line
@@ -663,7 +650,8 @@
(use-package expand-region
:ensure t
:bind
- ("C-." . er/expand-region))
+ ("C-." . er/expand-region)
+ ("C--" . er/contract-region))
(use-package devdocs
:ensure t
@@ -759,6 +747,45 @@
(global-set-key (kbd "M-<") 'insert-pair)
(global-set-key (kbd "M-[") 'insert-pair))
+(use-package dbus
+ :config
+ (defun ctrl-lock-on ()
+ (set-cursor-color "red")
+ (setq ctrl-lock-state t)
+ (force-mode-line-update t))
+ (defun ctrl-lock-off ()
+ (set-cursor-color "black")
+ (setq ctrl-lock-state nil)
+ (force-mode-line-update t))
+ :bind
+ (("C-x C-2" . split-window-below)
+ ("C-x C-0" . delete-window)
+ ("C-<return>" . newline)
+ ("C-M-d" . kill-word)
+ ("C-x C-3" . split-window-right))
+ :init
+ (setq ctrl-lock-state nil)
+ (push '(ctrl-lock-state " [CTRL] " "") global-mode-string)
+ (dbus-register-method
+ :session
+ "org.emacs.ctrl"
+ "/on"
+ dbus-interface-introspectable
+ "Introspect"
+ #'ctrl-lock-on)
+ (dbus-register-method
+ :session
+ "org.emacs.ctrl"
+ "/off"
+ dbus-interface-introspectable
+ "Introspect"
+ #'ctrl-lock-off))
+
+
+
+
+
+
(use-package ido
:init
(ido-mode t))
@@ -887,7 +914,7 @@
(org-hierarchical-todo-statistics t)
(org-refile-allow-creating-parent-nodes 'confirm)
(org-outline-path-complete-in-steps nil)
- (org-refile-use-outline-path 'file)
+ (org-refile-use-outline-path 'level1)
(org-log-done 'time)
(org-indent-line 2)
(org-tags-column 0)
@@ -929,21 +956,27 @@
(org-mode . variable-pitch-mode)))
-(defun me/org-id-insert-link ()
- "Insert at point a link to any heading from `org-agenda-files'."
- (interactive)
- (let ((buffer-pos
- (org-id-find
- (org-id-get-with-outline-path-completion '((nil :maxlevel . 5)
- (org-agenda-files :maxlevel . 5))))))
- (save-excursion
- (with-current-buffer (get-file-buffer (car buffer-pos))
- (goto-char (cdr buffer-pos))
- (call-interactively 'org-store-link)))
- (org-insert-all-links 1 "" " ")))
+
(use-package org-id
:after org
+ :init
+ (defun me/org-id-insert-link ()
+ "Insert at point a link to any heading from `org-agenda-files'."
+ (interactive)
+ (let ((buffer-pos
+ (org-id-find
+ (org-id-get-with-outline-path-completion '((nil :maxlevel . 5)
+ (org-agenda-files :maxlevel . 5))))))
+ (save-excursion
+ (with-current-buffer (get-file-buffer (car buffer-pos))
+ (org-with-wide-buffer
+ (goto-char (cdr buffer-pos))
+ (call-interactively 'org-store-link))))
+ (org-insert-all-links 1 "" " ")))
+ :bind
+ (:map org-mode-map
+ (("C-c i" . me/org-id-insert-link)))
:custom
(org-id-link-to-org-use-id 'create-if-interactive-and-no-custom-id))
@@ -981,7 +1014,7 @@
:empty-lines 1)
("g" "Log Coffee"
entry (file+headline "~/personal-db/notes/notes.org" "Log")
- "* Brewed pour-over :coffee:cyprus:paramytha:\n:PROPERTIES:\n:WATER: 320g\n:COFFEE: 25g\n:TYPE: [[id:815450d3-d772-4207-9eb4-e1e185fd8356][La Pastora]] | [[id:9d136656-2965-4be9-87cf-4ecafcf62707][Alemayehu]] | [[id:73a92627-f076-4090-a78c-ef8204191611][Los Chorros]]\n:TEMP: 90\n:RATING:\n:PREHEAT: YES\n:TOTALBREWTIME:\n:END:\n%T\n*** Observations "
+ "* Brewed pour-over :coffee:cyprus:paramytha:\n:PROPERTIES:\n:WATER: 320g\n:COFFEE: 25g\n:TYPE: [[id:815450d3-d772-4207-9eb4-e1e185fd8356][La Pastora]] | [[id:9d136656-2965-4be9-87cf-4ecafcf62707][Alemayehu]] | [[id:73a92627-f076-4090-a78c-ef8204191611][Los Chorros]]\n:TEMP: 90\n:RATING:\n:PREHEAT: YES\n:TOTALBREWTIME:\n:CLICKS:\n:END:\n%T\n*** Observations "
:empty-lines 0
:prepend t)
("r" "Reference"
@@ -1104,19 +1137,7 @@
(use-package simple
:diminish visual-line-mode)
-(defun marc/set-msmtp-account ()
- (if (message-mail-p)
- (save-excursion
- (let*
- ((from (save-restriction
- (message-narrow-to-headers)
- (message-fetch-field "from")))
- (account
- (cond
- ((string-match "marcc@fastmail.fr" from) "home")
- ((string-match "marc.coquand@sustainably.app" from) "work")
- ((string-match "marc@mccd.space" from) "home"))))
- (setq message-sendmail-extra-arguments (list '"-a" account))))))
+
(use-package message
:custom
@@ -1133,6 +1154,21 @@
(use-package sendmail
:defer t
+ :init
+ (defun marc/set-msmtp-account ()
+ (if (message-mail-p)
+ (save-excursion
+ (let*
+ ((from (save-restriction
+ (message-narrow-to-headers)
+ (message-fetch-field "from")))
+ (account
+ (cond
+ ((string-match "marcc@fastmail.fr" from) "home")
+ ((string-match "marc.coquand@sustainably.app" from) "work")
+ ((string-match "marc@coquand.email" from) "home")
+ ((string-match "marc@mccd.space" from) "home"))))
+ (setq message-sendmail-extra-arguments (list '"-a" account))))))
:hook
(message-send-mail . marc/set-msmtp-account)
(message-send-mail . flyspell-mode)
@@ -1143,21 +1179,25 @@
(sendmail-program (executable-find "msmtp"))
(mail-user-agent 'message-user-agent))
-
-(defun rmail-reply-t ()
- "Reply only to the sender of the current message. (See rmail-reply.)"
- (interactive)
- (rmail-reply t))
-
-
(use-package rmail
:init
(defvar selected-rmail-account "")
+ (defun rmail-reply-t ()
+ "Reply only to the sender of the current message. (See rmail-reply.)"
+ (interactive)
+ (rmail-reply t))
+
+ (defun rmail-write-for-patch ()
+ "Writes the mail to an mbox file that you can later run git am on to apply it."
+ (interactive)
+ (rmail-output-as-seen "/tmp/new-patch.patch"))
:bind
(("C-c m" . rmail-open)
+ ("C-c M" . rmail-no-check)
:map rmail-mode-map
("r" . rmail-reply-t)
- ("R" . rmail-reply))
+ ("R" . rmail-reply)
+ ("O" . rmail-write-for-patch))
:config
(defun rmail-no-check ()
(interactive)
@@ -1197,6 +1237,8 @@
rmail-default-file "~/personal-db/mail/home/RMAIL"
rmail-remote-password-required nil
rmail-secondary-file-regexp "~/personal-db/mail/home/archives/*.mbox"
+ rmail-output-file-alist '(("\\[PATCH.*\\]" . "patch.mbox")
+ (".*" . "archive.mbox"))
rmail-file-name "~/personal-db/mail/home/RMAIL"
user-mail-address "marc@mccd.space"
unrmail-mbox-format 'mboxo