[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/exwm 2de2d42 09/19: Factor out prompt for workspace
From: |
Chris Feng |
Subject: |
[elpa] externals/exwm 2de2d42 09/19: Factor out prompt for workspace |
Date: |
Tue, 19 Jul 2016 03:07:08 +0000 (UTC) |
branch: externals/exwm
commit 2de2d42586a0a8866e7f5447d490a0c345c7ce10
Author: Adrián Medraño Calvo <address@hidden>
Commit: Adrián Medraño Calvo <address@hidden>
Factor out prompt for workspace
* exwm-workspace.el (exwm-workspace--prompt-for-workspace): New
function to interactively ask the user for a workspace.
(exwm-workspace-switch, exwm-workspace-move-window): Use it.
---
exwm-workspace.el | 35 ++++++++++++++---------------------
1 file changed, 14 insertions(+), 21 deletions(-)
diff --git a/exwm-workspace.el b/exwm-workspace.el
index 346e898..21a415e 100644
--- a/exwm-workspace.el
+++ b/exwm-workspace.el
@@ -92,6 +92,18 @@ NIL if FRAME is not a workspace"
(defvar exwm-workspace--switch-history-outdated nil
"Non-nil to indicate `exwm-workspace--switch-history' is outdated.")
+(defun exwm-workspace--prompt-for-workspace ()
+ "Prompt for a workspace, returning the workspace frame."
+ (exwm-workspace--update-switch-history)
+ (let* ((current-idx (exwm-workspace--position exwm-workspace--current))
+ (history-add-new-input nil) ;prevent modifying history
+ (history-idx (read-from-minibuffer
+ "Workspace: " (elt exwm-workspace--switch-history
current-idx)
+ exwm-workspace--switch-map nil
+ `(exwm-workspace--switch-history . ,(1+ current-idx))))
+ (workspace-idx (cl-position history-idx
exwm-workspace--switch-history :test #'equal)))
+ (elt exwm-workspace--list workspace-idx)))
+
(defun exwm-workspace--update-switch-history ()
"Update the history for switching workspace to reflect the latest status."
(when exwm-workspace--switch-history-outdated
@@ -317,15 +329,7 @@ The optional FORCE option is for internal use only."
(interactive
(list
(unless (and (eq major-mode 'exwm-mode) exwm--fullscreen) ;it's invisible
- (exwm-workspace--update-switch-history)
- (let* ((current-idx (exwm-workspace--position exwm-workspace--current))
- (history-add-new-input nil) ;prevent modifying history
- (history-idx (read-from-minibuffer
- "Workspace: " (elt exwm-workspace--switch-history
current-idx)
- exwm-workspace--switch-map nil
- `(exwm-workspace--switch-history . ,(1+
current-idx))))
- (workspace-idx (cl-position history-idx
exwm-workspace--switch-history :test #'equal)))
- (elt exwm-workspace--list workspace-idx)))))
+ (exwm-workspace--prompt-for-workspace))))
(let* ((frame (exwm-workspace--workspace-from-frame-or-index frame-or-index))
(index (exwm-workspace--position frame))
(workspace (frame-parameter frame 'exwm-workspace))
@@ -419,18 +423,7 @@ The optional FORCE option is for internal use only."
;;;###autoload
(defun exwm-workspace-move-window (frame-or-index &optional id)
"Move window ID to workspace FRAME-OR-INDEX."
- (interactive
- (list
- (progn
- (exwm-workspace--update-switch-history)
- (let* ((current-idx (exwm-workspace--position exwm-workspace--current))
- (history-add-new-input nil) ;prevent modifying history
- (history-idx (read-from-minibuffer
- "Workspace: " (elt exwm-workspace--switch-history
current-idx)
- exwm-workspace--switch-map nil
- `(exwm-workspace--switch-history . ,(1+
current-idx))))
- (workspace-idx (cl-position history-idx
exwm-workspace--switch-history :test #'equal)))
- (elt exwm-workspace--list workspace-idx)))))
+ (interactive (list (exwm-workspace--prompt-for-workspace)))
(let ((frame (exwm-workspace--workspace-from-frame-or-index frame-or-index)))
(unless id (setq id (exwm--buffer->id (window-buffer))))
(with-current-buffer (exwm--id->buffer id)
- [elpa] externals/exwm ed6a18a 04/19: Add `exwm-workspace--position' helper, (continued)
- [elpa] externals/exwm ed6a18a 04/19: Add `exwm-workspace--position' helper, Chris Feng, 2016/07/18
- [elpa] externals/exwm f4b8cc4 11/19: Support moving workspaces, Chris Feng, 2016/07/18
- [elpa] externals/exwm 9018545 06/19: New function exwm-workspace--workspace-p, Chris Feng, 2016/07/18
- [elpa] externals/exwm cd1372e 03/19: Apply minibuffer in own frame configuration to created frames, Chris Feng, 2016/07/18
- [elpa] externals/exwm d0797d0 13/19: Remove `exwm-worspace-number', Chris Feng, 2016/07/18
- [elpa] externals/exwm 18fc95d 01/19: Minor cleanup, Chris Feng, 2016/07/18
- [elpa] externals/exwm 983fd46 02/19: Add missing declarations, Chris Feng, 2016/07/18
- [elpa] externals/exwm 35e1655 07/19: Move defvars to the top, Chris Feng, 2016/07/18
- [elpa] externals/exwm e491118 10/19: Support swapping workspaces, Chris Feng, 2016/07/18
- [elpa] externals/exwm 8e2da00 05/19: Add helper for counting number of workspaces, Chris Feng, 2016/07/18
- [elpa] externals/exwm 2de2d42 09/19: Factor out prompt for workspace,
Chris Feng <=
- [elpa] externals/exwm b51f3e6 18/19: Mention dynamic workspace in various places, Chris Feng, 2016/07/18
- [elpa] externals/exwm 2ebeec1 17/19: Adapt dynamic workspace for RandR module, Chris Feng, 2016/07/18
- [elpa] externals/exwm 4c9afc2 16/19: Adapt dynamic workspace for floating module, Chris Feng, 2016/07/18
- [elpa] externals/exwm 622618a 15/19: Improve the handling of workspaces, Chris Feng, 2016/07/18
- [elpa] externals/exwm 73d890a 14/19: Fix various minor issues, Chris Feng, 2016/07/18
- [elpa] externals/exwm 07120a0 08/19: Work with workspace frames instead of indices, Chris Feng, 2016/07/18
- [elpa] externals/exwm 0fbc725 12/19: Support adding and removing workspaces, Chris Feng, 2016/07/18
- [elpa] externals/exwm b409d87 19/19: Merge branch 'medranocalvo/dynamic-workspaces' into externals/exwm, Chris Feng, 2016/07/18