multi-scratch buffers based on mode as well as scratch buffer save/restore like persp-mode does for windows
This commit is contained in:
parent
075516e69f
commit
a6eb011afd
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -12,4 +12,5 @@ code/projects
|
|||
**/transient
|
||||
**/.org-id-locations
|
||||
**/xapian-lite.so
|
||||
**/projectile.cache
|
||||
**/projectile.cache
|
||||
**/.persistent-scratch*
|
|
@ -8,7 +8,7 @@
|
|||
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t) ; this goes in chemacs2 init -- DO NOT UNCOMMENT
|
||||
(package-initialize) ; this goes in chemacs2 init -- DO NOT UNCOMMENT
|
||||
(add-to-list 'package-selected-packages
|
||||
'(persp-mode rainbow-mode rainbow-delimiters markdown-mode devdocs devdocs-browser focus zoom popwin dired-single diredfl xclip doominhibitinhibit-modeline magit helpful helm helm-org helm-ls-git dired-rainbow dired-rainbow-listing dired-single dash s origami modus-themes use-package)
|
||||
'(scratch persistent-scratch persp-mode rainbow-mode rainbow-delimiters markdown-mode devdocs devdocs-browser focus zoom popwin dired-single diredfl xclip doominhibitinhibit-modeline magit helpful helm helm-org helm-ls-git dired-rainbow dired-rainbow-listing dired-single dash s origami modus-themes use-package)
|
||||
)
|
||||
(require 'use-package)
|
||||
|
||||
|
@ -422,7 +422,6 @@
|
|||
(progn
|
||||
(message "Flyspell on (text)")
|
||||
(flyspell-mode 1)))
|
||||
;; I tried putting (flyspell-buffer) here but it didn't seem to work
|
||||
)))
|
||||
(defun flyspell-toggle ()
|
||||
"Turn Flyspell on if it is off, or off if it is on. When turning on, it uses `flyspell-on-for-buffer-type' so code-vs-text is handled appropriately."
|
||||
|
@ -454,11 +453,9 @@
|
|||
(use-package popwin
|
||||
:bind ( :map popwin:keymap
|
||||
("h" . popwin:close-popup-window)
|
||||
("q" . kmn/popwin-quick-ref)
|
||||
("r" . kmn/popwin-scratch))
|
||||
("q" . kmn/popwin-quick-ref))
|
||||
:config
|
||||
(global-set-key (kbd "C-w") popwin:keymap)
|
||||
(push "*scratch*" popwin:special-display-config)
|
||||
(push "_quick_reference.org" popwin:special-display-config))
|
||||
|
||||
(popwin-mode 1)
|
||||
|
@ -486,3 +483,20 @@
|
|||
(setq wg-morph-on nil) ;; switch off animation
|
||||
(setq persp-autokill-buffer-on-remove 'kill-weak)
|
||||
(add-hook 'window-setup-hook #'(lambda () (persp-mode 1))))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; scratch buffer
|
||||
; set mode options -- borrowed from : https://emacsredux.com/blog/2014/07/25/configure-the-scratch-buffers-mode/
|
||||
; fundamental-mode / text-mode / org-mode
|
||||
(setq initial-major-mode 'text-mode)
|
||||
(setq initial-scratch-message "original scratch buffer")
|
||||
|
||||
; persistent-scratch (melpa)
|
||||
(persistent-scratch-autosave-mode 0)
|
||||
(global-set-key (kbd "C-c r S") 'persistent-scratch-save)
|
||||
(global-set-key (kbd "C-c r r") 'persistent-scratch-restore)
|
||||
(global-set-key (kbd "C-c r w") 'persistent-scratch-save-to-file)
|
||||
(global-set-key (kbd "C-c r l") 'persistent-scratch-restore-from-file)
|
||||
|
||||
; scratch.el (multi-scratch / melpa)
|
||||
(global-set-key (kbd "C-c r s") #'scratch) ; C-u C-c s s for mode prompt
|
||||
|
|
|
@ -41,16 +41,6 @@
|
|||
)
|
||||
)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; 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
|
||||
(defun kmn/popwin-quick-ref ()
|
||||
|
@ -60,13 +50,6 @@
|
|||
(when kmn/is-termux
|
||||
(popwin:find-file "~/storage/shared/org/_quick_reference.org")))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; scratch buffer as a pop up window
|
||||
(defun kmn/popwin-scratch ()
|
||||
(interactive)
|
||||
(popwin:display-buffer "*scratch*")
|
||||
)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; modern home/end via C-a and C-e
|
||||
(defun kmn/smart-beginning-of-line ()
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
(defun kmn/workspace-load-auto ()
|
||||
(interactive)
|
||||
(persp-load-state-from-file "persp-auto-save")
|
||||
(persistent-scratch-restore)
|
||||
)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
@ -13,6 +14,8 @@
|
|||
(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))
|
||||
)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
@ -20,6 +23,8 @@
|
|||
(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
|
||||
|
@ -28,6 +33,7 @@
|
|||
; start with fresh frame
|
||||
(delete-other-windows)
|
||||
(kmn/kill-other-buffers)
|
||||
(kill-buffer (get-buffer "*scratch*"))
|
||||
; front load org-agenda so it doesnt reshuffle the frame layout on us
|
||||
(org-agenda nil "r")
|
||||
(split-window-below)
|
||||
|
@ -70,7 +76,8 @@
|
|||
(interactive)
|
||||
(delete-other-windows)
|
||||
(kmn/kill-other-buffers)
|
||||
(kmn/show-buffer-scratch)
|
||||
(kill-buffer "*scratch*")
|
||||
(scratch 'text-mode)
|
||||
; show dired at `~` in left side window
|
||||
(kmn/dired-directory-on-left dir_path)
|
||||
)
|
||||
|
|
|
@ -5,24 +5,24 @@
|
|||
(global-set-key (kbd "C-c s") 'org-schedule)
|
||||
(global-set-key (kbd "C-c c") 'org-capture)
|
||||
(global-set-key (kbd "C-c z") 'org-attach)
|
||||
(global-set-key (kbd "C-c t")
|
||||
(global-set-key (kbd "C-c d t")
|
||||
(lambda () (interactive) (find-file "~/org/orgzly/_todo.org"))
|
||||
)
|
||||
(global-set-key (kbd "C-c s")
|
||||
(global-set-key (kbd "C-c d s")
|
||||
(lambda () (interactive) (find-file "~/org/orgzly/_slipbox.org"))
|
||||
)
|
||||
(global-set-key (kbd "C-c n")
|
||||
(global-set-key (kbd "C-c d n")
|
||||
(lambda () (interactive) (find-file "~/org/_index.org"))
|
||||
)
|
||||
(global-set-key (kbd "C-c h")
|
||||
(global-set-key (kbd "C-c d h")
|
||||
(lambda () (interactive) (find-file "~/org/health/_health.org"))
|
||||
)
|
||||
(global-set-key (kbd "C-c p")
|
||||
(global-set-key (kbd "C-c d p")
|
||||
(lambda () (interactive) (find-file "~/org/photography/_photography.org"))
|
||||
)
|
||||
(global-set-key (kbd "C-c r")
|
||||
(global-set-key (kbd "C-c d r")
|
||||
(lambda () (interactive) (find-file "~/org/culinary/_culinary.org"))
|
||||
)
|
||||
(global-set-key (kbd "C-c v")
|
||||
(global-set-key (kbd "C-c d v")
|
||||
(lambda () (interactive) (dired "~/org/Document_Archive"))
|
||||
)
|
||||
|
|
Reference in a new issue