aboutsummaryrefslogtreecommitdiff
path: root/eb.el
diff options
context:
space:
mode:
Diffstat (limited to 'eb.el')
-rw-r--r--eb.el31
1 files changed, 29 insertions, 2 deletions
diff --git a/eb.el b/eb.el
index e41d35d..93eae3d 100644
--- a/eb.el
+++ b/eb.el
@@ -137,6 +137,25 @@
(quit-window)
(bury-buffer)))
+(defvar eb--last-seconds 0)
+(defvar eb--last-window-configuration nil)
+
+;;;###autoload
+(defun eb-quit-or-bury-or-delete-other-windows ()
+ "Quit window or bury buffer. If activated twice in rapid
+succession, delete other windows instead."
+ (interactive)
+ (let ((seconds (car (time-convert nil 100))))
+ (if (< (- seconds eb--last-seconds) 20)
+ (progn
+ (set-window-configuration eb--last-window-configuration)
+ (delete-other-windows))
+ (setq eb--last-window-configuration (current-window-configuration))
+ (if (window-parameter (selected-window) 'quit-restore)
+ (quit-window)
+ (bury-buffer)))
+ (setq eb--last-seconds seconds)))
+
;;;###autoload
(defun eb-exhume-buffer ()
"Switch to last buffer in the buffer list."
@@ -193,6 +212,7 @@
(switch-to-buffer buffer)
(eb--fleeting-window left buffer
(progn
+ (setq default-directory dir)
(setq eb--dired-truncate-lines--orig truncate-lines)
(setq eb--dired-hide-details-mode--orig dired-hide-details-mode)
(setq eb--dired-truncate-headers-mode--orig eb--dired-truncate-headers-mode)
@@ -310,6 +330,12 @@
(goto-char (point-max)))))
;;;###autoload
+(defun eb-vs ()
+ "Open project in Visual Studio."
+ (interactive)
+ (w32-shell-execute "open" (concat (eb--cmake-path) "EpisodeBrowser.sln")))
+
+;;;###autoload
(defun eb-check ()
"Toggle `flycheck-list-errors'."
(interactive)
@@ -353,8 +379,8 @@
(let ((map (make-sparse-keymap)))
;; Windows, buffers and files.
- (tool-bar-local-item "cancel" #'eb-quit-or-bury 'quit-or-bury map
- :label "Bury" :help "Bury buffer or window")
+ (tool-bar-local-item "cancel" #'eb-quit-or-bury-or-delete-other-windows 'quit-or-bury map
+ :label "Bury" :help "Bury buffer or window (double-click to delete other windows)")
(define-key map [(shift quit-or-bury)] #'eb-exhume-buffer)
(define-key map [(control quit-or-bury)] #'delete-other-windows)
(tool-bar-local-item "index" #'eb-list-buffers 'list-buffers map
@@ -374,6 +400,7 @@
:label "Run" :help "Run executable")
(tool-bar-local-item "refresh" #'eb-compile 'compile map
:label "Compile" :help "Compile project")
+ (define-key map [(shift compile)] #'eb-vs)
(tool-bar-local-item "spell" #'eb-check 'check map
:label "Check" :help "Check warnings and errors")
(define-key map [(shift check)] #'flycheck-buffer)