Archived
1
0
Fork 0
This repository has been archived on 2024-10-19. You can view files and clone it, but cannot push or open issues or pull requests.
emacs/common/workspaces.el

144 lines
4.6 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))
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; org-mode workspace
(when (not kmn/is-dayjob)
(defun kmn/workspace-org ()
(interactive)
; start with fresh frame
(delete-other-windows)
(kmn/kill-other-buffers)
(ignore-errors (kill-buffer "*scratch*"))
; front load org-agenda so it doesnt reshuffle the frame layout on us
(org-agenda nil "r")
(split-window-below)
(next-multiframe-window)
; show kmn's slipbox
(find-file "~/org/orgzly/_slipbox.org")
; split window for additional file to show
(split-window-below)
(next-multiframe-window)
; show kmn health notes/data tracker
(find-file "~/org/health/health_mike.org")
; switch to top of agenda window so most useful window is focused
(next-multiframe-window)
(goto-char 0)
)
)
(when kmn/is-dayjob
(defun kmn/workspace-org ()
(interactive)
; start with fresh frame
(delete-other-windows)
(kmn/kill-other-buffers)
(ignore-errors (kill-buffer "*scratch*"))
; front load org-agenda so it doesnt reshuffle the frame layout on us
(org-agenda nil "r")
(split-window-below)
(next-multiframe-window)
; show slipbox
(find-file "~/org/_slipbox.org")
; split window for additional file to show
(split-window-below)
(next-multiframe-window)
(find-file "~/org/_habits.org")
(find-file "~/org/_todo.org")
(find-file "~/org/_index.org")
; switch to top of agenda window so most useful window is focused
(next-multiframe-window)
(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/health/health_houdini.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)
)
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; empty code workspace
(defun kmn/workspace-code-empty (&optional dir_path)
(interactive)
(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")
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; scratch buffers frame - use 'scratch and prompts to manage as needed
(defun kmn/workspace-frame-scratch()
(interactive)
(let ((frame (make-frame)))
(select-frame-set-input-focus frame)
(delete-other-windows)
(scratch 'text-mode)
)
)