From 488d89499c6bcc43e1432f327b4e71f681e87fff Mon Sep 17 00:00:00 2001 From: Vasilij Schneidermann Date: Fri, 22 May 2015 09:56:48 +0200 Subject: [PATCH] Don't hardcode initial choice for slot reading --- eyebrowse.el | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/eyebrowse.el b/eyebrowse.el index 1c28edd..6bc7fac 100644 --- a/eyebrowse.el +++ b/eyebrowse.el @@ -249,12 +249,12 @@ This function keeps the sortedness intact." (set-window-configuration window-config) (goto-char point))))) -(defun eyebrowse--read-slot () +(defun eyebrowse--read-slot (&optional initial-slot) (let* ((candidates (--map (number-to-string (car it)) (eyebrowse--get 'window-configs))) - (last-slot (number-to-string (eyebrowse--get 'last-slot))) - (selection (completing-read "Enter slot: " candidates - nil nil last-slot)) + (selection (completing-read + "Enter slot: " candidates + nil nil (and initial-slot (number-to-string initial-slot)))) (slot (string-to-number selection))) (unless (and (= slot 0) (not (string= selection "0"))) slot))) @@ -266,7 +266,7 @@ This will save the current window config to `eyebrowse-switch-back-and-forth' is t and `eyebrowse-current-slot' equals SLOT, this will switch to the last window config." - (interactive (list (eyebrowse--read-slot))) + (interactive (list (eyebrowse--read-slot (eyebrowse--get 'last-slot)))) (when slot (let ((current-slot (eyebrowse--get 'current-slot)) (last-slot (eyebrowse--get 'last-slot)))