From c8021a7b1b68c46ac184724faa04c409570dcaf1 Mon Sep 17 00:00:00 2001 From: Phil Bajsicki Date: Tue, 22 Aug 2023 13:06:03 +0200 Subject: [PATCH] Added automatic timestamps in Emacs so I can save time/ effort on keybinds. --- .config/doom/README.org | 137 +++++++++++++++++++++++++++----------- .config/doom/config.el | 45 ++++++++++++- .config/doom/init.el | 2 +- .config/doom/packages.el | 10 ++- .config/fish/README.org | 3 + .config/xmonad/README.org | 28 +++----- .config/xmonad/xmonad.hs | 26 ++++---- .stow-local-ignore | 2 +- 8 files changed, 180 insertions(+), 73 deletions(-) diff --git a/.config/doom/README.org b/.config/doom/README.org index 81f0a59..09d2406 100644 --- a/.config/doom/README.org +++ b/.config/doom/README.org @@ -8,6 +8,8 @@ Some of the comments are from the default config.el file that ships with Doom Em You can extract all the source/ config files from here by running Emacs and hitting ~C-c C-v t~. +A lot of these are swiped from [[https://gitlab.com/dwt1/configuring-emacs/][DT's Configuring Emacs config files.]] + * config.el ** Basic settings, Theme and Display @@ -15,29 +17,35 @@ You can extract all the source/ config files from here by running Emacs and hitt #+begin_src emacs-lisp :tangle config.el (setq user-full-name "Phil Bajsicki") - (setq global-auto-revert-mode t) (setq auth-sources '("~/.authinfo")) +(setq straight-repository-branch "develop") + (after! counsel (setq counsel-outline-display-style 'title)) +(setq doom-themes-enable-bold t + doom-themes-enable-italic t) + +(setq doom-font (font-spec :family "Iosevka" :size 12 :weight 'semi-light) + doom-variable-pitch-font (font-spec :family "Iosevka" :size 13)) + +(load-theme 'doom-one t) +(doom-themes-neotree-config) +(doom-themes-org-config) + +(set-frame-parameter nil 'alpha-background 70) + +(add-to-list 'default-frame-alist '(alpha-background . 70)) + (setq display-line-numbers-type 'relative) (setq next-screen-context-lines 4) (after! persp-mode (setq persp-emacsclient-init-frame-behaviour-override "main")) (setq doom-modeline-persp-name t) -#+end_src -** Theming -#+begin_src emacs-lisp :tangle config.el -(set-frame-parameter nil 'alpha-background 70) -(add-to-list 'default-frame-alist '(alpha-background . 70)) - -(setq doom-font (font-spec :family "Iosevka" :size 12 :weight 'semi-light) - doom-variable-pitch-font (font-spec :family "Iosevka" :size 13)) -(setq doom-theme 'doom-one) #+end_src @@ -53,18 +61,30 @@ Make .org file automatically open in org-mode. (setq org-contacts-files (file-expand-wildcards "~/enc/org/*.org")) - (setq-default org-enforce-todo-dependencies t) -(setq org-startup-with-inline-images t) + +(setq org-superstar-headline-bullets-list + '("⁖" "◉" "○" "✸" "✿")) +#+end_src + +Ensure that hitting ~M-~ splits the line it's on. This is useful when I'm typing something long, and then decide to turn a paragraph into a li +#+begin_src emacs-lisp :tangle config.el +(setq org-M-RET-may-split-line '((default . t))) +#+end_src + +*** org-contacts +#+begin_src emacs-lisp :tangle config.el +(setq org-contacts-files '("~/enc/org/people.org")) #+end_src -*** Org-contacts *** Keybinds #+begin_src emacs-lisp :tangle config.el (global-set-key "\C-cl" 'org-store-link) (global-set-key "\C-ch" 'counsel-org-link) (global-set-key "\C-cne" 'elgantt-open) +(global-set-key "\C-cnn" 'org-capture) + #+end_src *** Timestamp keybinds Inserts timestamps in the proper format. ~'(16)~ stands for two universal arguments, keeping the command from prompting for the time. Two keybinds here, which insert an active or inactive timestamp. @@ -74,17 +94,40 @@ Inserts timestamps in the proper format. ~'(16)~ stands for two universal argume (global-set-key "\C-cii" '(lambda () (interactive) (org-timestamp-inactive '(16)))) #+end_src +*** Automated timestamps in headings +I need this because hitting the above is tedious, as I keep my journals, expenses and therapy notes in org-roam. + +For the files whose paths match the strings in the function, it will advise the org-insert-heading function to insert an inactive timestamp into the new heading. + +This turns making new entries from ~C- C-i i~ into just ~C-~. Much easier, and I don't have to think about this any more. + +#+begin_src emacs-lisp :tangle config.el +(add-hook 'org-insert-heading-hook + (lambda () + (if + (or + (string-match "journal" buffer-file-name) + (string-match "money" buffer-file-name) + (string-match "therapy" buffer-file-name)) + ((lambda () + (interactive) + (org-timestamp-inactive '(16)))) + (setq 'org-insert-heading-hook nil) + ))) + +#+end_src + *** Theming. #+begin_src emacs-lisp config.el -(setq org-superstar-special-todo-items t) (setq org-fontify-todo-headline t) (setq org-footnote-section nil) (setq org-table-duration-hour-zero-padding nil) #+end_src + *** Todo keywords #+begin_src emacs-lisp :tangle config.el @@ -136,12 +179,11 @@ Inserts timestamps in the proper format. ~'(16)~ stands for two universal argume *** Capture templates #+begin_src emacs-lisp :tangle config.el -(setq org-capture-templates '( - ("t" "inbox" entry (file+headline "~/enc/org/phil.org" "Inbox") "* TODO %i%?") - ("i" "idea" entry (file+headline "~/enc/org/phil.org" "Ideas") "* %?") - ("d" "reminder" entry (file+headline "~/enc/org/phil.org" "Reminders") "* %i%? \n %U") - ("p" "person" entry (file+headline "~/enc/org/people.org" "People") - "* %(org-contacts-template-name) +(setq org-capture-templates '(("t" "inbox" entry (file+headline "~/enc/org/phil.org" "Inbox") "* TODO %i%?") + ("i" "idea" entry (file+headline "~/enc/org/phil.org" "Ideas") "* %?") + ("d" "reminder" entry (file+headline "~/enc/org/phil.org" "Reminders") "* %i%? \n %U") + ("p" "person" entry (file+headline "~/enc/org/people.org" "People") + "* %(org-contacts-template-name) :PROPERTIES: :EMAIL: %(org-contacts-template-email) :PHONE: %(org-contacts-template-phone) @@ -203,7 +245,8 @@ This lets me get desktop notifications for TODO items. :unnarrowed t) ("j" "journal" plain "%?" - :if-new (file+head "journal/journal-%<%Y.%m.%d.%H\:%M>.org" "#+title: ${title}\n") + :if-new (file+head "journal/journal-%<%Y.%m.%d.%H\:%M>-${slug}.org" "#+title: ${title}\n") + :empty-lines 1 :unnarrowed t) ("t" "Therapy" plain " @@ -217,8 +260,9 @@ This lets me get desktop notifications for TODO items. ,** Emocje alternatywne- ,** Zachowania alternatywne " - :if-new (file+head "therapy/therapy-%<%Y.%m.%d.%H\:%M>.org" "#+title: ${title}\n") - :unnarrowed)))) + :if-new (file+head "therapy/therapy-%<%Y.%m.%d.%H\:%M>-${slug}.org" "#+title: ${title}\n") + :empty-lines 1 + :unnarrowed))) #+end_src ** org-roam-ui #+begin_src emacs-lisp :tangle config.el @@ -273,7 +317,7 @@ This lets me get desktop notifications for TODO items. *** Settings #+begin_src emacs-lisp :tangle config.el -(setq org-agenda-files '("~/enc/org/" "~/enc/org/roam/" "~/enc/org/roam/journal" "~/enc/org/roam/therapy")) +(setq org-agenda-files (directory-files-recursively "~/enc/org" "org$")) (setq org-agenda-start-day nil org-agenda-span '14 org-agenda-dim-blocked-tasks 'invisible @@ -282,16 +326,29 @@ This lets me get desktop notifications for TODO items. (todo priority-down category-keep) (search category-keep)) org-deadline-warning-days 3 - org-agenda-include-diary "~/enc/org/phil-journal.org" org-agenda-insert-diary-extract-time t org-log-into-drawer t org-clock-into-drawer t org-agenda-log-mode-items '(closed clock state)) + + +(setq org-agenda-custom-commands + (quote (("x" "Phil's view" agenda "" + ((org-agenda-prefix-format " %i %b %-12:c %s %t ")))))) #+end_src ** yasnippets #+begin_src emacs-lisp :tangle config.el (setq doom-snippets-enable-short-helpers t) +#+end_src +** dired-open +#+begin_src emacs-lisp :tangle config.el +(setq dired-open-extensions '(("gif" . "sxiv") + ("jpg" . "sxiv") + ("png" . "sxiv") + ("mkv" . "mpv") + ("mp4" . "mpv"))) + #+end_src * custom.el Custom variables. Note that this file is generally set up automatically by Emacs, so I'm not exporting this block. I'm keeping the default warning commants in just for completion here. @@ -383,7 +440,7 @@ data emacs-lisp (haskell +lsp) latex -org +(org +pretty) plantuml raku shipsweb @@ -469,6 +526,13 @@ release. You can ~unpin!~ them. Note ~(unpin! t)~ unpins all the packages and ca (package! counsel) (package! deft) #+end_src +*** Themes +#+begin_src emacs-lisp :tangle packages.el +(package! all-the-icons) +(package! all-the-icons-dired) + +(package! doom-themes) +#+end_src *** Modes: #+begin_src emacs-lisp :tangle packages.el (package! battle-haxe) @@ -481,27 +545,24 @@ release. You can ~unpin!~ them. Note ~(unpin! t)~ unpins all the packages and ca (package! ivy) (package! ivy-xref) #+end_src +*** dired +#+begin_src emacs-lisp :tangle packages.el +(package! dired-open) +#+end_src *** Org +- org-roam pinned to ca873f7 because of https://github.com/org-roam/org-roam/issues/2361 + #+begin_src emacs-lisp :tangle packages.el (package! org-contacts) +(package! org-bullets) +(package! org-download) (package! org-cliplink) -(package! org-roam) +(package! org-roam :pin "ca873f7") (package! org-ql) (package! org-wild-notifier) (unpin! org-roam) (package! org-roam-ui) #+end_src -*** org-download -#+begin_src emacs-lisp :tangle packages.el -(package! org-download) -(after! org-download - (setq org-download-method 'directory) - (setq org-download-image-dir (concat (file-name-sans-extension (buffer-file-name)) "-img")) - (setq org-download-image-org-width 600) - (setq org-download-link-format "[[file:%s]]\n" - org-download-abbreviate-filename-function #'file-relative-name) - (setq org-download-link-format-function #'org-download-link-format-function-default)) -#+end_src *** Org-depend Ensure task dependencies are met. #+begin_src emacs-lisp :tangle packages.el diff --git a/.config/doom/config.el b/.config/doom/config.el index 49257cf..9ad9287 100644 --- a/.config/doom/config.el +++ b/.config/doom/config.el @@ -8,9 +8,20 @@ (after! counsel (setq counsel-outline-display-style 'title)) + +(setq doom-themes-enable-bold t + doom-themes-enable-italic t) + (setq doom-font (font-spec :family "Iosevka" :size 12 :weight 'semi-light) doom-variable-pitch-font (font-spec :family "Iosevka" :size 13)) -(setq doom-theme 'doom-one) + +(load-theme 'doom-one t) +(doom-themes-neotree-config) +(doom-themes-org-config) + +(set-frame-parameter nil 'alpha-background 70) + +(add-to-list 'default-frame-alist '(alpha-background . 70)) (setq display-line-numbers-type 'relative) (setq next-screen-context-lines 4) @@ -25,18 +36,37 @@ (setq org-contacts-files (file-expand-wildcards "~/enc/org/*.org")) - (setq-default org-enforce-todo-dependencies t) +(setq org-superstar-headline-bullets-list + '("⁖" "◉" "○" "✸" "✿")) + +(setq org-M-RET-may-split-line '((default . t))) + +(setq org-contacts-files '("~/enc/org/people.org")) + (global-set-key "\C-cl" 'org-store-link) (global-set-key "\C-ch" 'counsel-org-link) (global-set-key "\C-cne" 'elgantt-open) +(global-set-key "\C-cnn" 'org-capture) (global-set-key "\C-cia" '(lambda ()(interactive) (org-timestamp '(16)))) (global-set-key "\C-cii" '(lambda () (interactive) (org-timestamp-inactive '(16)))) +(add-hook 'org-insert-heading-hook + (lambda () + (if + (or + (string-match "journal" buffer-file-name) + (string-match "therapy" buffer-file-name)) + ((lambda () + (interactive) + (org-timestamp-inactive '(16)))) + (setq 'org-insert-heading-hook nil) + ))) + (setq org-todo-keywords '((sequence "INBOX(i)" @@ -203,4 +233,15 @@ org-clock-into-drawer t org-agenda-log-mode-items '(closed clock state)) + +(setq org-agenda-custom-commands + (quote (("x" "Phil's view" agenda "" + ((org-agenda-prefix-format " %i %b %-12:c %s %t ")))))) + (setq doom-snippets-enable-short-helpers t) + +(setq dired-open-extensions '(("gif" . "sxiv") + ("jpg" . "sxiv") + ("png" . "sxiv") + ("mkv" . "mpv") + ("mp4" . "mpv"))) diff --git a/.config/doom/init.el b/.config/doom/init.el index 8f2b3fb..58fcd40 100644 --- a/.config/doom/init.el +++ b/.config/doom/init.el @@ -51,7 +51,7 @@ data emacs-lisp (haskell +lsp) latex -org +(org +pretty) plantuml raku shipsweb diff --git a/.config/doom/packages.el b/.config/doom/packages.el index 6db6180..6bbd080 100644 --- a/.config/doom/packages.el +++ b/.config/doom/packages.el @@ -6,6 +6,11 @@ (package! counsel) (package! deft) +(package! all-the-icons) +(package! all-the-icons-dired) + +(package! doom-themes) + (package! battle-haxe) (package! fish-mode) (package! typescript-mode) @@ -14,10 +19,13 @@ (package! ivy) (package! ivy-xref) +(package! dired-open) + (package! org-contacts) +(package! org-bullets) (package! org-download) (package! org-cliplink) -(package! org-roam) +(package! org-roam :pin "ca873f7") (package! org-ql) (package! org-wild-notifier) (unpin! org-roam) diff --git a/.config/fish/README.org b/.config/fish/README.org index 2bbcc68..64c75e6 100644 --- a/.config/fish/README.org +++ b/.config/fish/README.org @@ -19,6 +19,9 @@ set TERM "xterm-256color" set EDITOR "emacsclient -t -a ''" set VISUAL "emacsclient -c -a emacs" set QT_QPA_PLATFORMTHEME "qt6ct" +set SSH_AUTH_SOCK $XDG_RUNTIME_DIR/ssh-agent.socket +set GNUPGHOME "~/enc/keys/gnupg" + #+end_src * Manpager diff --git a/.config/xmonad/README.org b/.config/xmonad/README.org index fe5641e..9781991 100644 --- a/.config/xmonad/README.org +++ b/.config/xmonad/README.org @@ -247,7 +247,6 @@ myManageHook = manageSpawn <> composeAll , className =? "splash" --> doFloat , className =? "toolbar" --> doFloat , className =? "zoom" --> doFloat - , className =? "lxqt-openssh-askpass" --> doFloat , className =? "Yad" --> doCenterFloat , (className =? "firefox" <&&> resource =? "Dialog") --> doFloat -- Float Firefox Dialog , isFullscreen --> doFullFloat @@ -303,21 +302,14 @@ Emacs daemon for emacsclient. spawnOnce "/usr/bin/emacs --daemon" #+end_src *** Startup applications -- Firefox, for most of my browsing. -- Evolution, for email. -- Discord, for chatting. (Wish it were FOSS so bad...) -- Google Chrome, for all the important personal things (banking, shopping, facebook, etc). The reason is that a lot of these websites don't work well with all the privacy extensions I have in Firefox. This at least keeps them all in one place and prevents cross-contamination. -- Steam for gaming. -- Emacs for writing things like this document. -- KeePassXC for my passwords. #+begin_src haskell - spawnOnOnce "1" "firefox-developer-edition" - spawnOnOnce "2" "evolution" - spawnOnOnce "3" "discord" - spawnOnOnce "6" "google-chrome-stable --profile-directory='Profile 1'" - spawnOnOnce "9" "steam" - spawnOnOnce "e" "/usr/bin/emacsclient" - spawnOnOnce "j" "keepassxc ~/enc/keys/Passwords.kdbx" + spawnOn "1" "firefox-developer-edition" + spawnOn "2" "evolution" + spawnOn "9" "steam" + spawnOn "3" "discord" + spawnOn "6" "google-chrome-stable" + spawnOn "e" "/usr/bin/emacsclient" + spawnOn "j" "keepassxc" #+end_src * Main XMonad loop @@ -534,9 +526,9 @@ Notes: I use a ZSA Moonlander so a lot of the 4-5 key sequences are actually jus #+end_src *** XMonad.Prompt.OrgMode #+begin_src haskell - , ("M-c i", orgPrompt def "TODO" "~/enc/org/phil.org") - , ("M-c l", orgPromptPrimary def "LINK" "~/enc/org/phil.org") - , ("M-c n", orgPrompt def "NOTE" "~/enc/org/phil.org") + , ("M-c i", orgPrompt def "TODO" "~/enc/org/inbox.org") + , ("M-c l", orgPromptPrimary def "LINK" "~/enc/org/inbox.org") + , ("M-c n", orgPrompt def "NOTE" "~/enc/org/inbox.org") , ("M-c p", orgPromptRefile def "TODO" "~/enc/org/phil.org") #+end_src *** Timestamp chords diff --git a/.config/xmonad/xmonad.hs b/.config/xmonad/xmonad.hs index f813cba..99f5cc0 100644 --- a/.config/xmonad/xmonad.hs +++ b/.config/xmonad/xmonad.hs @@ -161,13 +161,13 @@ myStartupHook = do spawnOnce "/usr/bin/emacs --daemon" - spawnOn "1" "firefox-developer-edition" - spawnOn "2" "evolution" - spawnOn "3" "discord" - spawnOn "6" "google-chrome-stable --profile-directory='Profile 1'" - spawnOn "9" "steam" - spawnOn "e" "/usr/bin/emacsclient" - spawnOn "j" "keepassxc ~/enc/keys/Passwords.kdbx" + spawnOnOnce "1" "firefox-developer-edition" + spawnOnOnce "2" "evolution" + spawnOnOnce "3" "discord" + spawnOnOnce "6" "google-chrome-stable --profile-directory='Profile 1'" + spawnOnOnce "9" "steam" + spawnOnOnce "e" "/usr/bin/emacsclient" + spawnOnOnce "j" "keepassxc ~/enc/keys/Passwords.kdbx" main :: IO () main = do @@ -328,7 +328,7 @@ main = do , ("C-S-M1-j", onGroup W.focusUp') , ("C-S-M1-y", onGroup W.focusDown') - , ("C-M1-S-0", sequence_ [spawn "xmonad --restart", spawn "xmonad --recompile"]) + , ("C-M1-S-0", sequence_ [spawn "xmonad --recompile", spawn "xmonad --restart"]) , ("M-S-M1-C-0", io exitSuccess) , ("S-C-M1-q", kill1) , ("M-S-C-M1-q", killAll) @@ -337,14 +337,16 @@ main = do , ("M-e", spawn "emacsclient -c -a 'emacs'") , ("M-", spawn "alacritty") , ("M-S-", spawn "feh --randomize --bg-fill /usr/share/backgrounds/archlinux/*") - , ("M-", spawn "dm-maim") , ("", spawn "flameshot gui") - , ("M-c i", orgPrompt def "TODO" "~/enc/org/phil.org") - , ("M-c l", orgPromptPrimary def "LINK" "~/enc/org/phil.org") - , ("M-c n", orgPrompt def "NOTE" "~/enc/org/phil.org") + , ("M-c i", orgPromptRefileTo def "Inbox" "TODO" "~/enc/org/phil.org") + , ("M-c p", orgPromptRefile def "TODO" "~/enc/org/phil.org") + , ("M-c n", orgPromptRefileTo def "Inbox" "NOTE" "~/enc/org/phil.org") + + , ("M-c l", orgPromptPrimary def "" "~/enc/org/bookmarks.org") + -- Time! Timestamps! , ("M-w l", spawn "sleep 0.5 && xdotool type \"$(date +'%Y.%m.%d %H:%M:%S %Z')\"") , ("M-w e", spawn "sleep 0.5 && xdotool type \"$(TZ=America/New_York date +'%Y.%m.%d %H:%M:%S %Z')\"") diff --git a/.stow-local-ignore b/.stow-local-ignore index 56b02d4..c98c008 100644 --- a/.stow-local-ignore +++ b/.stow-local-ignore @@ -1,2 +1,2 @@ \.git -README.org +./README.org