Switching from nextcloud for syncing to github

This commit is contained in:
James Patrick 2024-07-11 23:22:09 -04:00
parent e7eb0cf56e
commit f46c37cf6b
No known key found for this signature in database
4 changed files with 92 additions and 24 deletions

View File

@ -8,9 +8,11 @@
(setq org-download-image-dir (concat org-directory ".attach/"))
(setq org-roam-directory (concat org-directory "Roam/"))
(setq org-roam-directory (concat org-directory "roam"))
(setq org-agenda-files (list (concat org-directory "Todos/" )))
(setq org-agenda-files (list (concat org-directory "todo" )))
(setq org-roam-dailies-directory (concat org-directory "journals/"))
(defvar-local +org-capture-work-todo-file
(expand-file-name "Work/todo.org" org-directory))
@ -19,6 +21,19 @@
(file+headline +org-capture-work-todo-file "Inbox")
"* [_] %i%?\n%a -  %u" :prepend t))
(use-package! git-auto-commit-mode
:config
(setq-default gac-automatically-push-p t)
(setq-default gac-automatically-add-new-files-p t)
(defun gac-pull-before-push (&rest _args)
(let ((current-file (buffer-file-name)))
(shell-command "git pull")
(when current-file
(with-current-buffer (find-buffer-visiting current-file)
(revert-buffer t t t)))))
(advice-add 'gac-push :before #'gac-pull-before-push))
(add-hook! 'org-mode-hook #'mixed-pitch-mode)
(add-hook! 'org-mode-hook #'+org-pretty-mode)

View File

@ -1,3 +1,8 @@
;;; -*- lexical-binding: t; -*-
;;; This file is generated via tangles from the config.org file. Do not modify this file.
;;; Any modifications here will be clobbered and versioned over. Seriously just don't.
;;; -*- lexical-binding: t; -*-
;;; This file is generated via tangles from the config.org file. Do not modify this file.
;;; Any modifications here will be clobbered and versioned over. Seriously just don't.

View File

