about summary refs log tree commit diff
diff options
context:
space:
mode:
authorChris Feng <chris.w.feng@gmail.com>2015-08-27T05·05+0800
committerChris Feng <chris.w.feng@gmail.com>2015-08-27T05·07+0800
commit5222dc17d66375f20485d65573043e5a8286ae9d (patch)
treebbe436ebd117a4b4f62043759f97393052740396
parent7032ee70030273e9a32d3aa444b1247406d15552 (diff)
Avoid deleting the frame created by Emacs client by accident
When Emacs is invoked as `emacsclient -a '' -c`, it creates a frame that can
be deleted without any prompt. This commit removes the `client` parameter from
that frame to avoid such inconvenience.
-rw-r--r--exwm-workspace.el9
1 files changed, 4 insertions, 5 deletions
diff --git a/exwm-workspace.el b/exwm-workspace.el
index 27e317956686..f4e1dd19509f 100644
--- a/exwm-workspace.el
+++ b/exwm-workspace.el
@@ -24,9 +24,6 @@
 
 ;; This module adds workspace support for EXWM.
 
-;; Todo:
-;; + prevent from deleting frames of Emacs client (`frame-delete-functions')
-
 ;;; Code:
 
 (defvar exwm-workspace-number 4 "Number of workspaces (1 ~ 10).")
@@ -230,8 +227,10 @@ The optional FORCE option is for internal use only."
     ;; Emacs client creates an extra (but unusable) frame
     (dolist (i exwm-workspace--list)
       (unless (frame-parameter i 'window-id)
-        (setq exwm-workspace--list (delq i exwm-workspace--list)))))
-  (cl-assert (= 1 (length exwm-workspace--list)))
+        (setq exwm-workspace--list (delq i exwm-workspace--list))))
+    (cl-assert (= 1 (length exwm-workspace--list)))
+    ;; Prevent user from deleting this frame by accident
+    (set-frame-parameter (car exwm-workspace--list) 'client nil))
   ;; Create remaining frames
   (dotimes (i (1- exwm-workspace-number))
     (nconc exwm-workspace--list