Comments (1)
OK, so this means I really can't use Esc as this nice quick exit function in conemacs
:-/
Alt+Q is kinda viable, fill-paragraph
is the cost...
So, conemacs
is now:
emacs -nw --eval '(define-key (current-global-map) (kbd "M-q") (kbd "C-x C-c"))' -- "$@"
Well, not so fast....
Actually, even my vanilla Emacs 30 seems to use that key by default in .sh mode, overriding the global map... Noice...:
"Keymap precedence is honestly one of the messiest parts of Emacs users are exposed to, in my opinion, especially when it comes to modal maps."
So, WTF should I do now?
-> https://emacs.stackexchange.com/questions/352/how-to-override-major-mode-bindings/358
The new conemacs:
#!/bin/sh
basedir=`dirname $0`
# Map custom key to quit, and prevent it from being overridden by every random mode
emacs -nw -l $basedir/force-map-quit-key.el -- "$@"
force-map-quit-key.el:
;; https://emacs.stackexchange.com/a/358/41263
;; Facilitate defining key bindings with high(est) priority
;; https://github.com/kaushalmodi/.emacs.d/blob/master/elisp/modi-mode.el
(defvar sz/forced-keymap (make-sparse-keymap)
"High-precedence keymap for 'sticky' bindings.")
;;;###autoload
(define-minor-mode sz/forced-keymap-mode
"A minor mode for key bindings to override major (and most minor) modes."
;; If init-value is not set to t, this mode does not get enabled in
;; `fundamental-mode' buffers even after doing \"(sz/global-forced-keymap-mode 1)\".
;; More info: http://emacs.stackexchange.com/q/16693/115
:init-value t
:lighter " sz/forced-keymap-mode"
:keymap sz/forced-keymap)
;;;###autoload
(define-globalized-minor-mode sz/global-forced-keymap-mode
sz/forced-keymap-mode
sz/forced-keymap-mode)
;; https://github.com/jwiegley/use-package/blob/master/bind-key.el
;; The keymaps in `emulation-mode-map-alists' take precedence over
;; `minor-mode-map-alist'
(add-to-list 'emulation-mode-map-alists `((sz/forced-keymap-mode . ,sz/forced-keymap)))
;; Turn off the minor mode in the minibuffer
(defun turn-off-my-mode ()
"Turn off sz/forced-keymap-mode."
(sz/forced-keymap-mode -1))
(add-hook 'minibuffer-setup-hook #'turn-off-my-mode)
(provide 'sz/forced-keymap-mode)
;; Minor mode tutorial: http://nullprogram.com/blog/2013/02/06/
;;------------------------------------------------------------------------------
(define-key sz/forced-keymap (kbd "M-q") #'save-buffers-kill-terminal)
;; Just a key macro (alias) here didn't work if there were changes to save! :-o
;; It got stuck in some input mode with no prompt or echo...:
;; ... (kbd "C-x C-c"))
from .emacs.d.
Related Issues (20)
- Fix the broken keyring sig. verif. thing (now just disabled...)!
- Reorg. config/init so that a clean, "universal" baseline is easier to define
- Fix the broken region marking etc. in my custom upcase/downcase functions!
- Fix: save-place-mode does nothing
- Fix clipboard copy from WSL tty to Windows HOT 2
- Fix display-line-numbers to show line number also for the last empty line!
- Fix: Now the other copy-paste direction has stopped working: Windows -> WSL console
- Fundamental & text modes: Tab: indent to align, or else to next tab stop or if mod. key: insert tabsize spaces
- Configurable timeout for prefix keys?
- Only show line numbers in "user" buffers (+ on request)
- Devise my own "overall" keyboard usage scheme
- Fix: Resizing the window during init should auto-adjust its position, too
- Fix: Wow, a real showstopping `$HOME` mismatch... HOT 1
- Fix: Console-mode menu should open submenu when clicked from another
- Build emacs on Windows, too
- Regroup the cfg to _not_ have a separate "global" `keys.el`...
- Migrated random local quick TODO entries...
- Key translation misery in console mode
- Follow-up Debian pkg dependencies when manually migrating to .emacs.d/elpa
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from .emacs.d.