:PROPERTIES:
:ID: df50b909-93f9-4e98-981e-fdc396c28f28
:END:
+Version 30.0 brings android support - let's try it out. This makes emacs play nice with termux. See [[https://sourceforge.net/projects/android-ports-for-gnu-emacs/files/termux][SourceForge]].
#+BEGIN_SRC emacs-lisp :tangle ./early-init.el
(when (equal system-type 'android)
(defvar termux-path "/data/data/com.termux/files/usr/bin")
:PROPERTIES:
:ID: 659c9663-b387-45d5-8386-c3a356b3766e
:END:
-I don't need these on a windows PC.
+I don't need these on a windows PC or android.
#+BEGIN_SRC emacs-lisp
-(unless (equal system-type 'windows-nt)
+(unless (or (equal system-type 'windows-nt)
+ (equal system-type 'android))
(use-package slime :ensure t)
(use-package ledger-mode
:ensure t
((:map ledger-mode-map ("C-c s" . ledger-sort-buffer)))))
#+END_SRC
-*** eink-emacs
-:PROPERTIES:
-:ID: 771a81f1-105d-44e6-9e94-51e2623a1549
-:END:
-I wanted a minimal (mostly b+w) theme. Now I just use the default theme.
-#+BEGIN_SRC emacs-lisp
-;; (use-package eink-theme
-;; :ensure t
-;; :init
-;; (load-theme 'eink t))
-#+END_SRC
*** visual-fill-column
:PROPERTIES:
:ID: ffbdc9f9-4ec4-401f-9f97-1e0d74b72c49
'(file))))
#+END_SRC
-*** org-transclusion
-:PROPERTIES:
-:ID: ca1fd8bf-db66-4ed4-926b-1f89e211522d
-:END:
-Awesome package - adds transclusions.
-
-#+BEGIN_SRC emacs-lisp
-(use-package org-transclusion
- :ensure t
- :bind (("<f12>" . org-transclusion-add)
- ("C-c n t" . org-transclusion-mode)))
-#+END_SRC
-
*** acme-mouse
:PROPERTIES:
:ID: 936ffd88-1955-4d84-ad96-fb1744d5a6e9
:ID: 6488cb21-1bb0-4b7d-93fb-c04dc4e04024
:END:
This section has '/base/' emacs customization. All the general stuff.
-
-I so far have kept most of my setq declarations in one place, only recently splitting them into multiple declarations from one large one.
-
*** Defaults
:PROPERTIES:
:ID: 6319f5d5-0763-4e41-a67b-90fb18d77e80
#+BEGIN_SRC emacs-lisp
(setq require-final-newline t)
#+END_SRC
+
**** Auto Revert
:PROPERTIES:
:ID: 6d36da61-2373-433c-a7df-cc62511ee1ad
#+BEGIN_SRC emacs-lisp
(global-auto-revert-mode t)
#+END_SRC
+
**** Segfault recovery
:PROPERTIES:
:ID: e014f4e7-c131-463c-9d8f-f16530faea83
(setq attempt-stack-overflow-recovery nil
attempt-orderly-shutdown-on-fatal-signal nil)
#+END_SRC
+
**** Whitespace and chmod on save
:PROPERTIES:
:ID: 2375de4d-f558-47f1-aea1-581240a0039a
confirm-kill-processes nil)
#+END_SRC
-**** Scrolling
-:PROPERTIES:
-:ID: 532b73e8-c97c-4862-b079-789702385362
-:END:
-#+BEGIN_SRC emacs-lisp
-(setq scroll-preserve-screen-position t)
-#+END_SRC
-
**** Windmove
:PROPERTIES:
:ID: 1c8d7229-796f-446a-8ae8-247cd6164a12
When I'm on a beginning/ending paren, I find the default of only highlighting the parens too hard to see, and highlighting the whole thing too garish. Therefore, this setup tries to underline the expression, with minimal highlighting.
Show matching parens immediately, and "highlight" the whole expression.
-
#+BEGIN_SRC emacs-lisp
(setq show-paren-delay 0
show-paren-style 'expression)
:PROPERTIES:
:ID: e7426184-8474-45d8-b0c4-a4a2ed99101d
:END:
-Don't open links in another window, just use the current one
-
+Don't open links in another window, just use the current one. This variable is otherwise as default.
#+BEGIN_SRC emacs-lisp
(setq org-link-frame-setup '((vm . vm-visit-folder-other-frame)
(vm-imap . vm-visit-imap-folder-other-frame)
(setq org-refile-targets '((nil :maxlevel . 9)
(org-agenda-files :maxlevel . 9))
org-refile-use-outline-path 'file
- org-refile-allow-creating-parent-nodes '(confirm))
+ org-refile-allow-creating-parent-nodes 'confirm)
#+END_SRC
*** Keywords
:PROPERTIES:
:ID: 1aa94af1-7a65-4ad1-8ac5-dd919252b4ab
:END:
-Add some much-used tags with shortcuts
+Add some much-used tags with shortcuts.
#+BEGIN_SRC emacs-lisp
(setq org-tag-alist '((:startgroup . nil)
("need" . ?n)
:PROPERTIES:
:ID: 12d59694-3e27-4e53-8ba3-7c341a0d1c2d
:END:
-Set up the agenda view. Access it with =C-c a SPC=.
+Set up the agenda view. Access it with ~C-c a SPC~, [[id:3281906e-1f44-4abb-9f9d-0a0a39221752][or ~F2~]].
#+BEGIN_SRC emacs-lisp
(setq org-agenda-custom-commands '((" " "Agenda"
((agenda "" nil)
(tags-todo "standard"
((org-agenda-overriding-header "Changes to Standard")))))))
#+END_SRC
+
+**** Custom Agenda on Single key
+:PROPERTIES:
+:ID: c921d7e6-63ef-4a89-851a-0f3a122e9fa0
+:END:
+Stolen from [[https://emacs.stackexchange.com/questions/864/how-to-bind-a-key-to-a-specific-agenda-command-list-in-org-mode][Stack Exchange]]
+#+BEGIN_SRC emacs-lisp
+(defun org-agenda-show-custom (&optional arg)
+ "Show my custom agenda."
+ (interactive "P")
+ (org-agenda arg " "))
+#+END_SRC
+
**** Column View
:PROPERTIES:
:ID: b30e7269-c0ba-4014-9fb9-e03e6734a4db
"#+FILETAGS: wo# workorder customer city state topics\n")
#+END_SRC
-***** Meeting properties block
-:PROPERTIES:
-:ID: ed945d25-1df8-4108-8b06-69a852be0a4c
-:END:
-Superceded by [[*Templates][Meeting Capture Template]]
-#+BEGIN_SRC emacs-lisp
-;; (define-skeleton skel-meeting-properties
-;; "Insert the org title and filetags for a meeting"
-;; ""
-;; "#+TITLE: "
-;; _ -
-;; " Meeting\n"
-;; "#+FILETAGS: meeting date customer city state attendees topics\n")
-#+END_SRC
-
**** Bind the snippets (in the =abbrev-file-name= file)
:PROPERTIES:
:ID: 1e9362ab-d7da-4d87-bef4-9a6c39530832
(add-hook 'after-save-hook 'tangle-init)
#+END_SRC
-*** Custom Agenda on Single key
-:PROPERTIES:
-:ID: c921d7e6-63ef-4a89-851a-0f3a122e9fa0
-:END:
-Stolen from [[https://emacs.stackexchange.com/questions/864/how-to-bind-a-key-to-a-specific-agenda-command-list-in-org-mode][Stack Exchange]]
-#+BEGIN_SRC emacs-lisp
-(defun org-agenda-show-custom (&optional arg)
- "Show my custom agenda."
- (interactive "P")
- (org-agenda arg " "))
-#+END_SRC
-
*** Bindings
:PROPERTIES:
:ID: adf21035-f2f1-443b-a599-4ce4f282a2ff
:PROPERTIES:
:ID: 68c34ab5-7149-49f5-91e8-fcea22d98fcd
:END:
+~C-l~ to clear buffer, send on close paren.
#+BEGIN_SRC emacs-lisp
(keymap-global-set "C-c i" 'ielm)
(add-hook 'ielm-mode-hook
:PROPERTIES:
:ID: 9f4775e4-6c76-46d6-b4e0-7dbce717907a
:END:
-Bind =find-file-at-point= and =bookmark-jump-other-window=.
+Bind ~find-file-at-point~ and ~bookmark-jump-other-window~.
#+BEGIN_SRC emacs-lisp
(keymap-global-set "C-x M-f" 'find-file-at-point)
(keymap-global-set "C-x r B" 'bookmark-jump-other-window)
:PROPERTIES:
:ID: da7cd3d7-1b85-48d3-8f68-e6b496e184ea
:END:
-I like putting redo on =C-\=. Easier for me to remember than the =C-M-_= default.
+I like putting redo on ~C-\~. Easier for me to remember than the ~C-M-_~ default.
#+BEGIN_SRC emacs-lisp
(keymap-global-set "C-\\" 'undo-redo)
#+END_SRC
(keymap-global-set "C-x C-r" 'rename-current-buffer-file)
#+END_SRC
-**** Buffer Handling
+**** Buffer Menu
:PROPERTIES:
:ID: 485c4ac3-839f-4289-a4c9-43da1a3ae048
:END:
(keymap-global-set "C-x M-b" 'buffer-menu-other-window)
#+END_SRC
-I often want to bring up the scratch buffer in my current window, and sometimes I want only one window that is the scratch buffer. Emacs 29 added the =scratch-buffer= function, so one less defun needed here.
+**** Switch to Scratch
+:PROPERTIES:
+:ID: 2d37f85a-de5a-408c-a6ce-4b8078a95775
+:END:
+I often want to bring up the scratch buffer in my current window, and sometimes I want only one window that is the scratch buffer. Emacs 29 added the ~scratch-buffer~ function, so one less defun needed here.
#+BEGIN_SRC emacs-lisp
(defun scratch-only ()
"Bring up the scratch buffer as the only visible buffer."
:PROPERTIES:
:ID: 76950919-72fc-4d2c-becf-9ef702b906f1
:END:
-The =M-^= binding is handy, but usually I want the ed/sam/vi join function, which pulls the next line up into the current line. I bind this to =M-j=.
+The ~M-^~ binding is handy, but usually I want the ed/sam/vi join function, which pulls the next line up into the current line. I bind this to ~M-j~.
#+BEGIN_SRC emacs-lisp
(defun backward-join-line ()
"A wrapper for join-line to make it go in the right direction."
:ID: 80589df3-9a23-4b2c-b103-9263db7efaab
:END:
=C-w= is very much engrained for killing back one word, as is =C-u= for killing back to the beginning of the line. [[http://unix-kb.cat-v.org/][These have been standard bindings since TENEX...]]
-
+****** =C-w=
+:PROPERTIES:
+:ID: dd0452c4-59c0-4c05-9ace-8988f28d736d
+:END:
I didn't want to re-bind =C-w= away from =kill-region=, so I made it do both.
#+BEGIN_SRC emacs-lisp
(keymap-global-set "C-w" 'kill-bword-or-region)
#+END_SRC
+****** =C-u=
+:PROPERTIES:
+:ID: 6bd8af3f-f277-4328-9037-020c9529a1ee
+:END:
There is no pre-made function to kill backward to the beginning of line from point, so I made one that passes the correct argument to =kill-line=, and bound it to =C-u=.
#+BEGIN_SRC emacs-lisp
(keymap-global-set "<home>" 'beginning-of-buffer)
(keymap-global-set "<end>" 'end-of-buffer)
#+END_SRC
+
***** Beginning of line
:PROPERTIES:
:ID: e8ddfa3d-4be7-4da7-bf6a-5dee3fcac91f
:END:
+****** ~smart-beginning-of-line~
+:PROPERTIES:
+:ID: 7b9d4bde-5ed4-4618-899e-4a0a82359f7f
+:END:
I have the infamous =smart-beginning-of-line= command here.
#+BEGIN_SRC emacs-lisp
(defun smart-beginning-of-line ()
(and (= oldpos (point))
(beginning-of-line))))
#+END_SRC
-
-I had issues with =smart-beginning-of-line= in =visual-line-mode=, so =smart-beginning-of-visual-line= was created. It implements part of =back-to-indentation=, but with changes to use =beginning-of-visual-line= instead of =beginning-of-line=.
+****** Play nice with ~visual-line-mode~
+:PROPERTIES:
+:ID: c8ad20f0-755c-4075-ae97-a43d4869cca9
+:END:
+I had issues with ~smart-beginning-of-line~ in ~visual-line-mode~, so ~smart-beginning-of-visual-line~ was created. It implements part of ~back-to-indentation~, but with changes to use ~beginning-of-visual-line~ instead of ~beginning-of-line~.
#+BEGIN_SRC emacs-lisp
(defun smart-beginning-of-visual-line ()
"Move point to first non-whitespace character or beginning-of-line.
(and (= oldpos (point))
(beginning-of-visual-line))))
#+END_SRC
-
+****** Re-mappings
+:PROPERTIES:
+:ID: 4a8e9670-2783-4f4a-ada7-f1837a8632be
+:END:
Remap =move-beginning-of-line=, then remap =beginning-of-visual-line= when going into =visual-line-mode=. A simple remap would not work for =visual-line-mode=, so I explicitly set =C-a=.
#+BEGIN_SRC emacs-lisp
(global-set-key [remap move-beginning-of-line] 'smart-beginning-of-line)
:PROPERTIES:
:ID: 7e9a99eb-18fd-4254-a20c-a1cb2fe0584d
:END:
-I ripped this defun and binding from [[https://github.com/lem-project/lem][lem]]. Can't live without it now.
+I ripped this defun and binding from [[https://github.com/lem-project/lem][lem]]. Can't live without it now. Does similar things as [[id:1c8d7229-796f-446a-8ae8-247cd6164a12][Windmove]], but without having to specify a direction.
#+BEGIN_SRC emacs-lisp
(defun other-window-or-split-window (&optional window)
(interactive)
(keymap-global-set "C-S-S" 'isearch-forward-regexp)
(keymap-global-set "C-S-R" 'isearch-backward-regexp)
#+END_SRC
-
*** Elisp/Eval bindings
:PROPERTIES:
:ID: 05c8bf80-e35f-49bc-97b0-b6caccb63ab6
:END:
These defuns are here so that I can use doas/sudo over tramp to edit /local/ files requiring root permissions. Doas for BSD, Sudo for Linux, nothing for Windows.
#+BEGIN_SRC emacs-lisp
-(unless (equal system-type 'windows-nt)
+(unless (or (equal system-type 'windows-nt)
+ (equal system-type 'android))
(if(equal system-type 'berkeley-unix)
(defun doas ()
"Use TRAMP to reopen the current buffer as root using doas."
:ID: 69a05305-6b16-4abf-bf9a-b858d9a7e642
:END:
General Math defuns, often used in later defuns.
-
+**** Exponentiation
+:PROPERTIES:
+:ID: 14d9a8c0-2984-4d53-b933-01366b286208
+:END:
I'm tired of writing out ='expt=, and I want to use the same notation every other programming language does.
#+BEGIN_SRC emacs-lisp
(defalias '^ 'expt)
#+END_SRC
-
+**** Square, Cube, and Inv
+:PROPERTIES:
+:ID: 871f50e4-447e-4da0-b86f-ec253c7d48cf
+:END:
Define square, cube, and inv for brevity of common usages.
#+BEGIN_SRC emacs-lisp
(defun square (x)