From de4e3d7654bf97cdae844d16c6ff5408698539ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Sat, 31 Dec 2022 02:02:01 +0100 Subject: Update eb.el --- eb.el | 31 +++++++++++++++++++++++++++++-- 1 file 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) @@ -309,6 +329,12 @@ (when (eql (point) (point-min)) (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'." @@ -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) -- cgit v1.2.3