commit 847da5cad41df92714bf09754eb9f57fb61111b4
parent f237a3f7de2d5bc38594271d1fb8114cee3890cb
Author: dwrz <dwrz@dwrz.net>
Date: Mon, 20 Nov 2023 14:27:48 +0000
Update Emacs init
Diffstat:
M | emacs/init.el | | | 115 | +++++++++++++++++++++++++++++++++++++++++++++---------------------------------- |
1 file changed, 66 insertions(+), 49 deletions(-)
diff --git a/emacs/init.el b/emacs/init.el
@@ -37,17 +37,6 @@
(setq custom-file "~/.cache/custom.el")
;; Functions
-(defun dwrz-adjust-font-size ()
- "Set font size based on display pixel width."
- (interactive)
- (let ((width (display-pixel-width)))
- (cond
- ((<= width 1920) (set-face-attribute 'default t :height 140))
- ((<= width 2160) (set-face-attribute 'default t :height 160))
- ((<= width 3180) (set-face-attribute 'default t :height 180))
- (t (set-face-attribute 'default t :height 160)))))
-;; TODO: (add-hook 'after-make-frame-functions 'dwrz-adjust-font-size)
-
(defun dwrz-copy-filepath ()
"Copy the current buffer file path to the clipboard."
(interactive)
@@ -338,14 +327,14 @@
:bind (("C-x m" . notmuch)
:map notmuch-search-mode-map
("D" . (lambda () "mark message as deleted" (interactive)
- (notmuch-search-tag (list "-new" "-unread" "-inbox" "+deleted"))
- (forward-line)))
+ (notmuch-search-tag (list "-new" "-unread" "-inbox" "+deleted"))
+ (forward-line)))
("S" . (lambda () "mark message as spam" (interactive)
- (notmuch-search-tag (list "-new" "-unread" "-inbox" "+spam"))
- (forward-line)))
+ (notmuch-search-tag (list "-new" "-unread" "-inbox" "+spam"))
+ (forward-line)))
("N" . (lambda () "unmark message as new and unread" (interactive)
- (notmuch-search-tag (list "-new" "-unread"))
- (forward-line)))
+ (notmuch-search-tag (list "-new" "-unread"))
+ (forward-line)))
("r" . notmuch-search-reply-to-thread)
("R" . notmuch-search-reply-to-thread-sender)
:map notmuch-show-mode-map
@@ -381,11 +370,11 @@
(use-package ol
:config (setq 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)))
+ '((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)))
:defer t
:ensure nil)
@@ -432,30 +421,49 @@
(use-package org-agenda
:bind ("C-c a" . org-agenda)
- :config (setq org-agenda-files '("~/org/dwrz.org"
- "~/org/someday-maybe.org"
- "~/projects/career/career.org"
- "~/projects/chimerical/chimerical.org"
- "~/projects/chinese/chinese.org"
- "~/projects/community/community.org"
- "~/projects/finances/finances.org"
- "~/projects/health/health.org"
- "~/projects/home/home.org"
- "~/projects/rz/rz.org"
- "~/projects/src/src.org")
- org-agenda-follow-indirect nil
- org-agenda-include-diary t
- org-agenda-prefix-format '((agenda . " %i %?-12t% s")
- (timeline . " % s")
- (todo . " %i")
- (tags . " %i")
- (search . " %i"))
- org-agenda-span 'month
- org-agenda-tags-column 'auto
- org-agenda-use-time-grid nil
- org-agenda-window-setup 'current-window
- org-archive-location
- "~/org/archive.org::")
+ :config
+ (setq chimerical-agenda-files '("~/projects/chimerical/chimerical.org")
+ dwrz-agenda-files '("~/org/dwrz.org"
+ "~/org/someday-maybe.org"
+ "~/projects/career/career.org"
+ "~/projects/chinese/chinese.org"
+ "~/projects/community/community.org"
+ "~/projects/finances/finances.org"
+ "~/projects/health/health.org"
+ "~/projects/home/home.org"
+ "~/projects/rz/rz.org"
+ "~/projects/src/src.org")
+ work-agenda-files '("~/projects/museum-exchange/museum-exchange.org"))
+
+ (defun dwrz-switch-org-ctx (ctx)
+ "Switch org agenda context."
+ (cond ((string= ctx "all") (setq org-agenda-files (append
+ chimerical-agenda-files
+ dwrz-agenda-files
+ work-agenda-files)))
+ ((string= ctx "chimerical") (setq org-agenda-files
+ chimerical-agenda-files))
+ ((string= ctx "dwrz") (setq org-agenda-files
+ dwrz-agenda-files))
+ ((string= ctx "work") (setq org-agenda-files work-agenda-files))))
+
+ ;; Set the default context.
+ (dwrz-switch-org-ctx "dwrz")
+
+ (setq org-agenda-follow-indirect nil
+ org-agenda-include-diary t
+ org-agenda-prefix-format '((agenda . " %i %?-12t% s")
+ (timeline . " % s")
+ (todo . " %i")
+ (tags . " %i")
+ (search . " %i"))
+ org-agenda-span 'month
+ org-agenda-tags-column 'auto
+ org-agenda-use-time-grid nil
+ org-agenda-window-setup 'current-window
+ org-archive-location "~/org/archive.org::")
+ :defines chimerical-agenda-files dwrz-agenda-files work-agenda-files
+ :functions dwrz-switch-org-ctx
:ensure nil)
(use-package org-capture
@@ -522,6 +530,7 @@
(use-package plantuml-mode
:config (setq org-plantuml-jar-path (expand-file-name
"/usr/share/java/plantuml/plantuml.jar"))
+ :defines org-plantuml-jar-path
:ensure t)
(use-package prog-mode
@@ -646,6 +655,13 @@
("r" highlight-regexp "regex" :color blue :column "do")
("u" unhighlight-regexp "unhighlight" :color blue :column "undo"))
+(defhydra hydra-org (:color blue)
+ ("q" nil "quit" :column "highlight")
+ ("a" (dwrz-switch-org-ctx "all") "all" :column "ctx")
+ ("c" (dwrz-switch-org-ctx "chimerical") "chimerical" :column "ctx")
+ ("d" (dwrz-switch-org-ctx "dwrz") "dwrz" :column "ctx")
+ ("c" (dwrz-switch-org-ctx "work") "work" :column "ctx"))
+
(defhydra hydra-point (:color blue)
("q" nil "quit" :column "point")
("e" hippie-expand "expand" :color red :column "do")
@@ -679,6 +695,7 @@
(defhydra hydra-meta-hydra (:color blue)
("q" nil "quit" :column "meta")
("h" hydra-highlight/body "highlight" :column "hydras")
+ ("o" hydra-org/body "org" :column "hydras")
("p" hydra-point/body "point" :column "hydras")
("r" hydra-region/body "region" :column "hydras")
("w" hydra-windows/body "windows" :column "hydras"))
@@ -694,8 +711,8 @@
(global-set-key (kbd "C-c j") 'jump-to-register)
(global-set-key (kbd "C-c k") nil)
(global-set-key (kbd "C-c l") 'org-store-link)
-(global-set-key (kbd "C-c m") nil)
-(global-set-key (kbd "C-c n") 'hydra-meta-hydra/body)
+(global-set-key (kbd "C-c m") 'hydra-meta-hydra/body)
+(global-set-key (kbd "C-c n") nil)
(global-set-key (kbd "C-c p") 'hydra-point/body)
(global-set-key (kbd "C-c q") nil)
(global-set-key (kbd "C-c r") 'hydra-region/body)
@@ -704,7 +721,7 @@
(global-set-key (kbd "C-c u") nil)
(global-set-key (kbd "C-c v") nil)
(global-set-key (kbd "C-c w") 'hydra-windows/body)
-(global-set-key (kbd "C-c x") nil)
+(global-set-key (kbd "C-c x") 'hydra-org/body)
(global-set-key (kbd "C-c y") nil)
(global-set-key (kbd "C-c z") nil)
(global-set-key (kbd "C-c #") 'display-line-numbers-mode)