summaryrefslogblamecommitdiff
path: root/emacs/custom/fcuny-org.el
blob: d993f0b3cd79228b74e3aa1ea8bc91672d3d2dd2 (plain) (tree)
1
2
3
4
5
6
7
8
9
10







                           

                     











                                                 


                                                        


                                              


                                                       
                    

            

                





                                                                   
 
                                

                                
         


                                               





                                                        
 
         
                                     
 



                                                     
                         
 
                               

                      

                          


                               
                                                                                



                                                      
 

                                                                                    


                                                                     
 
                   

                                                                                                                    
                                                    



                                                      






                                                              
 




                                                                                   


                                  

                                               

                                       

                                        




                                                    
 
            
                                  
                                                     
                                                                                
 

                                                     
 
                             
 



                        
                        




                                                                                                           
                                                               


                                                             
                                                               


                                                                         
                                                               
                                
                                                                          


                                                               



                                                                                                   
                                                               


                                                             
                                                               
                                

                                                                         





                                                                           
                                



                                                                           
                                       
 
                    
(require 'fcuny-org-custom)

(use-package org-ml
  :ensure t)

(use-package doct
  :ensure t)

(require 'fcuny-vars)

(defvar fcuny/org-directory
  (expand-file-name "~/workspace/notebooks"))

(defvar fcuny/org-inbox-file
  (concat fcuny/org-directory "/inbox.org"))

(defvar fcuny/org-references-file
  (concat fcuny/org-directory "/references.org"))

(defvar fcuny/org-personal-notes-file
  (concat fcuny/org-directory "/personal.org"))

(defvar fcuny/org-personal-journal-file
  (concat fcuny/org-directory "/journals/personal.org"))

(defvar fcuny/org-work-notes-file
  (concat fcuny/org-directory "/twitter.org"))

(defvar fcuny/org-work-journal-file
  (concat fcuny/org-directory "/journals/twitter.org"))

(use-package htmlize
  :ensure t)

(use-package org
  :ensure t
  :mode (("\\.txt\\'" . org-mode))
  :hook ((org-mode                     . org-indent-mode)
         (org-mode                     . org-hide-block-all)
         (org-mode                     . visual-line-mode)
         (org-capture-after-finalize   . org-save-all-org-buffers)
         (org-capture-prepare-finalize . org-save-all-org-buffers))

  :bind (("C-c c" . org-capture)
         ("C-c a" . org-agenda))

  :config
  (defvar load-language-list '((emacs-lisp . t)
                               (python . t)
                               (shell . t)))
  (use-package ob-go
    :ensure t
    :init (cl-pushnew '(go . t) load-language-list))

  (org-babel-do-load-languages 'org-babel-load-languages
                               load-language-list)

  :custom
  (org-directory fcuny/org-directory)

  ;; when archiving, inherit the tags from the parent
  (org-archive-subtree-add-inherited-tags t)

  ;; display unicode characters
  (org-pretty-entities t)

  ;; log the time of completion
  (org-log-done 'time)

  (org-startup-indented t)

  (org-ellipsis "↴")
  (org-cycle-separator-lines 0)
  (org-startup-folded 'content)
  (org-todo-keywords '((type "TODO" "STARTED" "WAITING" "|" "DONE" "CANCELED")))
  (org-todo-keyword-faces
   '(("TODO" . (:foreground "red" :weight bold))
     ("STARTED" . (:foreground "red" :weight bold))
     ("WAITING" . (:foreground "blue" :weight bold))))

  ;; priorities
  (org-priority-start-cycle-with-default nil) ;; Start one over/under default value.
  (org-highest-priority ?1)
  (org-lowest-priority ?4)
  (org-default-priority ?3) ;; Ensures unset tasks have low priority.

  ;; agenda related
  (calendar-week-start-day 1)      ;; org-mode uses calendar for the date picker, and I want this to start on Monday
  (org-agenda-start-on-weekday 1)  ;; this is specific to org-agenda
  (org-agenda-files `(,fcuny/org-personal-notes-file
                      ,fcuny/org-personal-journal-file
                      ,fcuny/org-work-notes-file
                      ,fcuny/org-work-journal-file
                      ,fcuny/org-references-file))

  ;; refile
  (org-refile-use-cache nil)
  (org-refile-targets '((org-agenda-files . (:maxlevel . 6))))
  (org-refile-use-outline-path 'file)
  (org-outline-path-complete-in-steps nil)
  (org-refile-allow-creating-parent-nodes 'confirm)

  ;; org babel related
  ;; prevent the conversion of spaces into tabs (necessary for Python code exports)
  (org-src-fontify-natively t)
  (org-src-preserve-indentation t)
  (org-edit-src-content-indentation t)

  ;; I want to follow links on RET
  (org-return-follows-link t)

  ;; some configurations for exporting document
  (org-export-with-toc nil)
  (org-export-with-section-numbers nil)

  ;; A few abbreviations I use regularly
  (org-link-abbrev-alist
   '(("src"  . "~/workspace/%s")
     ("jira" . "https://jira.twitter.biz/browse/%s")
     ("ph"   . "https://phabricator.twitter.biz/%s")
     ("go"   . "http://go/%s")))

  ;; entries
  (org-blank-before-new-entry nil)
  (org-blank-before-new-entry (quote ((heading . nil)
				                      (plain-list-item . nil))))

  ;; see https://github.com/abo-abo/swiper/issues/986
  (org-goto-interface 'outline-path-completion)

  (org-reverse-note-order t))

(use-package org-capture
  :ensure nil
  :after (org doct)
  :custom
  (org-capture-templates
   (doct `(:group
           :children
           (("Personal" :keys "p" :file fcuny/org-personal-notes-file :clock-in t :clock-resume t :children
             (("Task" :keys "t" :todo-state "TODO" :headline "Tasks"
               :template ("* %{todo-state} [#3] %^{Description}"
                          ":PROPERTIES:" ":CREATED: %T" ":END:"
                          "%?"))
              ("Note" :keys "n" :headline "Notes" :type entry
               :template ("* %^{Description}"
                          ":PROPERTIES:" ":CREATED: %T" ":END:"
                          "%?"))
              ("Reading" :keys "r" :todo-state "TODO" :headline "Reading"
               :template ("* %{todo-state} %^{Description}"
                          ":PROPERTIES:" ":CREATED: %T" ":END:"
                          "%?"))
              ("Journal" :keys "j" :type entry :datetree t :tree-type week
               :file fcuny/org-personal-journal-file
               :template ("* journal"
                          ":PROPERTIES:" ":CREATED: %T" ":END:"
                          "%?"))))
            ("Work" :keys "w" :file fcuny/org-work-notes-file :clock-in t :clock-resume t :children
             (("Tasks" :keys "t" :todo-state "TODO" :headline "Tasks"
               :template ("* %{todo-state} [#3] %^{Description}"
                          ":PROPERTIES:" ":CREATED: %T" ":END:"
                          "%?"))
              ("Note" :keys "n" :headline "Notes" :type entry
               :template ("* %^{Description}"
                          ":PROPERTIES:" ":CREATED: %T" ":END:"
                          "%?"))
              ("Reading" :keys "r" :todo-state "TODO" :headline "Reading"
               :template ("* %{todo-state} %^{Description}"
                          ":PROPERTIES:" ":CREATED: %T" ":END:"
                          "%?"))
              ("Journal" :keys "j" :type entry :datetree t :tree-type month
               :file fcuny/org-work-journal-file
               :template ("* %U journal"
                          ":PROPERTIES:" ":CREATED: %T" ":END:"
                          "%?"))
              ("Meeting" :keys "m" :type entry :datetree t :tree-type month
               :file fcuny/org-work-journal-file
               :template ("* %U meeting: %^{Description}"
                          ":PROPERTIES:" ":CREATED: %T" ":END:"
                          "%?")))))))))

(provide 'fcuny-org)