Set the current buffer before handling key events
There's no guarantee that the global current buffer matches the selected window's buffer. For example, the following will output "*Messages*" regardless of the actual current buffer: (progn (run-at "1 sec" nil (lambda () (with-current-buffer (get-buffer "*Messages*") (sit-for 5)))) (run-at "2 sec" nil (lambda () (message (buffer-name))))) * exwm-input.el (exwm-input--on-KeyPress): Set the current buffer to selected window's current buffer.
This commit is contained in:
parent
1e9be0de38
commit
f14bd2a110
1 changed files with 13 additions and 12 deletions
|
@ -441,18 +441,19 @@ ARGS are additional arguments to CALLBACK."
|
||||||
|
|
||||||
(defun exwm-input--on-KeyPress (data _synthetic)
|
(defun exwm-input--on-KeyPress (data _synthetic)
|
||||||
"Handle KeyPress event."
|
"Handle KeyPress event."
|
||||||
(let ((obj (make-instance 'xcb:KeyPress)))
|
(with-current-buffer (window-buffer (selected-window))
|
||||||
(xcb:unmarshal obj data)
|
(let ((obj (make-instance 'xcb:KeyPress)))
|
||||||
(exwm--log "major-mode=%s buffer=%s"
|
(xcb:unmarshal obj data)
|
||||||
major-mode (buffer-name (current-buffer)))
|
(exwm--log "major-mode=%s buffer=%s"
|
||||||
(if (derived-mode-p 'exwm-mode)
|
major-mode (buffer-name (current-buffer)))
|
||||||
(cl-case exwm--input-mode
|
(if (derived-mode-p 'exwm-mode)
|
||||||
(line-mode
|
(cl-case exwm--input-mode
|
||||||
(exwm-input--on-KeyPress-line-mode obj data))
|
(line-mode
|
||||||
(char-mode
|
(exwm-input--on-KeyPress-line-mode obj data))
|
||||||
(exwm-input--on-KeyPress-char-mode obj data)))
|
(char-mode
|
||||||
(exwm-input--on-KeyPress-char-mode obj)))
|
(exwm-input--on-KeyPress-char-mode obj data)))
|
||||||
(run-hooks 'exwm-input--event-hook))
|
(exwm-input--on-KeyPress-char-mode obj)))
|
||||||
|
(run-hooks 'exwm-input--event-hook)))
|
||||||
|
|
||||||
(defun exwm-input--on-CreateNotify (data _synthetic)
|
(defun exwm-input--on-CreateNotify (data _synthetic)
|
||||||
"Handle CreateNotify events."
|
"Handle CreateNotify events."
|
||||||
|
|
Loading…
Reference in a new issue