From 7357297043636de26d309eccb941321664e0be4a Mon Sep 17 00:00:00 2001 From: rearman Date: Wed, 8 May 2024 09:44:34 -0400 Subject: [PATCH] Re-organized the org section, update to 29.3 --- init.org | 146 +++++++++++++++++++++++++++++++++---------------------- 1 file changed, 87 insertions(+), 59 deletions(-) diff --git a/init.org b/init.org index 0ef399f..e0fef01 100644 --- a/init.org +++ b/init.org @@ -1,6 +1,6 @@ #+TITLE: Emacs Configuratione #+OPTIONS: toc:4 -#+PROPERTY: header-args:emacs-lisp :tangle yes :results silent :export code :comments org +#+PROPERTY: header-args:emacs-lisp :tangle yes :results silent :export code * Introduction This is my emacs configuration. It is meant to be used across linux, windows, and BSD. I use windows only at work (Industrial Controls). I use emacs often as an advanced programmable calculator. @@ -11,12 +11,12 @@ Lots of inspiration taken from: - [[https://github.com/sachac/.emacs.d][github.com/sachac/.emacs.d]] ** A note on version checking -I keep my emacs installs at the latest release, so I don't worry about checking for versions in my init unless I happen to update on linux/BSD before the windows binaries are released. That being said, I am currently on version 29.1. +I keep my emacs installs at the latest release, so I don't worry about checking for versions in my init unless I happen to update on linux/BSD before the windows binaries are released. That being said, I am currently on version 29.3. ** Latinization I believe that all scientific knowledge, and by extension computational knowledge, should be shared in Latin. That is to say I intend to facilitate Latin's return as the default language for global knowledge sharing. To be consistent, I will soon be translating as much of this file as possible into Latin. Monitus es. * Meta Configuration I have taken this mostly whole-hog from [[https://github.com/larstvei/dot-emacs][github.com/larstvei/dot-emacs]]. The idea is that this bare-bones init.el is available when the repo is pulled in, but gets overwritten on emacs' first run. Emacs will need to be re-started after that initial run, since =early-init.el= will be created, and some packages will be installed. - +** Init.el This is the repo's =init.el= file, which bootstraps the real =init.el=. #+BEGIN_SRC emacs-lisp :tangle no ;;; This file replaces itself with the real config at first run @@ -31,14 +31,15 @@ This is the repo's =init.el= file, which bootstraps the real =init.el=. (load-file (concat user-emacs-directory "init.el")) #+END_SRC +** Git init.el tracking +*** Disable Tracking There is no reason to track the =init.el= that is generated. Run the following command to make git ignore the generated file, but keep the dummy init. - #+BEGIN_SRC sh :tangle no git update-index --assume-unchanged init.el #+END_SRC +*** Enable Tracking If changes to the dummy-init are needed, track those by running - #+BEGIN_SRC sh :tangle no git update-index --no-assume-unchanged init.el #+END_SRC @@ -68,8 +69,7 @@ Set the GC threshold to max during startup, then set it back to a value that is #+END_SRC ** Basic UI preferences -I want no menus, no tool-bars, left-side scroll-bars, no blinking cursor, and no messages when starting up. I just want the scratch buffer with a report on =emacs-init-time=. Make resizing work properly as well. - +I want no menus, no tool-bars, left-side scroll-bars, no blinking cursor, no messages when starting up, make resizing work properly, and start up maximized. I just want the scratch buffer with a report on =emacs-init-time=. #+BEGIN_SRC emacs-lisp :tangle ./early-init.el (menu-bar-mode -1) (tool-bar-mode -1) @@ -79,15 +79,10 @@ I want no menus, no tool-bars, left-side scroll-bars, no blinking cursor, and no (setq inhibit-startup-screen t inhibit-startup-buffer-menu t - initial-scratch-message (message ";;; Emacs loaded in %s.\n\n" (emacs-init-time)) server-client-instructions nil - frame-resize-pixelwise t) -#+END_SRC - -I am now using the default theme. Make every frame open full-screen. - -#+BEGIN_SRC emacs-lisp :tangle ./early-init.el -(setq default-frame-alist '((fullscreen . maximized))) + frame-resize-pixelwise t + default-frame-alist '((fullscreen . maximized)) + initial-scratch-message (message ";;; Emacs loaded in %s.\n\n" (emacs-init-time))) #+END_SRC ** Misc/odd issues @@ -456,30 +451,38 @@ Use =recycle bin=, DON'T use =AltGr=, and tell emacs where =diff= is. #+END_SRC ** org configuration -I had this in a use-package declaration, but I find this a little nicer. +My (now-sprawling) org configuration +*** Startup options +Start folded, and show stars as indentation. +#+BEGIN_SRC emacs-lisp +(setq org-startup-folded t + org-startup-indented t) +#+END_SRC + *** Basics -Just some basic/misc stuff. I don't think I've seen too many configs that don't have at least most of these. +Don't split my line, just make a new one, follow links with return, export tables as csvs, and use an absolute path for links (while shortening home to ~). #+BEGIN_SRC emacs-lisp (setq org-M-RET-may-split-line nil org-return-follows-link t - org-agenda-restore-windows-after-quit t - org-use-fast-todo-selection 'expert + org-table-export-default-format "orgtbl-to-csv" + org-link-file-path-type 'absolute) +#+END_SRC + +*** TO-DO options +Select with single key, enforce sub-tasks, only change the color of the keyword. +#+BEGIN_SRC emacs-lisp +(setq org-use-fast-todo-selection 'expert org-fast-tag-selection-single-key 'expert org-enforce-todo-dependencies t org-enforce-todo-checkbox-dependencies t - org-agenda-start-on-weekday nil - org-reverse-note-order t - org-cycle-separator-lines 0 - org-catch-invisible-edits 'error - org-deadline-warning-days 30 - org-table-export-default-format "orgtbl-to-csv" - org-agenda-window-setup 'current-window - org-link-file-path-type 'absolute - org-startup-folded t - org-startup-indented t org-fontify-done-headline nil - org-fontify-todo-headline nil - org-goto-interface 'outline-path-completion + org-fontify-todo-headline nil) +#+END_SRC + +*** Navigation +Make the =C-c C-j= binding more useful +#+BEGIN_SRC emacs-lisp +(setq org-goto-interface 'outline-path-completion org-outline-path-complete-in-steps nil org-goto-max-level 9) #+END_SRC @@ -494,6 +497,7 @@ The usual bindings. (keymap-global-set "C-c b" 'org-switchb) #+END_SRC +*** Special keys & subtree yanking Org special keys - do logical things with =C-a/e/k=, and adjust subtree level when yanking. #+BEGIN_SRC emacs-lisp (setq org-special-ctrl-a/e t @@ -501,6 +505,16 @@ Org special keys - do logical things with =C-a/e/k=, and adjust subtree level wh org-yank-adjusted-subtrees t) #+END_SRC +*** File Opening +Don't open links in another window, just use the current one + +#+BEGIN_SRC emacs-lisp +(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))) +#+END_SRC *** Directories Tell org where everything is #+BEGIN_SRC emacs-lisp @@ -509,7 +523,7 @@ Tell org where everything is org-default-notes-file "~/org/refile.org" org-journal-file "~/org/journal.org") #+END_SRC - +*** Refile Let me refile anywhere, use outline paths, confirm when creating parent nodes. #+BEGIN_SRC emacs-lisp (setq org-refile-targets '((nil :maxlevel . 9) @@ -518,7 +532,7 @@ Let me refile anywhere, use outline paths, confirm when creating parent nodes. org-refile-allow-creating-parent-nodes '(confirm)) #+END_SRC -*** Keywords and Filtering +*** Keywords Set up some more todo keywords #+BEGIN_SRC emacs-lisp (setq org-todo-keywords '((sequence "TODO(t)" @@ -530,14 +544,27 @@ Set up some more todo keywords "DONE(d!/@)" "CANCELLED(c@)"))) #+END_SRC -Tag filtering + +*** Tag Filtering +Add some much-used tags with shortcuts #+BEGIN_SRC emacs-lisp (setq org-tag-alist '((:startgroup . nil) ("need" . ?n) ("standard" . ?s) (:endgroup . nil))) #+END_SRC + *** Agenda +**** General options +Go back to previous view on quit, always start on current day, warn me for 30 days of a deadline, and use the current window for the agenda. +#+BEGIN_SRC emacs-lisp +(setq org-agenda-restore-windows-after-quit t + org-agenda-start-on-weekday nil + org-deadline-warning-days 30 + org-agenda-window-setup 'current-window) +#+END_SRC + +**** Custom View Set up the agenda view. Access it with =C-c a SPC=. #+BEGIN_SRC emacs-lisp (setq org-agenda-custom-commands '((" " "Agenda" @@ -555,13 +582,24 @@ Set up the agenda view. Access it with =C-c a SPC=. (tags-todo "standard" ((org-agenda-overriding-header "Changes to Standard"))))))) #+END_SRC - +**** Column View Set up the format for column view. #+BEGIN_SRC emacs-lisp (setq org-columns-default-format "%50ITEM(Task) %10CLOCKSUM %16TIMESTAMP_IA" org-agenda-start-with-log-mode t) #+END_SRC +**** Clock settings +Resume clocking when emacs restarts, save&load running clock and history on exit/startup, resume last task on clock-in if clock is open, resume active clock without prompt, include current clocking task in reports, and make the clocktable look nice. +#+BEGIN_SRC emacs-lisp +(org-clock-persistence-insinuate) + +(setq org-clock-persist t + org-clock-in-resume t + org-clock-persist-query-resume nil + org-clock-report-include-clocking-task t + org-pretty-entities t) +#+END_SRC *** Templates Capture Templates per my proclivities. @@ -574,10 +612,12 @@ Capture Templates per my proclivities. "* MEETING with %? :MEETING:\n%t" :clock-in t :clock-resume t) ("a" "Appointment" entry (file+olp+datetree org-journal-file) "* APPT %?\nSCHEDULED: %t" :time-prompt t) - ("j" "Journal" entry (file+olp+datetree org-journal-file) "* %?\n%U\n"))) + ("j" "Journal" entry (file+olp+datetree org-journal-file) + "* %?\n%U\n"))) #+END_SRC -*** Abbreviations + Snippets +*** Abbreviations & Snippets +**** Abbrev-Mode settings Start up =abbrev-mode= for org #+BEGIN_SRC emacs-lisp (add-hook 'org-mode-hook #'abbrev-mode) @@ -656,14 +696,11 @@ Start up =abbrev-mode= for org #+END_SRC *** Auto-archive - -A function to automatically archive *DONE* items in an org file. I use this as an after-save-hook header declaration as such: +A function to automatically archive *DONE* items in an org file. I sometimes use this as an after-save-hook header declaration as such: #+BEGIN_SRC emacs-lisp :tangle no -*- after-save-hook: (org-auto-archive) -*- #+END_SRC -Also add that defun to =safe-local-variables= so that emacs will run it. - #+BEGIN_SRC emacs-lisp (defun org-auto-archive () "Automatically archive completed tasks in an org file. @@ -676,19 +713,23 @@ Intended for use as an after-save-hook." "TODO=\"DONE\"|TODO=\"CANCELLED\"|TODO=\"DELEGATED\"" 'file) (save-buffer)) +#+END_SRC +Also add that defun to =safe-local-variables= so that emacs will run it. +#+BEGIN_SRC emacs-lisp (setq safe-local-variable-values '((after-save-hook org-auto-archive))) #+END_SRC *** Tangling - -Some basic settings for dealing with source code in an org file. Don't make a new window for source-code edits, and keep indentation consistent. +**** Settings +Don't make a new window for source-code edits, and keep indentation consistent. #+BEGIN_SRC emacs-lisp (setq org-src-window-setup 'current-window org-src-preserve-indentation t org-src-fontify-natively t) #+END_SRC +**** Auto-tangle init.org Make a function to tangle this file, and run it on save. #+BEGIN_SRC emacs-lisp (defun tangle-init () @@ -703,7 +744,7 @@ Stolen from https://github.com/larstvei/dot-emacs." #+END_SRC *** Emphasis Regexp -For some reason, the org people decided that =verbatim= doesn't actually mean =verbatim=! This attempts to fix that. I found this solution at [[https://emacs.stackexchange.com/questions/13820/inline-verbatim-and-code-with-quotes-in-org-mode][stackexchange]]. +For some reason, the org people decided that =verbatim= doesn't actually mean =verbatim=! This attempts to fix that. I found this solution on [[https://emacs.stackexchange.com/questions/13820/inline-verbatim-and-code-with-quotes-in-org-mode][stackexchange]]. #+BEGIN_SRC emacs-lisp (eval-after-load "org" '(lambda () (setcar (nthcdr 2 org-emphasis-regexp-components) " \t\r\n,") @@ -711,18 +752,8 @@ For some reason, the org people decided that =verbatim= doesn't actually mean =v (org-element--set-regexps))) #+END_SRC -*** File Opening -Don't open links in another window, just use the current one - -#+BEGIN_SRC emacs-lisp -(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))) -#+END_SRC ** Dired configuration -Make dired use the same switches I prefer for =ls=, give me a simpler listing, and default to using its current buffer for visiting a file rather than creating a new one. +Make dired use the same switches I prefer for =ls=, give me a simpler listing, and default to using its current buffer for visiting a file, rather than creating a new one. #+BEGIN_SRC emacs-lisp (setq dired-listing-switches "-alv --group-directories-first") @@ -730,12 +761,11 @@ Make dired use the same switches I prefer for =ls=, give me a simpler listing, a (lambda () (dired-hide-details-mode t) (keymap-set dired-mode-map - "RET" 'dired-find-alternate-file))) + "RET" 'dired-find-alternate-file))) #+END_SRC ** Eshell configuration Here are the various customizations I have for eshell. - *** Binding to start eshell #+BEGIN_SRC emacs-lisp (keymap-global-set "C-c s" 'eshell) @@ -1286,10 +1316,8 @@ lb of air." #+END_SRC - ** Customize system I do not use the customize system. I don't want to see it if I don't have to. - #+BEGIN_SRC emacs-lisp (setq custom-file (expand-file-name "custom.el" user-emacs-directory)) (when (not (file-exists-p custom-file)) -- 2.39.5