Skip to content

Instantly share code, notes, and snippets.

@mmarshall540
mmarshall540 / down-list-with-marking-strings-and-succession.el
Last active November 21, 2023 17:40
Alternatives to 'down-list' and 'backward-up-list' with string-movement, marking, and traversal
(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.
@mmarshall540
mmarshall540 / simple-modal.el
Last active December 17, 2023 11:00
A simplistic modal editing system.
;; 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".
@mmarshall540
mmarshall540 / translate-modifiers.el
Last active November 23, 2022 01:50
Translating modifier keys in Emacs
;; 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))))