Update module-org; relative attachment paths

This commit is contained in:
Henrik Lissner 2015-12-23 03:51:44 -05:00
parent 486bab7dec
commit 9741c427de

View file

@ -13,6 +13,7 @@
(defvar org-directory-invoices (expand-file-name "my/invoices/" org-directory)) (defvar org-directory-invoices (expand-file-name "my/invoices/" org-directory))
(defvar org-default-notes-file (concat org-directory "notes.org")) (defvar org-default-notes-file (concat org-directory "notes.org"))
(defvar org-default-todo-file (concat org-directory "todo.org"))
(add-hook! org-load 'narf|org-init) (add-hook! org-load 'narf|org-init)
@ -48,7 +49,6 @@
org-log-done t org-log-done t
org-agenda-window-setup 'other-window org-agenda-window-setup 'other-window
org-agenda-skip-unavailable-files t org-agenda-skip-unavailable-files t
org-src-window-setup 'current-window
org-startup-folded 'content org-startup-folded 'content
org-todo-keywords '((sequence "TODO(t)" "|" "DONE(d)") org-todo-keywords '((sequence "TODO(t)" "|" "DONE(d)")
(sequence "IDEA(i)" "NEXT(n)" "ACTIVE(a)" "WAITING(w)" "LATER(l)" "|" "CANCELLED(c)") (sequence "IDEA(i)" "NEXT(n)" "ACTIVE(a)" "WAITING(w)" "LATER(l)" "|" "CANCELLED(c)")
@ -62,7 +62,7 @@
org-capture-templates org-capture-templates
'(("t" "TODO" entry '(("t" "TODO" entry
(file+headline (concat org-directory "notes.org") "Unsorted") (file+headline org-default-todo-file "Inbox")
"*** TODO %? %u") "*** TODO %? %u")
;; TODO Select file from org files ;; TODO Select file from org files
@ -80,7 +80,7 @@
;; TODO Select file from notes folder ;; TODO Select file from notes folder
("n" "Notes" entry ("n" "Notes" entry
(file+headline (concat org-directory "notes.org") "Unsorted") (file+headline org-default-notes-file "Inbox")
"* %u %?\n%i" :prepend t) "* %u %?\n%i" :prepend t)
("s" "Writing Scraps" entry ("s" "Writing Scraps" entry
@ -89,15 +89,15 @@
;; TODO Sort word under correct header ;; TODO Sort word under correct header
("v" "Vocab" entry ("v" "Vocab" entry
(file+headline (concat org-directory "notes/vocab.org") "Unsorted") (file+headline (concat org-directory "topics/vocab.org") "Unsorted")
"** %i%?\n") "** %i%?\n")
("e" "Excerpt" entry ("e" "Excerpt" entry
(file+headline (concat org-directory "notes/excerpts.org") "Excerpts") (file+headline (concat org-directory "topics/excerpts.org") "Excerpts")
"** %u %?\n%i" :prepend t) "** %u %?\n%i" :prepend t)
("q" "Quote" item ("q" "Quote" item
(file+headline (concat org-directory "notes/excerpts.org") "Quotes") (file+headline (concat org-directory "topics/excerpts.org") "Quotes")
"+ %i\n *Source: ...*\n : @tags" :prepend t) "+ %i\n *Source: ...*\n : @tags" :prepend t)
)) ))
@ -133,6 +133,7 @@
(defun narf@org-babel () (defun narf@org-babel ()
(setq org-confirm-babel-evaluate nil ; you don't need my permission (setq org-confirm-babel-evaluate nil ; you don't need my permission
org-src-window-setup 'current-window
org-src-fontify-natively t ; make code pretty org-src-fontify-natively t ; make code pretty
org-src-preserve-indentation t org-src-preserve-indentation t
org-src-tab-acts-natively t) org-src-tab-acts-natively t)
@ -156,7 +157,9 @@
(lambda () (lambda ()
(when (file-exists-p buffer-file-name) (when (file-exists-p buffer-file-name)
(shut-up! (org-babel-lob-ingest buffer-file-name)))) (shut-up! (org-babel-lob-ingest buffer-file-name))))
t t)) t t)
;; Restore feedback on save
(add-hook 'after-save-hook (lambda () (message "Saved!")) t t))
(org-babel-do-load-languages (org-babel-do-load-languages
'org-babel-load-languages 'org-babel-load-languages
@ -194,9 +197,11 @@
(defadvice org-edit-src-code (around set-buffer-file-name activate compile) (defadvice org-edit-src-code (around set-buffer-file-name activate compile)
"Assign a proper filename to the edit-src buffer, so plugins like quickrun "Assign a proper filename to the edit-src buffer, so plugins like quickrun
will function properly." will function properly."
(let ((file-name (buffer-file-name))) (let ((buffer-name (buffer-name))
(file-name (buffer-file-name)))
ad-do-it ad-do-it
(setq buffer-file-name file-name))) (setq buffer-file-name file-name)
(message "--%s :: %s" buffer-name (buffer-name))))
;; Add plantuml syntax highlighting support ;; Add plantuml syntax highlighting support
(add-to-list 'org-src-lang-modes '("puml" . puml)) (add-to-list 'org-src-lang-modes '("puml" . puml))
@ -304,7 +309,12 @@ will function properly."
(evil-org-mode +1) (evil-org-mode +1)
(org-bullets-mode +1) (org-bullets-mode +1)
(org-indent-mode +1) (org-indent-mode +1)
;; (text-scale-set 1) (text-scale-set 1)
;;; OS-Specific
(cond (IS-MAC (narf-org-init-for-osx))
(IS-LINUX nil)
(IS-WINDOWS nil))
;; Org-specific font. See `narf-writing-font' ;; Org-specific font. See `narf-writing-font'
(setq buffer-face-mode-face `(:family ,(symbol-name (font-get narf-writing-font :family)))) (setq buffer-face-mode-face `(:family ,(symbol-name (font-get narf-writing-font :family))))
@ -395,15 +405,18 @@ will function properly."
;;; Plugins ;;; Plugins
(require 'org-download) (require 'org-download)
(setq-default (setq-default
org-download-image-dir ".attach" org-download-image-dir (expand-file-name ".attach" org-directory)
org-download-heading-lvl nil org-download-heading-lvl nil
org-download-timestamp "_%Y%m%d_%H%M%S") org-download-timestamp "_%Y%m%d_%H%M%S")
(when IS-MAC (when IS-MAC
(setq org-download-screenshot-method "screencapture -i %s")) (setq org-download-screenshot-method "screencapture -i %s"))
(defun org-download--dir-2 () ;; Write download paths relative to current file
(f-base (buffer-file-name))) (defun org-download--dir-2 () nil)
(defun narf*org-download--fullname (path)
(f-relative path (f-dirname (buffer-file-name))))
(advice-add 'org-download--fullname :filter-return 'narf*org-download--fullname)
;;; Auto-completion ;;; Auto-completion
(after! company (after! company
@ -552,11 +565,6 @@ will function properly."
:e "C-n" 'org-agenda-next-item :e "C-n" 'org-agenda-next-item
:e "C-p" 'org-agenda-previous-item))) :e "C-p" 'org-agenda-previous-item)))
;;; OS-Specific
(cond (IS-MAC (narf-org-init-for-osx))
(IS-LINUX nil)
(IS-WINDOWS nil))
(progn ;; Org hacks (progn ;; Org hacks
(defun org-fontify-meta-lines-and-blocks-1 (limit) (defun org-fontify-meta-lines-and-blocks-1 (limit)
"Fontify #+ lines and blocks." "Fontify #+ lines and blocks."