feature/popup: move timer clearing into +popup-buffer-mode

This commit is contained in:
Henrik Lissner 2018-01-07 05:44:43 -05:00
parent 1c6d39db7f
commit a76de01f4f
No known key found for this signature in database
GPG Key ID: 5F6C0EA160557395

View File

@ -1,14 +1,5 @@
;;; feature/popup/autoload.el -*- lexical-binding: t; -*-
(defun +popup--cancel-buffer-timer ()
"Cancel the current buffer's transient timer."
(when (timerp +popup--timer)
(let ((inhibit-message (not doom-debug-mode)))
(message "Cancelled timer in %s" (current-buffer)))
(cancel-timer +popup--timer)
(setq +popup--timer nil))
t)
(defun +popup--remember (windows)
"Remember WINDOWS (a list of windows) for later restoration."
(cl-assert (cl-every #'windowp windows) t)
@ -179,7 +170,12 @@ with ARGS to get its return value."
(define-minor-mode +popup-buffer-mode
"Minor mode for popup windows."
:init-value nil
:keymap +popup-buffer-mode-map)
:keymap +popup-buffer-mode-map
(when (and +popup-buffer-mode (timerp +popup--timer))
(let ((inhibit-message (not doom-debug-mode)))
(message "Cancelled timer in %s" (current-buffer)))
(cancel-timer +popup--timer)
(setq +popup--timer nil)))
(put '+popup-buffer-mode 'permanent-local t)
(put '+popup-buffer-mode 'permanent-local-hook t)