diff --git a/common/generic_functions.el b/common/generic_functions.el index b6f51aa..aec6f7d 100644 --- a/common/generic_functions.el +++ b/common/generic_functions.el @@ -21,10 +21,10 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; open dired with default directory in left side window -(defun kmn/dired-directory-on-left (&optional dir_path) +(defun kmn/dired-directory-on-left (&optional dir_path no-win no-del-o-win slot-num) (defvar parameters - '(window-parameters . ((no-other-window . t) - (no-delete-other-windows . t)))) + '(window-parameters . ((no-other-window . ,(or no-win (setq no-win t))) + (no-delete-other-windows . ,(or no-del-o-win (setq no-del-o-win t)))))) (setq fit-window-to-buffer-horizontally t) (setq window-resize-pixelwise t) @@ -34,7 +34,52 @@ (let ((buffer (dired-noselect (or dir_path (setq dir_path default-directory))))) (with-current-buffer buffer (dired-hide-details-mode t)) (display-buffer-in-side-window - buffer `((side . left) (slot . -1) + buffer `((side . left) (slot . ,(or slot-num (setq slot-num -1))) + (window-width . fit-window-to-buffer) + , parameters) + ) + ) +) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; open eshell in left side window +(defun kmn/eshell-on-left (&optional shell-directory no-win no-del-o-win slot-num) + (defvar parameters + '(window-parameters . ((no-other-window . ,(or no-win (setq no-win t))) + (no-delete-other-windows . ,(or no-del-o-win (setq no-del-o-win t)))))) + + (setq fit-window-to-buffer-horizontally t) + (setq window-resize-pixelwise t) + (setq default-directory (or shell-directory (setq shell-directory default-directory))) + + (interactive) + (let ((buffer (eshell))) + (display-buffer-in-side-window + buffer `((side . left) (slot . ,(or slot-num (setq slot-num -1))) + (window-width . fit-window-to-buffer) + , parameters) + ) + ) +) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; open eww in right side window +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; open eww in right side window +(defun kmn/eww-on-right (url &optional no-win no-del-o-win slot-num) + (defvar parameters + '(window-parameters . ((no-other-window . ,(or no-win (setq no-win t))) + (no-delete-other-windows . ,(or no-del-o-win (setq no-del-o-win t)))))) + + (setq fit-window-to-buffer-horizontally t) + (setq window-resize-pixelwise t) + + (interactive) + (eww url) + (let ((buffer (current-buffer))) + (previous-buffer) + (display-buffer-in-side-window + buffer `((side . right) (slot . ,(or slot-num (setq slot-num -1))) (window-width . fit-window-to-buffer) , parameters) ) diff --git a/common/workspaces.el b/common/workspaces.el index 55ca5c1..6b361cc 100644 --- a/common/workspaces.el +++ b/common/workspaces.el @@ -26,6 +26,43 @@ (persistent-scratch-restore-from-file (expand-file-name ".persistent-scratch-latest" user-emacs-directory)) ) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Reusable hugo dev workspace +(defun kmn/workspace-hugo-generic (src-sub-dir) + (delete-other-windows) + (centaur-tabs-mode t) + (setq src-sub-dir (concat "~/src/" src-sub-dir)) + (interactive) + (kmn/dired-directory-on-left src-sub-dir nil nil -1) + (kmn/eshell-on-left src-sub-dir nil nil 0) + (kmn/eww-on-right "http://localhost:1313") +) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Hugo blog workspace +(defun kmn/workspace-hugo-blog () + (interactive) + (kmn/workspace-hugo-generic "blog.kemonine.info") + (find-file "~/org/blog/_blog.org") +) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Hugo accessible.tips workspace +(defun kmn/workspace-hugo-accessible-tips () + (interactive) + (kmn/workspace-hugo-generic "accessible.tips") +) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Hugo culinary.kemonine.info workspace +(defun kmn/workspace-hugo-culinary () + (interactive) + (kmn/workspace-hugo-generic "culinary") + (find-file "~/org/culinary/_culinary.org") + (find-file "~/org/culinary/_recipes.org") +) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; org-mode workspace (when (not kmn/is-dayjob)