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
# -*- mode: snippet; require-final-newline: nil -*- | |
# name: $ | |
# key: $ | |
# binding: direct-keybinding | |
# -- | |
${1:${2:${3:foo }bar }baz } | |
${4:foo }${5:bar }${6:baz } | |
${7:foo ${8:bar ${9:baz }}} |
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 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
$${1:{${2:`(incf n)`}:${3:$(capitalize yas-text)}}} |
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 transient-map (keymap &optional pred onexit) | |
(defalias (-> ((user-error "It's an active map!") | |
(-contains? (current-active-maps)) | |
(-compose 'symbol-value 'eq keymap) | |
(-andfn 'mapatoms 'boundp 'keymapp) | |
(-orfn (catch 'found) (cl-gens)))) | |
(lambda (interactive "p") (keymap pred onexit) | |
(set-transient-map keymap pred onexit)))) |
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
(advice-add 'describe-prefix-bindings :after | |
(defun another-chance? (&rest args) | |
(unless (key-binding (this-command-keys)) | |
(let ((path (listify-key-sequence (this-command-keys-vector)))) | |
(set-transient-map (key-binding (vconcat (butlast path)))))))) |
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
M-x |
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
(pp '(current-active-maps :aaaaaaaaaa | |
bbbbbbbbbb :aaaaaaaaaa bbbbbbbbbb :aaaaaaaaaa bbbbbbbbbb adasd :aaaaaaaaaa bbbbbbbbbb :aaaaaaaaaa bbbbbbbbbb :aaaaaaaaaa bbbbbbbbbb :aaaaaaaaaa bbbbbbbbbb :AAAAAAAAAA BBBBBBBBBB)) | |
(current-active-maps :aaaaaaaaaa bbbbbbbbbb :aaaaaaaaaa bbbbbbbbbb :aaaaaaaaaa bbbbbbbbbb adasd :aaaaaaaaaa bbbbbbbbbb :aaaaaaaaaa bbbbbbbbbb :aaaaaaaaaa bbbbbbbbbb :aaaaaaaaaa bbbbbbbbbb :AAAAAAAAAA BBBBBBBBBB) | |
"(current-active-maps :aaaaaaaaaa bbbbbbbbbb :aaaaaaaaaa bbbbbbbbbb :aaaaaaaaaa bbbbbbbbbb adasd :aaaaaaaaaa bbbbbbbbbb :aaaaaaaaaa bbbbbbbbbb :aaaaaaaaaa bbbbbbbbbb :aaaaaaaaaa bbbbbbbbbb :AAAAAAAAAA BBBBBBBBBB) | |
" |
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
(setq-default scroll-up-aggressively 0.0) | |
(add-hook 'post-command-hook | |
(defun recenter+ () | |
(unless (and (symbolp this-command) (get this-command 'scroll-command)) | |
(with-current-buffer (window-buffer) | |
(recenter (- (1+ (save-excursion | |
(vertical-motion (floor (window-screen-lines) 2)))))))))) | |
(define-key global-map [remap scroll-down-command] | |
(defun move-to-top-line () (interactive) (move-to-window-line 1))) | |
(define-key global-map [remap scroll-up-command] |
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
(cl-defun transient-map (command &rest bindings &key keep-pred | |
on-exit &allow-other-keys) | |
(unless (commandp command) (push command bindings) | |
(setq command nil)) | |
(let* ((keymap (-map (-applify 'cons) (-partition 2 bindings)))) | |
(set-transient-map (easy-mmode-define-keymap keymap) keep-pred on-exit)) | |
(when command (call-interactively command))) |
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
(cl-defun test (&key bar) | |
(message "bar: %s" bar)) | |
(test :bar 'qwe) | |
;; "bar: qwe" | |
(cl-defun test (&rest foo &key bar) | |
(message "foo: %s bar: %s" foo bar)) | |
(test 'qwe :bar 'asd) | |
;; (error "Keyword argument qwe not one of (:bar)") |