@ -627,15 +627,14 @@ This file will be needed for emacs batch automation, where its not reasonable to
#+begin_src emacs-lisp :tangle "config.el" :noweb no-export :comments no
(load! "+orgmode")
#+end_src
** Importing org
This file may get consumed via emacs batch scripting, so we need ot make sure the orgmode is actually loaded.
#+begin_src emacs-lisp :tangle "+orgmode.el" :noweb no-export :comments no
(require 'org)
#+end_src
** Directories
My notes are stored via [[https://nextcloud.com/][NextCloud]] to sync multiple machines. The Nextcloud directory can be located in a couple different location based off the OS that the machine is running, but where the NextCloud general sync directory may vary based on machine but notes should always be stored at =$HOME/org=.
Notes are stored in the =$HOME/org= directory, and are synced to GitHub. See [[*Syncing][Syncing]] for more on this.
#+begin_src emacs-lisp :tangle "+orgmode.el" :noweb no-export :comments no
(custom-set-variables '(org-directory "~/org/"))
@ -647,43 +646,48 @@ I've tried to organize things based on purpose & this will likely change in the
~/org
├── .archive
├── .attach
├── Projects
├── Roam
├── Todo
└── Work
├── README.org
├── _logseq
├── journals
├── projects
├── roam
└── work
#+end_example
*** =.archive=
Where old files go. See =org-archive-subtree= for more.
*** =.attach=
Stuff that is not an orgmode document.
This is things that aren't orgmode files, but should be included in an orgmode file. Tangled scripts, images, etc.
#+begin_src emacs-lisp :tangle "+orgmode.el" :noweb no-export :comments no
(setq org-download-image-dir (concat org-directory ".attach/"))
#+end_src
*** =Projects=
I keep a =todo.org= at the root of each project. These are symlinked into the Projects directory. Nextcloud does not sync symlinked documents.
*** =Roam=
All roam docs go here. This is my default note taking system.
#+begin_src emacs-lisp :tangle "+orgmode.el" :noweb no-export :comments no
(setq org-roam-directory (concat org-directory "Roam/"))
#+end_src
*** =Todo=
Another symlink dir. This is used to populate org agenda files.
*** =roam=
[[https://www.orgroam.com/][org-roam]] is a great Zettelkasten toolkit with back link graphing. I'll try to store as much of my written notes in this format.
#+begin_src emacs-lisp :tangle "+orgmode.el" :noweb no-export :comments no
(setq org-agenda-files (list (concat org-directory "Todos/" )))
(setq org-roam-directory (concat org-directory "roam"))
#+end_src
*** =todo=
Incomplete list of todo files as there is always more.
#+begin_src emacs-lisp :tangle "+orgmode.el" :noweb no-export :comments no
(setq org-agenda-files (list (concat org-directory "todo" )))
#+end_src
*** Journals
Dailies. This is also handled by Org-roam.
#+begin_src emacs-lisp :tangle "+orgmode.el" :noweb no-export :comments no
(setq org-roam-dailies-directory (concat org-directory "journals/"))
#+end_src
*** =Work=
On my work machine I'll symlink this into my =Todo=
#+begin_src bash :tangle no
ln -s $HOME/org/Work/todo.org $HOME/org/Todo/work.org
#+end_src
I still want to capture work related notes where ever I am though.
#+begin_src emacs-lisp :tangle "+orgmode.el" :noweb no-export :comments no
@ -695,6 +699,48 @@ I still want to capture work related notes where ever I am though.
"* [_] %i%?\n%a -  %u" :prepend t))
#+end_src
** Syncing
Syncing of the ~org-directory~ is done via git with remote of https://github.com/jamesepatrick/notes. Changes are auto-committed & pushed using [[https://github.com/ryuslash/git-auto-commit-mode][git-auto-commit-mode]] in Emacs & [[https://workingcopy.app/][Working Copy]] with iOS Shortcuts on iOS.
Grab the package from MELPA
#+begin_src emacs-lisp :tangle "packages.el" :noweb no-export :comments no :results output silent
(package! git-auto-commit-mode)
#+end_src
For configuring it we'll want the following settings:
- =gac-automatically-push-p= :: Automatically push new changes.
- =gac-automatically-add-new-files-p= :: Automatically add new files.
Additionally we'll also want to add a big of additional logic so that we will automatically pull changes as well. It may be worth setting up a crontab to automate the pull in the future.
This snippet below is from siatwe's comment [[https://github.com/ryuslash/git-auto-commit-mode/pull/40#issuecomment-1772237807][here]].
#+begin_src emacs-lisp :tangle "+orgmode.el" :noweb no-export :comments no
(use-package! git-auto-commit-mode
:config
(setq-default gac-automatically-push-p t)
(setq-default gac-automatically-add-new-files-p t)
(defun gac-pull-before-push (&rest _args)
(let ((current-file (buffer-file-name)))
(shell-command "git pull")
(when current-file
(with-current-buffer (find-buffer-visiting current-file)
(revert-buffer t t t)))))
(advice-add 'gac-push :before #'gac-pull-before-push))
#+end_src
Configuring should be done at the at the [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Directory-Variables.html#Directory-Variables][per directory level]]. The following snippet should be placed at =$HOME/org/.dir-locals.el=.
#+begin_src emacs-lisp :tangle no :comments no :results output silent
((nil . ((eval git-auto-commit-mode 1)
(gac-automatically-push-p t)
(gac-automatically-add-new-files-p t))))
#+end_src
** A Prettier Orgmode
*** Use a serif variable font
This uses =doom-variable-pitch-font= as defined in the font section.

View File

@ -2,6 +2,8 @@
;;; This file is generated via tangles from the config.org file. Do not modify this file.
;;; Any modifications here will be clobbered and versioned over. Seriously just don't.
(package! git-auto-commit-mode)
(package! ob-mermaid)
(package! ox-tufte)