summaryrefslogtreecommitdiff
path: root/lisp/ss-org.el
blob: 4bbd92df81bbd276f61de22db81d7069df53f0ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
;;; ss-org.el --- Base Org configuration -*- lexical-binding: t; -*-

;;; Commentary:

;; Shared Org setup and note-opening helpers.

;;; Code:

(require 'ss-core)

(defun ss-open-journal ()
  "Open `ss-journal-file', narrowing to today's entry when it exists."
  (interactive)
  (find-file (ss-require-existing-file ss-journal-file))
  (widen)
  (unless (fboundp 'ss-journal-goto-date)
    (goto-char (point-max)))
  (when (fboundp 'ss-journal-goto-date)
    (if (ss-journal-goto-date)
        (progn
          (org-fold-show-entry)
          (org-fold-show-subtree)
          (org-narrow-to-subtree))
      (goto-char (point-max)))))

(defun ss-open-journal-full ()
  "Open `ss-journal-file' with the full buffer visible."
  (interactive)
  (find-file (ss-require-existing-file ss-journal-file))
  (widen))

(defun ss-open-moc ()
  "Open the central MOC note."
  (interactive)
  (find-file (ss-require-existing-file ss-moc-file)))

(defun ss-org-setup ()
  "Initialize base Org configuration."
  (use-package org
    :ensure nil
    :config
    (setq org-directory ss-org-directory
          org-hide-emphasis-markers t
          org-agenda-search-headline-for-time t)
    (add-hook 'org-mode-hook
              (lambda ()
                (setq-local org-hide-emphasis-markers t)
                (font-lock-flush)
                (font-lock-ensure))))

  (use-package git-auto-commit-mode
    :ensure t
    :pin melpa
    :commands (git-auto-commit-mode)
    :init
    (setq gac-shell-and
          (if (string-match-p "fish\\'" shell-file-name)
              " ; and "
            " && ")))

  (add-hook 'emacs-startup-hook
            (lambda ()
              (find-file (ss-require-existing-file ss-moc-file)))))

(provide 'ss-org)

;;; ss-org.el ends here