emacs/common/workspaces.el

247 lines
7.9 KiB
EmacsLisp

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; various workspaces used day to day
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; load most recent auto save
(defun kmn/workspace-load-auto ()
(interactive)
(persp-load-state-from-file "persp-auto-save")
(persistent-scratch-restore)
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; save the current workspace to `latest` filename
(defun kmn/workspace-save-latest ()
(interactive)
(persp-save-state-to-file "latest")
(persistent-scratch-save-to-file
(expand-file-name ".persistent-scratch-latest" user-emacs-directory))
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; load `latest` file name to current workspace
(defun kmn/workspace-load-latest ()
(interactive)
(persp-load-state-from-file "latest")
(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)
(interactive)
(kmn/possibly-create-frame)
(delete-other-windows)
(centaur-tabs-mode t)
(setq src-sub-dir (concat "~/src/" src-sub-dir))
(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)
(defun kmn/workspace-org ()
(interactive)
(kmn/possibly-create-frame)
; start with fresh frame
(delete-other-windows)
(kmn/kill-other-buffers)
(ignore-errors (kill-buffer "*scratch*"))
; Open main files used as 'gateway' to everything else
(find-file "~/org/culinary/meal_plan.org")
(find-file "~/org/health/health_houdini.org")
(find-file "~/org/health/health_couples.org")
(find-file "~/org/health/health_mike.org")
(find-file "~/org/orgzly/_habits.org")
(find-file "~/org/orgzly/_todo.org")
(find-file "~/org/orgzly/_slipbox.org")
(find-file "~/org/_index.org")
; top window for habits/scheduled
(org-agenda nil "h")
(goto-char 0)
; main todo/slipbox
(split-window-below)
(next-multiframe-window)
(org-agenda nil "t")
(goto-char 0)
; show kmn health notes/data tracker
;(split-window-below)
;(next-multiframe-window)
;(find-file "~/org/health/health_mike.org")
;(goto-char 0)
; focus top most frame
(next-multiframe-window)
)
)
(when kmn/is-dayjob
(defun kmn/workspace-org ()
(interactive)
(kmn/possibly-create-frame)
; start with fresh frame
(delete-other-windows)
(kmn/kill-other-buffers)
(ignore-errors (kill-buffer "*scratch*"))
; show varied org files so their buffers exist prior to jumping in from org-agenda
(find-file "~/org/_habits.org")
(find-file "~/org/_index.org")
(find-file "~/org/_todo.org")
(find-file "~/org/_slipbox.org")
; front load org-agenda so it doesnt reshuffle the frame layout on us
(org-agenda nil "r")
; show scratch on right
(kmn/scratch-text-on-right)
; delete the current window (agenda triggers a vertical split on my computer, this undoes that non desired outcome)
(delete-window)
; switch to top of agenda window where i prefer to start my reading
(goto-char 0)
)
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; org-mode workspace for termux devices (mobile / android)
(when (not kmn/is-dayjob)
(defun kmn/workspace-org-single-window ()
(interactive)
; start with fresh frame
(delete-other-windows)
(kmn/kill-other-buffers)
(ignore-errors (kill-buffer "*scratch*"))
; Open main files used as 'gateway' to everything else
(find-file "~/org/culinary/meal_plan.org")
(find-file "~/org/health/health_houdini.org")
(find-file "~/org/health/health_couples.org")
(find-file "~/org/health/health_mike.org")
(find-file "~/org/orgzly/_habits.org")
(find-file "~/org/orgzly/_todo.org")
(find-file "~/org/orgzly/_slipbox.org")
(find-file "~/org/_index.org")
; Personal startup screen - orgmode agenda with all TODO
(org-agenda nil "r")
; start at the top of the agenda
(goto-char 0)
)
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; org-mode workspace for general kb work that doesnt use the agenda
(when (not kmn/is-dayjob)
(defun kmn/workspace-org-index ()
(interactive)
(kmn/possibly-create-frame)
; start with fresh frame
(delete-other-windows)
; setup scratch on right
(kmn/scratch-text-on-right)
(goto-char 0)
; Open main files used as 'gateway' to everything else
(find-file "~/org/_index.org")
(goto-char 0)
)
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; org-mode workspace for culinary work that doesnt use the agenda
(when (not kmn/is-dayjob)
(defun kmn/workspace-org-culinary ()
(interactive)
(kmn/possibly-create-frame)
; start with fresh frame
(delete-other-windows)
; setup scratch on right
(kmn/scratch-text-on-left)
(goto-char 0)
; Open main files used as 'gateway' to everything else
(find-file "~/org/culinary/_culinary.org")
(goto-char 0)
)
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; empty code workspace
(defun kmn/workspace-code-empty (&optional dir_path)
(interactive)
(kmn/possibly-create-frame)
(delete-other-windows)
(kmn/kill-other-buffers)
(ignore-errors (kill-buffer "*scratch*"))
(scratch 'text-mode)
; show dired at `~` in left side window
(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")
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; warframe game workspace
(defun kmn/workspace-game-warframe ()
(interactive)
(let ((frame (make-frame)))
(select-frame-set-input-focus frame)
(delete-other-windows)
(find-file "~/org/games/_games.org")
(find-file "~/org/games/games_warframe.org")
(goto-char 0)
)
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; destiny game workspace
(defun kmn/workspace-game-destiny ()
(interactive)
(let ((frame (make-frame)))
(select-frame-set-input-focus frame)
(delete-other-windows)
(find-file "~/org/games/_games.org")
(find-file "~/org/games/games_destiny.org")
(goto-char 0)
)
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; _global.el for scratch workspace definitions