emacs 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542
  1. ;; Platform-specific stuff!!!!
  2. (setq document-view "setsid -w xdg-open %s"
  3. pdf-viewer "Evince" ; for C-c C-v LaTeX forward search
  4. keepass-folder "~/Syncthing/keepass/"
  5. bibliography-folder "~/Documents/bibliography/"
  6. biblio-key (kbd "<f12>") ; use <apps> for the menu button in
  7. ; other OS's, or for example <f12> for
  8. ; Termux and see its wiki for showing
  9. ; this button on its interface. Also
  10. ; <X86Launch1> works in Mate desktop,
  11. ; but not terminals.
  12. windmove-key 'shift ; for 'shift, see
  13. ; https://emacs.stackexchange.com/a/54002
  14. ;; browse-url-browser-function 'browse-url-xdg-open ; in termux
  15. org-replace-disputed-keys t ; for windmove when using 'shift
  16. want-to-use-xclip nil ; termux clipboard, install termux-api too
  17. )
  18. ;; Computed stuff:
  19. (setq own-calendar-file (concat keepass-folder "calendar.org")
  20. own-bookmark-file (concat keepass-folder "bookmarks.org")
  21. gtd-folder (concat keepass-folder "gtd/")
  22. gtd-inbox (concat gtd-folder "inbox.org")
  23. gtd-gtd (concat gtd-folder "gtd.org")
  24. gtd-someday (concat gtd-folder "someday.org")
  25. gtd-archive (concat gtd-folder "archive.org")
  26. gtd-tickler (concat gtd-folder "tickler.org")
  27. bibliography-file (concat bibliography-folder "references.bib")
  28. bibliography-pdf-folder (concat bibliography-folder "bibtex-pdfs/")
  29. bibliography-notes (concat bibliography-folder "bibtex-notes/"))
  30. ;; Defer loading packages unless daemon
  31. (setq use-package-always-demand (daemonp))
  32. ;; Always revert files, i.e. reload them to buffers if emacs notices
  33. ;; them changing by e.g. an external program.
  34. (global-auto-revert-mode 1)
  35. ;; Load the MELPA package library
  36. (require 'package)
  37. (add-to-list 'package-archives '("melpa"
  38. . "https://melpa.org/packages/") t)
  39. (package-initialize)
  40. ;; Download and load use-package
  41. (unless (package-installed-p 'use-package)
  42. (package-install 'use-package))
  43. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  44. ;; General text file handling ;;
  45. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  46. ;; Coding system
  47. (modify-coding-system-alist 'file "" 'utf-8)
  48. (setq-default buffer-file-coding-system 'utf-8)
  49. (add-to-list 'safe-local-variable-values '(buffer-file-coding-system . utf-8))
  50. ;; Backups into ~/.emacs-saves
  51. (unless (file-exists-p "~/.saves-emacs")
  52. (make-directory "~/.saves-emacs"))
  53. (setq backup-directory-alist '(("." . "~/.saves-emacs"))
  54. backup-by-copying t
  55. delete-old-versions t
  56. kept-new-versions 6
  57. kept-old-versions 2
  58. version-control t)
  59. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  60. ;;;;;;;;;;;;;;;;;;;;;;;
  61. ;;;; Email related ;;;;
  62. ;;;;;;;;;;;;;;;;;;;;;;;
  63. (setq mail-user-agent 'gnus-user-agent
  64. epg-pinentry-mode 'loopback) ; Avoids GPG password input entry
  65. ; issue in emacs termux. Might need
  66. ; to edit .gnupeg/gpg-agent.conf
  67. ; and add "allow-emacs-pinentry"
  68. ;; BBDB settings
  69. (use-package bbdb
  70. :ensure t
  71. :custom
  72. (bbdb-file (concat keepass-folder "bbdb"))
  73. (bbdb-mua-pop-up t) ; Display BBDB in popup window
  74. (bbdb-mua-pop-up-window-size 3)
  75. (bbdb-mua-update-interactive-p
  76. '(query . create)) ; Look for existing contact, interactively
  77. ; prompt to create
  78. :config
  79. (bbdb-initialize 'gnus 'message)
  80. (bbdb-mua-auto-update-init 'gnus 'message))
  81. ;;;;;;;;;;;;;;;;;;;;;;;
  82. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  83. ;;;; Appearance related ;;;;
  84. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  85. ;; Nyan-mode.
  86. (use-package nyan-mode
  87. :ensure t
  88. :config
  89. (nyan-mode 1)
  90. (nyan-start-animation)
  91. ;; Install sox in termux to play music and uncomment below.
  92. ;; (defun nyan-start-music ()
  93. ;; (interactive)
  94. ;; (unless nyan-music-process
  95. ;; (setq nyan-music-process (start-process-shell-command "nyan-music" "nyan-music" (concat "play " +nyan-music+ " repeat 9001")))))
  96. )
  97. ;; Theme
  98. (use-package nord-theme ; Good candidates: nord-theme, dracula-theme
  99. :ensure t)
  100. (use-package theme-changer
  101. :ensure t
  102. :after nord-theme
  103. :config
  104. (setq calendar-location-name "Espoo")
  105. (setq calendar-latitude 60.18)
  106. (setq calendar-longitude 24.82)
  107. (change-theme nil 'nord))
  108. ;; Color issues
  109. (setq shr-use-colors nil) ; Don't use text color when rendering html
  110. ; using shr (links ok)
  111. ;; Olivetti mode for org-mode etc long texts.
  112. ;; Add
  113. ;; ((nil . ((fill-column . 80)
  114. ;; (mode . olivetti))))
  115. ;; inside a folder's .dir-locals.el to use olivetti for all files there
  116. (use-package olivetti
  117. :ensure t
  118. :config
  119. (setq visual-line-fringe-indicators '(left-curly-arrow right-curly-arrow))
  120. (setq gnus-treat-fill-long-lines nil)
  121. :hook
  122. ((latex-mode LaTeX-mode gnus-article-mode message-mode) . olivetti-mode))
  123. (use-package adaptive-wrap
  124. :ensure t
  125. :hook
  126. (visual-line-mode . adaptive-wrap-prefix-mode))
  127. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  128. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  129. ;;;; Emacs buffer etc. behaviour ;;;;
  130. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  131. ;; Expand region
  132. (use-package expand-region
  133. :ensure t
  134. :config
  135. (global-set-key (kbd "<f11>") 'er/expand-region)
  136. (delete-selection-mode t) ; typed text replaces the selection
  137. )
  138. ;; Smartparens
  139. (use-package smartparens
  140. :ensure t
  141. :hook
  142. ((lisp-mode emacs-lisp-mode gfm-mode markdown-mode LaTeX-mode)
  143. . show-paren-mode)
  144. ((lisp-mode emacs-lisp-mode gfm-mode markdown-mode LaTeX-mode)
  145. . smartparens-mode)
  146. :config
  147. (sp-local-pair '(lisp-mode emacs-lisp-mode) "'" nil :actions nil)
  148. (sp-local-pair '(lisp-mode emacs-lisp-mode) "`" nil :actions nil)
  149. ;; Add \big( \big), etc. without having to use \bigl( \bigr).
  150. (sp-with-modes '(tex-mode plain-tex-mode latex-mode LaTeX-mode)
  151. (sp-local-pair "\\big(" "\\big)" :post-handlers '(sp-latex-insert-spaces-inside-pair))
  152. (sp-local-pair "\\bigg(" "\\bigg)" :post-handlers '(sp-latex-insert-spaces-inside-pair))
  153. (sp-local-pair "\\Big(" "\\Big)" :post-handlers '(sp-latex-insert-spaces-inside-pair))
  154. (sp-local-pair "\\Bigg(" "\\Bigg)" :post-handlers '(sp-latex-insert-spaces-inside-pair))
  155. (sp-local-pair "\\big[" "\\big]" :post-handlers '(sp-latex-insert-spaces-inside-pair))
  156. (sp-local-pair "\\bigg[" "\\bigg]" :post-handlers '(sp-latex-insert-spaces-inside-pair))
  157. (sp-local-pair "\\Big[" "\\Big]" :post-handlers '(sp-latex-insert-spaces-inside-pair))
  158. (sp-local-pair "\\Bigg[" "\\Bigg]" :post-handlers '(sp-latex-insert-spaces-inside-pair))
  159. (sp-local-pair "\\big\\{" "\\big\\}" :post-handlers '(sp-latex-insert-spaces-inside-pair))
  160. (sp-local-pair "\\bigg\\{" "\\bigg\\}" :post-handlers '(sp-latex-insert-spaces-inside-pair))
  161. (sp-local-pair "\\Big\\{" "\\Big\\}" :post-handlers '(sp-latex-insert-spaces-inside-pair))
  162. (sp-local-pair "\\Bigg\\{" "\\Bigg\\}" :post-handlers '(sp-latex-insert-spaces-inside-pair)))
  163. (eval-after-load 'latex '(require 'smartparens-latex))
  164. )
  165. ;; Helm (completion framework)
  166. (use-package helm
  167. :ensure t
  168. :bind (("M-x" . helm-M-x))
  169. :custom
  170. (helm-move-to-line-cycle-in-source nil)
  171. :config
  172. (helm-mode 1))
  173. (winner-mode t) ; C-c ←/→ for going between used window configurations
  174. (setq-default word-wrap nil)
  175. (defun unfill-paragraph () ; for copy-pasting to external program
  176. "Takes a multi-line paragraph and makes it into a single line of text."
  177. (interactive)
  178. (let ((fill-column (point-max)))
  179. (fill-paragraph nil)))
  180. (define-key global-map "\M-Q" 'unfill-paragraph) ; alt+shift+q
  181. ;; Sort words
  182. ;; https://www.emacswiki.org/emacs/SortWords
  183. (defun sort-words (reverse beg end)
  184. "Sort words in region alphabetically, in REVERSE if negative.
  185. Prefixed with negative \\[universal-argument], sorts in reverse.
  186. The variable `sort-fold-case' determines whether alphabetic case
  187. affects the sort order.
  188. See `sort-regexp-fields'."
  189. (interactive "*P\nr")
  190. (sort-regexp-fields reverse "\\w+" "\\&" beg end))
  191. (windmove-default-keybindings windmove-key)
  192. (setq mouse-yank-at-point t) ; Use current cursor position for middle
  193. ; mouse pasting instead of jumping to new
  194. ; location then paste
  195. ;; F9 opens file where we save www-bookmarks
  196. (global-set-key (kbd "<f9>") (lambda() (interactive)(find-file own-bookmark-file)))
  197. ;; Xclip
  198. (when want-to-use-xclip
  199. (use-package xclip
  200. :ensure t
  201. :config
  202. (xclip-mode 1)
  203. ))
  204. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  205. ;;;;;;;;;;;;;;;;;;;;;;;;
  206. ;;;; Coding related ;;;;
  207. ;;;;;;;;;;;;;;;;;;;;;;;;
  208. (global-set-key "\C-x\C-m" 'compile) ; C-x C-m compile
  209. (setq compilation-read-command nil ; compile with "make -k"
  210. compilation-scroll-output t) ; autoscroll compilation buffer
  211. (use-package magit
  212. :ensure t
  213. :bind
  214. ("C-x g" . magit-status)
  215. :custom
  216. (magit-diff-refine-hunk 'all))
  217. (use-package abridge-diff
  218. :ensure t
  219. :after magit
  220. :init (abridge-diff-mode 1))
  221. (use-package company ; Company (complete anything) mode
  222. :ensure t
  223. :hook
  224. (emacs-lisp-mode . company-mode)
  225. ((latex-mode LaTeX-mode) . (lambda ()
  226. (set (make-local-variable 'company-backends)
  227. '((company-dabbrev)))))
  228. :custom
  229. (company-tooltip-align-annotations 1)
  230. (company-minimum-prefix-length 1)
  231. (company-idle-delay 0.0)
  232. (company-selection-wrap-around t)
  233. (company-dabbrev-ignore-case nil)
  234. (company-dabbrev-downcase nil)
  235. :config
  236. (company-tng-mode)
  237. (define-key company-active-map [up] nil)
  238. (define-key company-active-map [down] nil))
  239. (use-package slime ; SLIME (Common LISP)
  240. :ensure t
  241. :custom
  242. (inferior-lisp-program "clisp")
  243. :config
  244. (slime-setup '(slime-fancy)))
  245. (use-package slime-company
  246. :ensure t
  247. :after (slime company)
  248. :custom
  249. (slime-company-completion 'fuzzy)
  250. :config
  251. (slime-setup '(slime-company)))
  252. (use-package geiser-chez ; For Chez Scheme, start M-x run-geiser
  253. :ensure t)
  254. (use-package markdown-mode
  255. :ensure t
  256. :mode ("README\\.md\\'" . gfm-mode)
  257. :custom
  258. (markdown-command "pandoc"))
  259. ;; Indentation & behaviour
  260. (setq-default indent-tabs-mode nil
  261. standard-indent 2)
  262. ;;;;;;;;;;;;;;;;;;;;;;;;
  263. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  264. ;;;; LaTeX / math related ;;;;
  265. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  266. (add-to-list 'auto-mode-alist '("\\.m\\'" . octave-mode))
  267. (setq bibtex-align-at-equal-sign t) ; align = in bibtex using C-c C-q
  268. (if (display-graphic-p)
  269. (progn
  270. (use-package pdf-tools
  271. :ensure t
  272. :config
  273. (pdf-tools-install :no-query))
  274. (use-package org-noter
  275. :ensure t
  276. :after (pdf-tools)
  277. :custom
  278. (org-noter-notes-search-path (list bibliography-notes)))))
  279. (use-package tex
  280. :ensure auctex
  281. :after cdlatex
  282. :custom
  283. (TeX-source-correlate-mode t) ; for forward search
  284. :config
  285. ;; Make sure that when tabbing in org-cdlatex-mode it will not
  286. ;; complain of missing "LaTeX-indent-line".
  287. (defun own-LaTeX-indent-line ()
  288. (when (or (eq major-mode 'LaTeX-mode)
  289. (eq major-mode 'latex-mode))
  290. (LaTeX-indent-line)))
  291. (add-hook 'cdlatex-tab-hook 'own-LaTeX-indent-line)
  292. (add-to-list 'TeX-view-program-selection
  293. `(output-pdf ,pdf-viewer)) ; ` is like quote but allows
  294. ; evaluation inside using ,
  295. :hook
  296. ; Make \ part of words in LaTeX-mode
  297. ((latex-mode LaTeX-mode) . (lambda () (modify-syntax-entry
  298. (string-to-char TeX-esc)
  299. "w"
  300. LaTeX-mode-syntax-table))))
  301. (use-package cdlatex
  302. :ensure t
  303. :custom
  304. (cdlatex-takeover-parenthesis . nil)
  305. :hook
  306. ((latex-mode LaTeX-mode) . cdlatex-mode)
  307. (org-mode . turn-on-org-cdlatex)
  308. :config
  309. (setq cdlatex-env-alist
  310. '(("definition" "\\begin{definition} AUTOLABEL\n?\n\\end{definition}\n" nil)
  311. ("theorem" "\\begin{theorem} AUTOLABEL\n?\n\\end{theorem}\n" nil)
  312. ("lemma" "\\begin{lemma} AUTOLABEL\n?\n\\end{lemma}\n" nil)))
  313. (setq cdlatex-command-alist
  314. '(("def" "Insert definition env" "" cdlatex-environment ("definition") t nil)
  315. ("thm" "Insert theorem env" "" cdlatex-environment ("theorem") t nil)
  316. ("lem" "Insert lemma env" "" cdlatex-environment ("lemma") t nil)
  317. ("wt" "Insert \\widetilde{}" "\\widetilde{?}" cdlatex-position-cursor nil nil t))))
  318. (use-package reftex
  319. :ensure t
  320. :hook
  321. ((latex-mode LaTeX-mode) . turn-on-reftex))
  322. (use-package bibtex
  323. :custom
  324. ;; Ignore only lower case title words instead of all non-uppercased
  325. ;; ones when generating keys for bibtex
  326. (bibtex-autokey-titleword-ignore
  327. '("A" "An" "On" "The" "Eine?" "Der" "Die" "Das" "[[:lower:]].*" ".*[^[:upper:][:lower:]0-9].*")))
  328. ;; Helm-bibtex
  329. (use-package helm-bibtex
  330. :ensure t
  331. :demand t ; otherwise biblio-key will be bound to void
  332. :init ; can't have a form like biblio-key under :bind
  333. (bind-key biblio-key 'helm-command-prefix)
  334. :config
  335. (define-key helm-command-map biblio-key 'helm-resume)
  336. :bind
  337. (:map helm-command-map
  338. ("b" . helm-bibtex)
  339. ("B" . helm-bibtex-with-local-bibliography)
  340. ("n" . helm-bibtex-with-notes))
  341. ;; (define-key helm-command-map (kbd "<f12>") 'helm-resume)
  342. :custom
  343. (bibtex-completion-bibliography
  344. (list ; needs (list ...) for new org-ref to work
  345. bibliography-file))
  346. (bibtex-completion-library-path
  347. (list ; needs (list ...) for new org-ref to work
  348. bibliography-pdf-folder))
  349. (bibtex-completion-pdf-extension '(".pdf" ".djvu"))
  350. (bibtex-completion-pdf-open-function 'org-open-file)
  351. (bibtex-completion-notes-path bibliography-notes)
  352. (bibtex-completion-additional-search-fields '(keywords tags))
  353. (bibtex-completion-pdf-field "File")
  354. (bibtex-completion-pdf-symbol "⌘")
  355. (bibtex-completion-notes-symbol "✎")
  356. )
  357. (use-package org-ref ; Includes doi-utils
  358. :ensure t
  359. :custom
  360. ;; Words which shouldn't be capitalized in titles
  361. (org-ref-lower-case-words '("a" "an" "at" "on" "and" "for" "the" "of" "in"))
  362. ;; Allow the following fields Into Title Case of the Following Items
  363. (org-ref-title-case-types '(("article" "title")
  364. ("book" "booktitle")
  365. ("misc" "title")))
  366. ;; Don't convert ä,ö,å, etc when org-ref-clean-bibtex-entry
  367. (org-ref-clean-bibtex-entry-hook
  368. '(org-ref-bibtex-format-url-if-doi orcb-key-comma orcb-& orcb-% org-ref-title-case orcb-clean-year orcb-key orcb-clean-doi orcb-clean-pages orcb-check-journal org-ref-sort-bibtex-entry orcb-fix-spacing)))
  369. (use-package emacsql :ensure t)
  370. (use-package org-roam
  371. :ensure t
  372. :after emacsql
  373. :init
  374. (setq org-roam-database-connector 'sqlite-builtin)
  375. :custom
  376. (org-roam-directory bibliography-notes)
  377. (org-roam-capture-templates
  378. `(("d" "default" plain "%?"
  379. :target (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}")
  380. :unnarrowed t)
  381. ("b" "bibliography notes" plain ; Org-noter integration
  382. (file ,(concat bibliography-notes "notes-template.org"))
  383. :target (file+head "${citekey}.org" "#+title: ${title}\n")
  384. :unnarrowed t)))
  385. :config
  386. (org-roam-db-autosync-mode 1))
  387. (use-package org-roam-bibtex
  388. :ensure t
  389. :custom
  390. (orb-preformat-keywords '("citekey" "title" "url" "author-or-editor" "keywords" "file")) ; customisation for notes, org-noter integration
  391. (orb-process-file-keyword t)
  392. (orb-attached-file-extensions '("pdf"))
  393. ;;(bibtex-completion-edit-notes-function 'bibtex-completion-edit-notes-default) ; default to org-ref for notes
  394. (bibtex-completion-edit-notes-function 'orb-bibtex-completion-edit-note) ; use org-roam-capture-templates for notes
  395. :config
  396. (require 'org-ref))
  397. (use-package org-roam-ui
  398. :ensure t
  399. :after org-roam
  400. :custom
  401. (org-roam-ui-sync-theme t)
  402. (org-roam-ui-follow t)
  403. (org-roam-ui-update-on-save t)
  404. (org-roam-ui-open-on-start t))
  405. (use-package scihub
  406. :ensure t
  407. :custom
  408. (scihub-download-directory (car bibtex-completion-library-path))
  409. (scihub-open-after-download nil)
  410. (scihub-fetch-domain 'scihub-fetch-domains-lovescihub))
  411. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  412. ;;;;;;;;;;;;;;;;;;;;;;;;;;
  413. ;;;; Org-mode related ;;;;
  414. ;;;;;;;;;;;;;;;;;;;;;;;;;;
  415. (use-package org
  416. :ensure t
  417. :bind
  418. ("C-c l" . org-store-link)
  419. ("C-c a" . org-agenda)
  420. ("C-c c" . org-capture)
  421. :custom
  422. (org-agenda-files (list own-calendar-file
  423. gtd-inbox
  424. gtd-gtd
  425. gtd-tickler
  426. gtd-someday))
  427. (org-agenda-start-on-weekday 1) ; nil means current day
  428. (org-agenda-span 7)
  429. (org-refile-targets '((org-agenda-files :maxlevel . 9)
  430. (gtd-inbox :maxlevel . 3)
  431. (gtd-someday :maxlevel . 2)
  432. (gtd-tickler :maxlevel . 2)
  433. (gtd-archive :level . 1)))
  434. (org-archive-reversed-order t) ; same for archiving with C-c C-x A
  435. (org-refile-use-outline-path t)
  436. (org-todo-keywords
  437. '((sequence "TODO(t)" "MEET(m)"
  438. "|" "DONE(d)" "WAIT(w@)" "CANCELLED(c@)")))
  439. (org-todo-repeat-to-state t)
  440. (org-log-done 'time)
  441. ;; See see http://cachestocaches.com/2016/9/my-workflow-org-agenda/
  442. (org-capture-templates
  443. `(("t" "Todo [gtd inbox]" entry (file+headline ,gtd-inbox "Tasks")
  444. "* TODO %i%? %A")
  445. ("T" "Tickler" entry (file+headline ,gtd-tickler "Tickler")
  446. "* %i%? \n%T")
  447. ("m" "Meeting" entry (file+headline ,gtd-inbox "Tasks")
  448. "* MEET %i%? %A")
  449. ("b" "Bookmark" entry (file+headline ,own-bookmark-file "Bookmarks")
  450. "* %x %?%^g\n:PROPERTIES:\n:CREATED: %U\n:END:\n\n" :empty-lines-before 1)
  451. ("n" "Pdf note from email" plain (file ,bibliography-file)
  452. "@misc{????,\nauthor = {%^{author}},\nday = %^{day},\nmonth = %^{month},\nyear = %^{year},\ntags = {%^{comma-separated tags}},\ntitle = {%\\4/%\\3/%\\2 Notes - %^{topic (remember to save the PDF from email!!)}},\nurl = %l\n}\n\n" :empty-lines 1 :before-finalize org-ref-clean-bibtex-entry :immediate-finish 1)))
  453. ;; Org & agendar look
  454. (org-todo-keyword-faces '(("MEET" .
  455. (:foreground "#486f66"
  456. :background "#f4bbce"
  457. :weight ultra-bold))))
  458. (org-agenda-prefix-format
  459. '((agenda . " %i %?-12t% s") ; default: " %i %-12:c%?-12t% s"
  460. (todo . " %i %-12:c")
  461. (tags . " %i %-12:c")
  462. (search . " %i %-12:c")))
  463. (org-format-latex-options '(:foreground default
  464. :background default
  465. :scale 1.0
  466. :html-foreground "Black"
  467. :html-background "Transparent"
  468. :html-scale 1.0
  469. :matchers ("begin" "$1" "$" "$$" "\\(" "\\[")))
  470. (org-outline-path-complete-in-steps nil) ; for completions to work in Helm
  471. :config
  472. ;; Open pdf & djvu outside emacs
  473. (defun alist-set (KEY PROP ALIST)
  474. (set ALIST (assoc-delete-all KEY (symbol-value ALIST)))
  475. (add-to-list ALIST (cons KEY PROP)))
  476. (alist-set "\\.pdf\\'" document-view 'org-file-apps)
  477. (alist-set "\\.djvu\\'" document-view 'org-file-apps)
  478. ;; C-c C-s RET inserts block. See ":exports both" for results.
  479. (org-babel-do-load-languages
  480. 'org-babel-load-languages
  481. '((calc . t)
  482. (octave . t)
  483. (R . t)
  484. (python . t) ; see https://emacs.stackexchange.com/a/64539
  485. (shell . t)))
  486. (setq org-babel-python-command
  487. "python3") ; add ":python python" to block for python2
  488. ;; Automagically save org-buffers after org-refile moves stuff
  489. (defun my-org-refile (&optional goto default-buffer rfloc msg)
  490. (interactive "P")
  491. "Does an ~org-refile~ and then a ~org-save-all-org-buffers~."
  492. (org-refile goto default-buffer rfloc msg) (org-save-all-org-buffers))
  493. (define-key org-mode-map (kbd "C-c C-w") 'my-org-refile)
  494. ;; F8 opens GTD file
  495. (global-set-key (kbd "<f8>") (lambda() (interactive)(find-file gtd-gtd)))
  496. )
  497. (use-package helm-org
  498. :ensure t
  499. :after (org helm)
  500. :config
  501. (add-to-list 'helm-completing-read-handlers-alist '(org-capture . helm-org-completing-read-tags))
  502. (add-to-list 'helm-completing-read-handlers-alist '(org-set-tags . helm-org-completing-read-tags)))
  503. (use-package suomalainen-kalenteri
  504. :ensure t
  505. :config
  506. (set-face-attribute 'org-agenda-calendar-sexp nil
  507. :inherit 'org-level-2)
  508. )
  509. ;;;;;;;;;;;;;;;;;;;;;;;;;;