This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Emacs's CUA-mode is great for minimizing context-switching if | |
;; you're forced to also use "normal" programs. | |
;; | |
;; These are some settings that help CUA-mode play more nicely with | |
;; the rest of Emacs. | |
;;; Org-mode conflict-resolution | |
;; Avoid keybinding conflict between Org-mode and CUA-rectangle by | |
;; using "C-M-RET" instead of "C-RET" for the latter. This must be |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; By default, Which-key doesn't give much help for prefix-keys. It | |
;; either shows the generic description, "+prefix", or the name of a | |
;; prefix-command, which usually isn't as descriptive as we'd like. | |
;; | |
;; Here are some descriptions for the default bindings in `global-map' | |
;; and `org-mode-map'. | |
(which-key-add-key-based-replacements | |
"<f1> 4" "help-other-win" | |
"<f1>" "help" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun my/mbol-advice (arg) | |
"With prefix ARG other than 1, return t. | |
Else, go `back-to-indentation', and if point hasn't moved, return t." | |
(if (eq arg 1) | |
(let ((start (point))) | |
(back-to-indentation) | |
(eq start (point))) | |
t)) | |
(advice-add 'move-beginning-of-line :before-while 'my/mbol-advice) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(setopt mode-line-format | |
'("%e" | |
mode-line-front-space | |
;; removed mode-line-mule-info | |
mode-line-client | |
mode-line-modified | |
mode-line-remote | |
mode-line-window-dedicated | |
;; removed `display' property from the above constructs | |
"\t" ; added |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun my/org-id-insert-link-with-completion () | |
"Insert a link to another heading using completion. | |
Use the heading text as default description, but provide an | |
opportunity to edit same. | |
The `org-outline-path-complete-in-steps' option affects the behavior of | |
this command. It works best when set to nil. | |
To change which headings are presented as candidates, modify the command | |
by adding a `targets' argument in the call to |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defmacro my/wk-abbrev (prefixstr &optional prefixabbrev mode) | |
"Remove PREFIXSTR from which-key descriptions. | |
Or, with PREFIXABBREV, replace it. Optionally, condition | |
replacement on the value of MODE. This should typically be used | |
in the `:config' block of the package that uses the prefix. An | |
`eval-after-load' is included, to ensure that which-key will have | |
loaded before adding to `which-key-replacement-alist'." | |
(let ((wkabbfuncsym (intern | |
(concat "my-wk-" prefixstr "-abbreviator"))) | |
(rx (concat "^\\(\\[[ X]\\] \\|\\)" prefixstr "-"))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun my-down-sexp-with-mark (arg) | |
"Like `down-list', but with some differences. | |
- Enter strings in addition to lists. | |
- Mark inner of the list or string reached. | |
- Traverse beyond the lowest level in a list or string and descend | |
into the next top-level list or string when necessary. | |
- Move up and select contents of the string or list reached when | |
prefix is negative. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; This is based on a Dvorak keyboard layout and isn't | |
;; very comprehensive. The purpose is just to demonstrate | |
;; that you can create your own modal editing system in Emacs | |
;; using only a little bit of code. | |
;; | |
;; After loading this file, you can use "M-\" to enter command | |
;; mode (aka "normal-state"). | |
;; | |
;; To exit back to "insert-state", press "i". |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; There seems to be no built-in mechanism to swap modifier keys in | |
;; Emacs, but it can be accomplished (for the most part) by | |
;; translating a near-exhaustive list of modifiable keys. In the case | |
;; of 'control and 'meta, some keys must be omitted to avoid errors or | |
;; other undesired effects. | |
(defun my/make-key-string (modsymbol basic-event) | |
"Convert the combination of MODSYMBOL and BASIC-EVENT. | |
BASIC-EVENT can be a character or a function-key symbol. The | |
return value can be used with `define-key'." | |
(vector (event-convert-list `(,modsymbol ,basic-event)))) |