Archived
1
0
Fork 0

clean up org agendas, tune auto-start layout for org-mode profile ; add auto-uuid generator for org-mode files ; add method for opening a dired side panel

This commit is contained in:
KemoNine 2023-04-07 17:10:23 -04:00
parent 225249290d
commit d54f4e23eb
4 changed files with 48 additions and 26 deletions

View file

@ -17,6 +17,26 @@
(setq kmn/is-termux (setq kmn/is-termux
(string-suffix-p "Android" (string-trim (shell-command-to-string "uname -a")))) (string-suffix-p "Android" (string-trim (shell-command-to-string "uname -a"))))
(defun kmn/dired-default-directory-on-left ()
(defvar parameters
'(window-parameters . ((no-other-window . t)
(no-delete-other-windows . t))))
(setq fit-window-to-buffer-horizontally t)
(setq window-resize-pixelwise t)
"Display `default-directory' in side window on left, hiding details."
(interactive)
(let ((buffer (dired-noselect default-directory)))
(with-current-buffer buffer (dired-hide-details-mode t))
(display-buffer-in-side-window
buffer `((side . left) (slot . -1)
(window-width . fit-window-to-buffer)
(preserve-size . (t . nil)) , parameters)
)
)
)
; ensure elisp plugins are compiled ; ensure elisp plugins are compiled
(require 'dash) (require 'dash)
(require 'f) (require 'f)
@ -68,6 +88,8 @@
;; (setq dired-x-hands-off-my-keys nil) ;; (setq dired-x-hands-off-my-keys nil)
) )
(require 'dired-single) (require 'dired-single)
(setq dired-single-use-magic-buffer t)
(setq dired-single-magic-buffer-name "dired - main")
; open dirs in same dired window + open files in main window ; open dirs in same dired window + open files in main window
; facilitates static file browser sidebar ; facilitates static file browser sidebar

View file

@ -10,36 +10,17 @@
; - common org files open in the bottom window ; - common org files open in the bottom window
(add-hook 'after-init-hook (lambda () (add-hook 'after-init-hook (lambda ()
(interactive) (interactive)
(find-file "~/org/health/health_houdini.org")
(find-file "~/org/orgzly/_habits.org")
(find-file "~/org/orgzly/_todo.org")
(find-file "~/org/_index.org")
(org-agenda nil "r") (org-agenda nil "r")
(set-window-dedicated-p (selected-window) "t")
(delete-other-windows) (delete-other-windows)
(split-window-below 15) (split-window-below 15)
(next-multiframe-window) (next-multiframe-window)
(find-file "~/org/orgzly/_habits.org") (find-file "~/org/health/health_mike.org")
(find-file "~/org/orgzly/_todo.org") (split-window-below 15)
(next-multiframe-window)
(find-file "~/org/orgzly/_slipbox.org") (find-file "~/org/orgzly/_slipbox.org")
(find-file "~/org/_index.org")
) )
) )
; Make sure emacs and org don't keep opening new windows (Desktop)
(setq pop-up-windows nil)
(setq inhibit-same-window nil)
(setq inhibit-switch-frame nil)
(setq split-height-threshold 200)
(setq split-width-threshold 200)
(defun my-display-buffer-function (buf not-this-window)
(if (and (not pop-up-frames)
(one-window-p)
(or not-this-window
(not (eq (window-buffer (selected-window)) buf)))
(> (frame-width) 162))
(split-window-horizontally))
;; Note: Some modules sets `pop-up-windows' to t before calling
;; `display-buffer' -- Why, oh, why!
(let ((display-buffer-function nil)
(pop-up-windows nil))
(display-buffer buf nil)))
(setq display-buffer-function 'my-display-buffer-function)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

View file

@ -2,6 +2,8 @@
;; /data/data/com.termux/files/home/storage/shared/.emacs ;; /data/data/com.termux/files/home/storage/shared/.emacs
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Open main files used as 'gateway' to everything else (Mobile) ; Open main files used as 'gateway' to everything else (Mobile)
(find-file "~/org/health/health_houdini.org")
(find-file "~/org/health/health_mike.org")
(find-file "~/storage/shared/org/orgzly/_habits.org") (find-file "~/storage/shared/org/orgzly/_habits.org")
(find-file "~/storage/shared/org/orgzly/_todo.org") (find-file "~/storage/shared/org/orgzly/_todo.org")
(find-file "~/storage/shared/org/orgzly/_slipbox.org" (find-file "~/storage/shared/org/orgzly/_slipbox.org"

View file

@ -109,6 +109,23 @@
(setq org-log-into-drawer t) (setq org-log-into-drawer t)
(setq org-log-done t) (setq org-log-done t)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; automatic ids for everything
; From https://web.archive.org/web/20220512120917/https://stackoverflow.com/questions/13340616/assign-ids-to-every-entry-in-org-mode
; This hunk of lisp automatically adds IDs to every header in an org file when you hit save. it usese org-id which can generated IDs of various types including timestamps. Im using the default UUIDs
(defun stackoverflow/org-add-ids-to-headlines-in-file ()
"cargo cult from stackoverflow to add ids"
(interactive)
(save-excursion
(goto-char (point-max))
(while (outline-previous-heading)
(org-id-get-create)))
)
(add-hook 'org-mode-hook
(lambda ()
(add-hook 'before-save-hook 'stackoverflow/org-add-ids-to-headlines-in-file nil 'local)))
(add-hook 'org-capture-prepare-finalize-hook 'org-id-get-create)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; ox-hugo for blog ; ox-hugo for blog
(with-eval-after-load 'ox (require 'ox-hugo)) (with-eval-after-load 'ox (require 'ox-hugo))