aboutsummaryrefslogblamecommitdiff
path: root/users/programs/emacs/site-lisp/init-text.el
blob: 4a5739b66973181537b94f5b3f68815add291679 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

















                                                                    
                             




















                                                      






                                                                       
                                        









                                                                             












                                 


                         




                                            






























                                                                         







                                                                           
                                                                          
 





                        










                                                                  

                                                                   























                                                                              
 
                   

                                  
 

                                           
 

                       
 





                                             
                                                              

                                              
                                        
                                     



                                                         






                                                                               



                          
;;; init-text.el --- Configure text modes -*- lexical-binding: t -*-
;; Author: Franck Cuny <franck@fcuny.net>

;;; Commentary:

;; Configure completions

;;; Code:

(use-package flyspell
  :hook ((text-mode       . flyspell-mode)
         (org-mode        . flyspell-mode)
         (git-commit-mode . flyspell-mode)
         (prog-mode       . flyspell-prog-mode))
  :diminish flyspell-mode
  :custom
  (ispell-program-name "aspell")
  (ispell-silently-savep t)
  (ispell-dictionary "en_US")
  (ispell-local-dictionary "en_US")
  (ispell-extra-args '("--camel-case")))

(use-package markdown-mode
  :mode (("\\`README\\.md\\'" . gfm-mode)
         ("\\.md\\'"          . markdown-mode)
         ("\\.markdown\\'"    . markdown-mode))
  :custom
  (markdown-command "pandoc -f markdown_github+smart")
  (markdown-command-needs-filename t)
  (markdown-enable-math t)
  (markdown-open-command "marked")
  :init
  (setq markdown-command "multimarkdown"))

(use-package org
  :hook
  (org-mode . turn-on-flyspell)
  (org-mode . visual-line-mode)
  (org-mode . org-indent-mode)

  :custom
  (org-directory "~/Documents/org")
  (org-default-notes-file (expand-file-name "notes.org" org-directory))

  (org-startup-folded t)
  (org-startup-indented t)
  (org-startup-with-inline-images t)
  (org-adapt-indentation 'headline-data)

  ;; enable todo and checkbox dependencies
  (org-enforce-todo-dependencies t)
  (org-enforce-todo-checkbox-dependencies t)

  ;; quick access for todo states
  (org-todo-keywords
   '((sequence "TODO(t)" "NEXT(n)" "WAITING(w!)" "SOMEDAY(S!)" "|" "DONE(d)")
     (sequence "|" "CANCELLED(c)")))

  (org-tag-alist
   '((:startgroup)
     ("!Handson" . ?o)
     (:grouptags)
     ("write" . ?w) ("code" . ?c)
     (:endgroup)

     (:startgroup)
     ("_Handsoff" . ?f)
     (:grouptags)
     ("read" . ?r) ("watch" . ?W)
     (:endgroup)))

  (org-log-done 'time)
  (org-log-into-drawer t)

  ;; refile
  (org-refile-use-outline-path t)
  (org-refile-allow-creating-parent-nodes t)
  (org-refile-use-cache t)

  ;; no empty lines between items
  (org-blank-before-new-entry '((heading . nil) (plain-list-item . nil)))

  (org-hide-emphasis-markers t)
  (org-hide-leading-stars t)
  (org-pretty-entities t)

  (org-return-follows-link t)

  (org-export-backends '(html md))

  (org-imenu-depth 4)

  (org-insert-heading-respect-content t)

  (org-outline-path-complete-in-steps nil)

  (org-src-fontify-natively t)
  (org-src-preserve-indentation t)
  (org-src-tab-acts-natively t)
  (org-src-window-setup 'current-window)

  (org-yank-adjusted-subtrees t)

  (org-structure-template-alist
   '(("s" . "src")
     ("E" . "src emacs-lisp")
     ("p" . "src python")
     ("e" . "example")
     ("q" . "quote"))))

(use-package org-capture
  :ensure nil
  :after org
  :bind
  ("C-c c" . org-capture)
  :custom
  (org-capture-templates
   '(("t" "Tasks" entry (file+headline "~/Documents/org/tasks.org" "Tasks")
      "* TODO %?\n  :PROPERTIES:\n  :CAPTURED: %U\n  :END:" :prepend t))))

(use-package org-agenda
  :ensure nil
  :after org
  :bind
  ("C-c a" . org-agenda)
  :custom
  (org-agenda-start-on-weekday 1)
  (org-deadline-warning-days 3)
  (org-agenda-inhibit-startup t)
  (org-agenda-diary-file "~/Documents/org/tasks.org")
  (org-agenda-files '("~/Documents/org/tasks.org"))
  (org-agenda-restore-windows-after-quit t)
  (org-agenda-skip-deadline-if-done t)
  (org-agenda-skip-scheduled-if-done t)
  (org-agenda-custom-commands
   '(;; Todo and tags views for ongoing tasks by types of activity
     ("#" "To archive" todo "DONE|SKIP")
     ("A" "Hands on" tags-todo "+TAGS={write\\|code}+TODO={ONGO}")
     ("Z" "Hands off" tags-todo "+TAGS={read\\|watch}+TODO={ONGO}")

     ;; Agenda view to see ONGO/NEXT tasks for this week
     ("*" . "What's next?")
     ("**" "ONGO/NEXT all" tags-todo "TODO={NEXT}")

     ;; Agenda view to see TODO tasks with no SCHEDULED/DEADLINE
     (";" . "What's to do?")
     (";;" "TODO all" tags-todo "TODO={TODO}+DEADLINE=\"\"+SCHEDULED=\"\"")

     ;; Agenda view to see WAIT tasks with no SCHEDULED/DEADLINE
     (":" . "What's waiting?")
     ("::" "WAIT all" tags-todo "TODO={WAITING}+DEADLINE=\"\"+SCHEDULED=\"\"")

     ;; Agenda view to see upcoming deadlines with 60 days of warning period
     ("!" . "Upcoming deadlines")
     ("!!" "Deadlines all" agenda "Past/upcoming deadlines"
      ((org-agenda-span 1)
       (org-deadline-warning-days 60)
       (org-agenda-entry-types '(:deadline))))))
  (org-agenda-sorting-strategy
   '((agenda time-up deadline-up scheduled-up todo-state-up priority-down)
     (todo todo-state-down priority-down deadline-up)
     (tags todo-state-down priority-down deadline-up)
     (search todo-state-down priority-down deadline-up))))

(use-package denote
  :hook
  (dired-mode . denote-dired-mode)

  :custom-face
  (denote-faces-link ((t (:slant italic))))

  :init
  (require 'denote-org)

  :bind
  (("C-c w d b" . denote-find-backlink)
   ("C-c w d d" . denote-date)
   ("C-c w d l" . denote-find-link)
   ("C-c w d h" . denote-org-link-to-heading)
   ("C-c w d i" . denote-link-or-create)
   ("C-c w d j" . denote-journal-extras-new-or-existing-entry)
   ("C-c w d k" . denote-rename-file-keywords)
   ("C-c w d n" . denote)
   ("C-c w d N" . denote-open-or-create)
   ("C-c w d r" . denote-rename-file)
   ("C-c w d R" . denote-rename-file-using-front-matter))

  :custom
  (denote-sort-keywords t)
  (denote-known-keywords '("journal" "projects" "ideas" "people" "interviews"))
  (denote-directory "~/Documents/org"))

(use-package consult-denote
  :after (consult denote)
  :config
  (consult-denote-mode))

(provide 'init-text)

;;; init-text.el ends here