[keyswap] try to swap parens and brackets in the minibuffer
This commit is contained in:
parent
b2d431d17e
commit
f78c66cc71
15
init.org
15
init.org
|
@ -1865,7 +1865,10 @@ SLIME opens CLHS links in Firefox, but I'd rather open them in Tor Browser; Tor
|
|||
|
||||
#+END_SRC
|
||||
** Programming
|
||||
*** FIXME common
|
||||
*** FIXME common [%]
|
||||
1. [X] =keyswap-mode= swaps numeric keys with symbols by default. We want to swap just () with [] (to begin with), but the code below doesn't work, for some reason.
|
||||
2. [ ] Does not always work in the minibuffer, namely =eval-expression=
|
||||
|
||||
Swap [] with () in programming and text modes.
|
||||
|
||||
pjb suggested a different approach [[http://paste.lisp.org/display/10157][here]], which is basically -
|
||||
|
@ -1890,18 +1893,22 @@ pjb suggested a different approach [[http://paste.lisp.org/display/10157][here]]
|
|||
|
||||
...which I tried, but experienced some subtle bugs, and luckily I got keyswap mode to work the way I wanted - no number-symbol switching, just parens and brackets.
|
||||
|
||||
1. [ ] =keyswap-mode= swaps numeric keys with symbols by default. We want to swap just () with [] (to begin with), but the code below doesn't work, for some reason.
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(use-package keyswap
|
||||
:hook ((prog-mode . contrapunctus-keyswap-mode)
|
||||
(text-mode . contrapunctus-keyswap-mode)
|
||||
(emacs-lisp-mode . contrapunctus-swap-brackets-parens)
|
||||
(minibuffer-setup-hook . contrapunctus-keyswap-mode) ;; probably unnecessary
|
||||
(minibuffer-setup-hook . contrapunctus-swap-brackets-parens) ;; probably unnecessary
|
||||
(eval-expression-minibuffer-setup-hook . contrapunctus-keyswap-mode)
|
||||
(eval-expression-minibuffer-setup-hook . contrapunctus-swap-brackets-parens)
|
||||
(prog-mode . contrapunctus-swap-brackets-parens)
|
||||
(text-mode . contrapunctus-swap-brackets-parens)
|
||||
(emacs-lisp-mode . keyswap-colon-semicolon)
|
||||
(lisp-mode . keyswap-colon-semicolon)
|
||||
(scheme-mode . keyswap-colon-semicolon))
|
||||
:config
|
||||
(defun contrapunctus-keyswap-mode ()
|
||||
(setq-local keyswap-pairs nil) ;; dont swap numbers symbols
|
||||
(setq-local keyswap-pairs nil) ;; dont swap numbers and symbols
|
||||
(keyswap-mode))
|
||||
(defun contrapunctus-swap-brackets-parens ()
|
||||
;; (message "keyswap-pairs is %s" keyswap-pairs)
|
||||
|
|
Loading…
Reference in New Issue