Rename variable to better convey its effect

This commit is contained in:
Urbano Ustero 2015-08-26 00:44:51 +02:00
parent 22c7239f40
commit 99493190c6
2 changed files with 8 additions and 8 deletions

View file

@ -26,7 +26,7 @@
;;; Code:
(defvar exwm-workspace-number 4 "Number of workspaces (1 ~ 10).")
(defvar exwm-workspace-max-count 10 "Maximum number of workspaces.")
(defvar exwm-workspace--list nil "List of all workspaces (Emacs frames).")
(defun exwm-workspace--count ()
@ -40,7 +40,7 @@
(define-key map (int-to-string i)
`(lambda ()
(interactive)
(when (< ,i exwm-workspace-number)
(when (< ,i exwm-workspace-max-count)
(goto-history-element ,(1+ i))
(exit-minibuffer)))))
(define-key map "\C-a" (lambda () (interactive) (goto-history-element 1)))
@ -220,9 +220,9 @@ The optional FORCE option is for internal use only."
(defun exwm-workspace--add-frame-as-workspace (frame)
"Configure frame FRAME to be treated as a workspace."
(cond
((>= (exwm-workspace--count) exwm-workspace-number)
((>= (exwm-workspace--count) exwm-workspace-max-count)
(delete-frame frame)
(user-error "[EXWM] Too many workspaces: maximum is %d" exwm-workspace-number))
(user-error "[EXWM] Too many workspaces: maximum is %d" exwm-workspace-max-count))
((memq frame exwm-workspace--list)
(exwm--log "Frame is already a workspace: %s" frame))
(t
@ -284,7 +284,7 @@ The optional FORCE option is for internal use only."
(defun exwm-workspace--init ()
"Initialize workspace module."
(cl-assert (and (< 0 exwm-workspace-number) (>= 10 exwm-workspace-number)))
(cl-assert (and (< 0 exwm-workspace-max-count) (>= 10 exwm-workspace-max-count)))
;; Prevent unexpected exit
(setq confirm-kill-emacs
(lambda (prompt)

View file

@ -571,17 +571,17 @@
;; Set _NET_NUMBER_OF_DESKTOPS
(xcb:+request exwm--connection
(make-instance 'xcb:ewmh:set-_NET_NUMBER_OF_DESKTOPS
:window exwm--root :data exwm-workspace-number))
:window exwm--root :data exwm-workspace-max-count))
;; Set _NET_DESKTOP_VIEWPORT
(xcb:+request exwm--connection
(make-instance 'xcb:ewmh:set-_NET_DESKTOP_VIEWPORT
:window exwm--root
:data (make-vector (* 2 exwm-workspace-number) 0)))
:data (make-vector (* 2 exwm-workspace-max-count) 0)))
;; Set _NET_WORKAREA (with minibuffer and bottom mode-line excluded)
(let* ((workareas
(vector 0 0 (x-display-pixel-width) (x-display-pixel-height)))
(workareas (mapconcat (lambda (i) workareas)
(make-list exwm-workspace-number 0) [])))
(make-list exwm-workspace-max-count 0) [])))
(xcb:+request exwm--connection
(make-instance 'xcb:ewmh:set-_NET_WORKAREA
:window exwm--root :data workareas)))