Cleanup simulation key config issues

* exwm-input.el (exwm-input-simulation-keys): Original key only has
one option, so probably shouldn’t be a `choice` type; Move the
"User-defined" key value to the top, since that’s the one someone is
most likely to want).

* exwm-config.el (exwm-config-default): Only set custom vars if there
isn’t a saved value for them.
This commit is contained in:
Ian Eure 2019-02-01 16:55:24 -08:00 committed by Chris Feng
parent 0f7269c4ec
commit ec108a61dc
2 changed files with 18 additions and 16 deletions

View file

@ -31,7 +31,8 @@
(defun exwm-config-default () (defun exwm-config-default ()
"Default configuration of EXWM." "Default configuration of EXWM."
;; Set the initial workspace number. ;; Set the initial workspace number.
(setq exwm-workspace-number 4) (unless (get 'exwm-workspace-number 'saved-value)
(setq exwm-workspace-number 4))
;; Make class name the buffer name ;; Make class name the buffer name
(add-hook 'exwm-update-class-hook (add-hook 'exwm-update-class-hook
(lambda () (lambda ()
@ -52,6 +53,7 @@
(interactive (list (read-shell-command "$ "))) (interactive (list (read-shell-command "$ ")))
(start-process-shell-command command nil command))) (start-process-shell-command command nil command)))
;; Line-editing shortcuts ;; Line-editing shortcuts
(unless (get 'exwm-input-simulation-keys 'saved-value)
(setq exwm-input-simulation-keys (setq exwm-input-simulation-keys
'(([?\C-b] . [left]) '(([?\C-b] . [left])
([?\C-f] . [right]) ([?\C-f] . [right])
@ -62,7 +64,7 @@
([?\M-v] . [prior]) ([?\M-v] . [prior])
([?\C-v] . [next]) ([?\C-v] . [next])
([?\C-d] . [delete]) ([?\C-d] . [delete])
([?\C-k] . [S-end delete]))) ([?\C-k] . [S-end delete]))))
;; Enable EXWM ;; Enable EXWM
(exwm-enable) (exwm-enable)
;; Configure Ido ;; Configure Ido

View file

@ -915,8 +915,9 @@ Notes:
* The predefined examples in the Customize interface are not guaranteed to * The predefined examples in the Customize interface are not guaranteed to
work for all applications. This can be tweaked on a per application basis work for all applications. This can be tweaked on a per application basis
with `exwm-input-set-local-simulation-keys'." with `exwm-input-set-local-simulation-keys'."
:type '(alist :key-type (choice (key-sequence :tag "Original")) :type '(alist :key-type (key-sequence :tag "Original")
:value-type (choice (key-sequence :tag "Move left" [left]) :value-type (choice (key-sequence :tag "User-defined")
(key-sequence :tag "Move left" [left])
(key-sequence :tag "Move right" [right]) (key-sequence :tag "Move right" [right])
(key-sequence :tag "Move up" [up]) (key-sequence :tag "Move up" [up])
(key-sequence :tag "Move down" [down]) (key-sequence :tag "Move down" [down])
@ -928,8 +929,7 @@ Notes:
(key-sequence :tag "Paste" [C-v]) (key-sequence :tag "Paste" [C-v])
(key-sequence :tag "Delete" [delete]) (key-sequence :tag "Delete" [delete])
(key-sequence :tag "Delete to EOL" (key-sequence :tag "Delete to EOL"
[S-end delete]) [S-end delete])))
(key-sequence :tag "User-defined")))
:set (lambda (symbol value) :set (lambda (symbol value)
(set symbol value) (set symbol value)
(exwm-input--set-simulation-keys value))) (exwm-input--set-simulation-keys value)))