summary refs log tree commit diff
path: root/emacs/custom
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2022-04-28 19:45:12 -0700
committerFranck Cuny <franck@fcuny.net>2022-04-28 19:45:12 -0700
commit201d45fd429a20701c014bcbfd250d02c4ab3111 (patch)
tree087d34d9bc49f906fe6cefbcf4dd87703c16117e /emacs/custom
parentfurther simplifications (diff)
downloademacs.d-201d45fd429a20701c014bcbfd250d02c4ab3111.tar.gz
org: remove `use-package'
Diffstat (limited to '')
-rw-r--r--emacs/custom/my-org.el285
1 files changed, 99 insertions, 186 deletions
diff --git a/emacs/custom/my-org.el b/emacs/custom/my-org.el
index 1197687..ea217f5 100644
--- a/emacs/custom/my-org.el
+++ b/emacs/custom/my-org.el
@@ -1,198 +1,111 @@
-;;; my-org.el --- Configure org-mode
+;;; my-org.el --- Configure org-mode -*- lexical-binding: t -*-
 ;;; Commentary:
 ;;; Code:
 
-(require 'use-package)
-(require 's)
+(require 'org)
+(require 'org-agenda)
+(require 'org-capture)
+(require 'org-archive)
+(require 'ox)
 
 (defvar my/org-directory
   (if (memq window-system '(mac ns))
       (expand-file-name "~/workspace/notebooks/")
     (expand-file-name "~/documents/notes/")))
 
-(defun my/clipboard-get-contents ()
-  "Return the contents of the system clipboard as a string."
-  (condition-case nil
-      (cond
-       ((fboundp 'ns-get-pasteboard)
-        (ns-get-pasteboard))
-       ((and (featurep 'mac)
-             (fboundp 'gui-get-selection))
-        (gui-get-selection 'CLIPBOARD 'NSStringPboardType))
-       ((and (featurep 'mac)
-             (fboundp 'x-get-selection))
-        (x-get-selection 'CLIPBOARD 'NSStringPboardType))
-       ((fboundp 'gui-get-selection)
-        (gui-get-selection 'CLIPBOARD (or x-select-request-type 'UTF8_STRING)))
-       (t
-        (error "Clipboard support not available")))))
-
-(use-package org-ml
-  :ensure t)
-
-(use-package htmlize
-  :ensure t)
-
-(use-package org
-  :ensure t
-  :commands (org-check-agenda-file org-protocol-capture)
-  :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))
-
-  :init
-  ;; save all the org buffers after refilling tasks
-  (advice-add 'org-refile :after
-              (lambda (&rest _)
-                (org-save-all-org-buffers)))
-
-  :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 my/org-directory)
-  ;; hide emphasis markup
-  (org-hide-emphasis-markers t)
-
-  ;; 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-log-into-drawer t)
-
-  (org-startup-indented t)
-
-  (org-cycle-separator-lines 0)
-  (org-startup-folded 'content)
-  (org-todo-keywords '((sequence "TODO" "STARTED" "WAITING" "|" "DONE" "CANCELED")))
-
-  ;; priorities
-  (org-priority-start-cycle-with-default nil) ;; Start one over/under default value.
-  (org-highest-priority ?A)
-  (org-lowest-priority ?D)
-  (org-default-priority ?C) ;; Ensures unset tasks have low priority.
-
-  ;; refile
-  (org-refile-use-cache nil)
-  (org-refile-targets `((,(expand-file-name "tasks.org" org-directory) :maxlevel . 1)
-                        (,(expand-file-name "notes.org" org-directory) :maxlevel . 1)
-                        (,(expand-file-name "projects.org" org-directory) :tag . "project")))
-  (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.rbx.com/browse/%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-agenda
-  :ensure nil
-  :after (org)
-  :bind (("C-c a" . org-agenda))
-  :custom
-  (org-agenda-files `(,(expand-file-name "inbox.org" org-directory)
-                      ,(expand-file-name "notes.org" org-directory)
-                      ,(expand-file-name "tasks.org" org-directory)
-                      ,(expand-file-name "projects.org" org-directory)
-                      ,(expand-file-name "bookmarks.org" org-directory)
-                      ,(expand-file-name "journal.org" org-directory)))
-  (org-agenda-show-all-dates t)
-  (calendar-week-start-day 1)
-  (org-agenda-custom-commands nil)
-  (org-agenda-start-on-weekday 1)
-
-  :config
-  (add-to-list 'org-agenda-custom-commands
-               '("A" "Agenda"
-                 ((agenda ""
-                          ((org-agenda-span 'week)))
-                  (todo "TODO"
-                        ((org-agenda-overriding-header "To Refile")
-                         (org-agenda-files `(,(expand-file-name "inbox.org" org-directory)))))
-                  (todo "STARTED"
-                        ((org-agenda-overriding-header "In Progress")))
-                  (todo "WAITING"
-                        ((org-agenda-overriding-header "Blocked")))
-                  (todo "TODO"
-                        ((org-agenda-overriding-header "Not yet started")
-                         (org-agenda-skip-function '(org-agenda-skip-entry-if 'deadline 'scheduled))))))))
-
-(use-package org-web-tools
-  :ensure t)
-
-(use-package org-capture
-  :ensure nil
-  :after (org org-web-tools)
-  :preface
-  (defun my/org-capture-link ()
-  "Make a TODO entry with a link in clipboard.
-The page title is used as an entry heading."
-  (let* ((url-string (s-trim (my/clipboard-get-contents)))
-         (pdf (string-suffix-p "pdf" url-string)))
-    (unless pdf
-      (let ((page-title (org-web-tools--html-title (org-web-tools--get-url url-string))))
-        (concat "* [[" url-string "][" page-title "]]"
-                "\t%^g"
-                "\n:PROPERTIES:\n:CREATED: %T\n:URL: "
-                url-string
-                "\n:END:\n%?")))))
-  :custom
-  (org-capture-templates
-   `(("t" "Todo" entry (file "inbox.org")
-      "* TODO [#D] %?\n:PROPERTIES:\n:CREATED: %U\n:END:\n")
-
-     ("n" "Note" entry (file "notes.org")
-      "* %?\n:PROPERTIES:\n:CREATED: %T\n:END:\n")
-
-     ("f" "Feed" entry (file "inbox.org")
-      "* %?\n:PROPERTIES:\n:CREATED: %T\n:END:\n")
-
-     ("l" "Bookmark" entry (file "bookmarks.org")
-      (function my/org-capture-link))
-
-     ("j" "Journal" entry
-      (file+olp+datetree "journal.org")
-      "* %?\n:PROPERTIES:\n:CREATED: %T\n:END:\n" :tree-type day))))
+(add-hook 'org-mode-hook 'org-indent-mode)
+(add-hook 'org-mode-hook 'org-hide-block-all)
+(add-hook 'org-mode-hook 'visual-line-mode)
+(add-hook 'org-capture-after-finalize-hook 'org-save-all-org-buffers)
+(add-hook 'org-capture-prepare-finalize-hook 'org-save-all-org-buffers)
+
+(global-set-key (kbd "C-c c") 'org-capture)
+(global-set-key (kbd "C-c a") 'org-agenda)
+
+(defvar load-language-list '((emacs-lisp . t)
+                             (python . t)
+                             (shell . t)))
+
+(setq org-directory my/org-directory)
+(setq org-hide-emphasis-markers t)                ;; hide emphasis markup
+(setq org-archive-subtree-add-inherited-tags t)   ;; when archiving, inherit the tags from the parent
+(setq org-pretty-entities t)                      ;; display unicode characters
+(setq org-log-done 'time)                         ;; log the time of completion
+(setq org-log-into-drawer t)                      ;; insert state change in the drawer
+(setq org-cycle-separator-lines 0)
+(setq org-startup-folded 'content)
+(setq org-todo-keywords '((sequence "TODO" "STARTED" "WAITING" "|" "DONE" "CANCELED")))
+
+(setq org-priority-start-cycle-with-default nil) ;; Start one over/under default value.
+(setq org-highest-priority ?A)
+(setq org-lowest-priority ?D)
+(setq org-default-priority ?C)                   ;; Ensures unset tasks have low priority.
+
+(setq org-refile-use-cache nil)
+(setq org-refile-targets `((,(expand-file-name "tasks.org" org-directory) :maxlevel . 1)
+                           (,(expand-file-name "notes.org" org-directory) :maxlevel . 1)
+                           (,(expand-file-name "projects.org" org-directory) :tag . "project")))
+(setq org-refile-use-outline-path 'file)
+(setq org-outline-path-complete-in-steps nil)
+(setq org-refile-allow-creating-parent-nodes 'confirm)
+
+;; org babel related
+(setq org-src-fontify-natively t)
+(setq org-src-preserve-indentation t)     ;; prevent the conversion of spaces into tabs (necessary for Python code exports)
+(setq org-edit-src-content-indentation t)
+
+(setq org-return-follows-link t)          ;; I want to follow links on RET
+
+;; some configurations for exporting document
+(setq org-export-with-toc nil)
+(setq org-export-with-section-numbers nil)
+
+;; a few abbreviations I use regularly
+(setq org-link-abbrev-alist
+      '(("src"  . "~/workspace/%s")
+        ("jira" . "https://jira.rbx.com/browse/%s")
+        ("go"   . "http://go/%s")))
+
+(setq org-blank-before-new-entry (quote ((heading . nil) (plain-list-item . nil))))
+(setq org-reverse-note-order t)
+
+(setq org-agenda-files `(,(expand-file-name "inbox.org" org-directory)
+                         ,(expand-file-name "notes.org" org-directory)
+                         ,(expand-file-name "tasks.org" org-directory)
+                         ,(expand-file-name "projects.org" org-directory)
+                         ,(expand-file-name "bookmarks.org" org-directory)
+                         ,(expand-file-name "journal.org" org-directory)))
+(setq org-agenda-show-all-dates t)
+(setq calendar-week-start-day 1)
+(setq org-agenda-custom-commands nil)
+(setq org-agenda-start-on-weekday 1)
+
+(add-to-list 'org-agenda-custom-commands
+'("A" "Agenda"
+  ((agenda ""
+           ((org-agenda-span 'week)))
+   (todo "TODO"
+         ((org-agenda-overriding-header "To Refile")
+          (org-agenda-files `(,(expand-file-name "inbox.org" org-directory)))))
+   (todo "STARTED"
+         ((org-agenda-overriding-header "In Progress")))
+   (todo "WAITING"
+         ((org-agenda-overriding-header "Blocked")))
+   (todo "TODO"
+         ((org-agenda-overriding-header "Not yet started")
+          (org-agenda-skip-function '(org-agenda-skip-entry-if 'deadline 'scheduled)))))))
+
+(setq org-capture-templates
+`(("t" "Todo" entry (file "inbox.org")
+   "* TODO [#D] %?\n:PROPERTIES:\n:CREATED: %U\n:END:\n")
+
+  ("n" "Note" entry (file "notes.org")
+   "* %?\n:PROPERTIES:\n:CREATED: %T\n:END:\n")
+
+  ("j" "Journal" entry
+   (file+olp+datetree "journal.org")
+   "* %?\n:PROPERTIES:\n:CREATED: %T\n:END:\n" :tree-type day)))
 
 (provide 'my-org)
+
 ;;; my-org.el ends here