further implementation of work spaces ; make kill-other-buffers function take dired buffers into account for additional cleanup when switching workspaces
This commit is contained in:
parent
ae4c4426cf
commit
4b9d4acb0c
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
; open dired with default directory in left side window
|
; open dired with default directory in left side window
|
||||||
(defun kmn/dired-default-directory-on-left ()
|
(defun kmn/dired-directory-on-left (&optional dir_path)
|
||||||
(defvar parameters
|
(defvar parameters
|
||||||
'(window-parameters . ((no-other-window . t)
|
'(window-parameters . ((no-other-window . t)
|
||||||
(no-delete-other-windows . t))))
|
(no-delete-other-windows . t))))
|
||||||
|
@ -30,7 +30,7 @@
|
||||||
|
|
||||||
"Display `default-directory' in side window on left, hiding details."
|
"Display `default-directory' in side window on left, hiding details."
|
||||||
(interactive)
|
(interactive)
|
||||||
(let ((buffer (dired-noselect default-directory)))
|
(let ((buffer (dired-noselect (or dir_path (setq dir_path default-directory)))))
|
||||||
(with-current-buffer buffer (dired-hide-details-mode t))
|
(with-current-buffer buffer (dired-hide-details-mode t))
|
||||||
(display-buffer-in-side-window
|
(display-buffer-in-side-window
|
||||||
buffer `((side . left) (slot . -1)
|
buffer `((side . left) (slot . -1)
|
||||||
|
@ -40,6 +40,16 @@
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
; show scratch buffer
|
||||||
|
(defun kmn/show-buffer-scratch ()
|
||||||
|
(interactive)
|
||||||
|
; start with scratch buffer active
|
||||||
|
(switch-to-buffer (get-buffer "*scratch*"))
|
||||||
|
; default scratch buffer has 2 comments @ top of file, jump past them
|
||||||
|
(with-no-warnings (goto-line 3))
|
||||||
|
)
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
; quick reference notes as a pop up window
|
; quick reference notes as a pop up window
|
||||||
(defun kmn/popwin-quick-ref ()
|
(defun kmn/popwin-quick-ref ()
|
||||||
|
@ -80,8 +90,15 @@ position between last non-whitespace and `end-of-line'."
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
; function to kill all non special, non active buffers
|
; function to kill all non special, non active buffers
|
||||||
(defun kmn/kill-other-buffers ()
|
(defun kmn/kill-other-buffers ()
|
||||||
"Kill all buffers but the current one. Don't mess with special buffers."
|
"Kill all buffers but the current one. Don't mess with special buffers. Kill dired buffers"
|
||||||
(interactive)
|
(interactive)
|
||||||
|
; dired buffer cleanup
|
||||||
|
(mapc
|
||||||
|
(lambda (buffer)
|
||||||
|
(when (eq 'dired-mode (buffer-local-value 'major-mode buffer))
|
||||||
|
(kill-buffer buffer)))
|
||||||
|
(buffer-list))
|
||||||
|
; non special buffer cleanup
|
||||||
(dolist (buffer (buffer-list))
|
(dolist (buffer (buffer-list))
|
||||||
(unless (or (eql buffer (current-buffer)) (not (buffer-file-name buffer)))
|
(unless (or (eql buffer (current-buffer)) (not (buffer-file-name buffer)))
|
||||||
(kill-buffer buffer))))
|
(kill-buffer buffer))))
|
||||||
|
|
|
@ -44,13 +44,30 @@
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
; empty code workspace
|
; empty code workspace
|
||||||
(defun kmn/workspace-code-empty ()
|
(defun kmn/workspace-code-empty (&optional dir_path)
|
||||||
(interactive)
|
(interactive)
|
||||||
(delete-other-windows)
|
(delete-other-windows)
|
||||||
; start with scratch buffer active
|
(kmn/kill-other-buffers)
|
||||||
(switch-to-buffer (get-buffer "*scratch*"))
|
(kmn/show-buffer-scratch)
|
||||||
; default scratch buffer has 2 comments @ top of file, jump past them
|
|
||||||
(with-no-warnings (goto-line 3))
|
|
||||||
; show dired at `~` in left side window
|
; show dired at `~` in left side window
|
||||||
(kmn/dired-default-directory-on-left)
|
(kmn/dired-directory-on-left dir_path)
|
||||||
|
)
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
; emacs config development
|
||||||
|
(defun kmn/workspace-code-emacs-config()
|
||||||
|
(interactive)
|
||||||
|
(kmn/workspace-code-empty "~/.emacs.d.profiles")
|
||||||
|
(find-file "~/.emacs.d.profiles/org/init.el")
|
||||||
|
(find-file "~/.emacs.d.profiles/code/init.el")
|
||||||
|
(find-file "~/.emacs.d.profiles/common/_global.el")
|
||||||
|
(find-file "~/.emacs.d.profiles/common/generic_functions.el")
|
||||||
|
(find-file "~/.emacs.d.profiles/common/workspaces.el")
|
||||||
|
)
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
; hugo development
|
||||||
|
(defun kmn/workspace-code-generic()
|
||||||
|
(interactive)
|
||||||
|
(kmn/workspace-code-empty "~/src")
|
||||||
)
|
)
|
||||||
|
|
Reference in a new issue