emacs 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535
  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. :hook
  119. ((latex-mode LaTeX-mode) . olivetti-mode))
  120. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  121. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  122. ;;;; Emacs buffer etc. behaviour ;;;;
  123. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  124. ;; Expand region
  125. (use-package expand-region
  126. :ensure t
  127. :config
  128. (global-set-key (kbd "<f11>") 'er/expand-region)
  129. (delete-selection-mode t) ; typed text replaces the selection
  130. )
  131. ;; Smartparens
  132. (use-package smartparens
  133. :ensure t
  134. :hook
  135. ((lisp-mode emacs-lisp-mode gfm-mode markdown-mode LaTeX-mode)
  136. . show-paren-mode)
  137. ((lisp-mode emacs-lisp-mode gfm-mode markdown-mode LaTeX-mode)
  138. . smartparens-mode)
  139. :config
  140. (sp-local-pair '(lisp-mode emacs-lisp-mode) "'" nil :actions nil)
  141. (sp-local-pair '(lisp-mode emacs-lisp-mode) "`" nil :actions nil)
  142. ;; Add \big( \big), etc. without having to use \bigl( \bigr).
  143. (sp-with-modes '(tex-mode plain-tex-mode latex-mode LaTeX-mode)
  144. (sp-local-pair "\\big(" "\\big)" :post-handlers '(sp-latex-insert-spaces-inside-pair))
  145. (sp-local-pair "\\bigg(" "\\bigg)" :post-handlers '(sp-latex-insert-spaces-inside-pair))
  146. (sp-local-pair "\\Big(" "\\Big)" :post-handlers '(sp-latex-insert-spaces-inside-pair))
  147. (sp-local-pair "\\Bigg(" "\\Bigg)" :post-handlers '(sp-latex-insert-spaces-inside-pair))
  148. (sp-local-pair "\\big[" "\\big]" :post-handlers '(sp-latex-insert-spaces-inside-pair))
  149. (sp-local-pair "\\bigg[" "\\bigg]" :post-handlers '(sp-latex-insert-spaces-inside-pair))
  150. (sp-local-pair "\\Big[" "\\Big]" :post-handlers '(sp-latex-insert-spaces-inside-pair))
  151. (sp-local-pair "\\Bigg[" "\\Bigg]" :post-handlers '(sp-latex-insert-spaces-inside-pair))
  152. (sp-local-pair "\\big\\{" "\\big\\}" :post-handlers '(sp-latex-insert-spaces-inside-pair))
  153. (sp-local-pair "\\bigg\\{" "\\bigg\\}" :post-handlers '(sp-latex-insert-spaces-inside-pair))
  154. (sp-local-pair "\\Big\\{" "\\Big\\}" :post-handlers '(sp-latex-insert-spaces-inside-pair))
  155. (sp-local-pair "\\Bigg\\{" "\\Bigg\\}" :post-handlers '(sp-latex-insert-spaces-inside-pair)))
  156. (eval-after-load 'latex '(require 'smartparens-latex))
  157. )
  158. ;; Helm (completion framework)
  159. (use-package helm
  160. :ensure t
  161. :bind (("M-x" . helm-M-x))
  162. :custom
  163. (helm-move-to-line-cycle-in-source nil)
  164. :config
  165. (helm-mode 1))
  166. (winner-mode t) ; C-c ←/→ for going between used window configurations
  167. (setq-default word-wrap t)
  168. (defun unfill-paragraph () ; for copy-pasting to external program
  169. "Takes a multi-line paragraph and makes it into a single line of text."
  170. (interactive)
  171. (let ((fill-column (point-max)))
  172. (fill-paragraph nil)))
  173. (define-key global-map "\M-Q" 'unfill-paragraph) ; alt+shift+q
  174. ;; Sort words
  175. ;; https://www.emacswiki.org/emacs/SortWords
  176. (defun sort-words (reverse beg end)
  177. "Sort words in region alphabetically, in REVERSE if negative.
  178. Prefixed with negative \\[universal-argument], sorts in reverse.
  179. The variable `sort-fold-case' determines whether alphabetic case
  180. affects the sort order.
  181. See `sort-regexp-fields'."
  182. (interactive "*P\nr")
  183. (sort-regexp-fields reverse "\\w+" "\\&" beg end))
  184. (windmove-default-keybindings windmove-key)
  185. (setq mouse-yank-at-point t) ; Use current cursor position for middle
  186. ; mouse pasting instead of jumping to new
  187. ; location then paste
  188. ;; F9 opens file where we save www-bookmarks
  189. (global-set-key (kbd "<f9>") (lambda() (interactive)(find-file own-bookmark-file)))
  190. ;; Xclip
  191. (when want-to-use-xclip
  192. (use-package xclip
  193. :ensure t
  194. :config
  195. (xclip-mode 1)
  196. ))
  197. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  198. ;;;;;;;;;;;;;;;;;;;;;;;;
  199. ;;;; Coding related ;;;;
  200. ;;;;;;;;;;;;;;;;;;;;;;;;
  201. (global-set-key "\C-x\C-m" 'compile) ; C-x C-m compile
  202. (setq compilation-read-command nil ; compile with "make -k"
  203. compilation-scroll-output t) ; autoscroll compilation buffer
  204. (use-package magit
  205. :ensure t
  206. :bind
  207. ("C-x g" . magit-status)
  208. :custom
  209. (magit-diff-refine-hunk 'all))
  210. (use-package abridge-diff
  211. :ensure t
  212. :after magit
  213. :init (abridge-diff-mode 1))
  214. (use-package company ; Company (complete anything) mode
  215. :ensure t
  216. :hook
  217. (emacs-lisp-mode . company-mode)
  218. ((latex-mode LaTeX-mode) . (lambda ()
  219. (set (make-local-variable 'company-backends)
  220. '((company-dabbrev)))))
  221. :custom
  222. (company-tooltip-align-annotations 1)
  223. (company-minimum-prefix-length 1)
  224. (company-idle-delay 0.0)
  225. (company-selection-wrap-around t)
  226. (company-dabbrev-ignore-case nil)
  227. (company-dabbrev-downcase nil)
  228. :config
  229. (company-tng-mode)
  230. (define-key company-active-map [up] nil)
  231. (define-key company-active-map [down] nil))
  232. (use-package slime ; SLIME (Common LISP)
  233. :ensure t
  234. :custom
  235. (inferior-lisp-program "clisp")
  236. :config
  237. (slime-setup '(slime-fancy)))
  238. (use-package slime-company
  239. :ensure t
  240. :after (slime company)
  241. :custom
  242. (slime-company-completion 'fuzzy)
  243. :config
  244. (slime-setup '(slime-company)))
  245. (use-package geiser-chez ; For Chez Scheme, start M-x run-geiser
  246. :ensure t)
  247. (use-package markdown-mode
  248. :ensure t
  249. :mode ("README\\.md\\'" . gfm-mode)
  250. :custom
  251. (markdown-command "pandoc"))
  252. ;; Indentation & behaviour
  253. (setq-default indent-tabs-mode nil
  254. standard-indent 2)
  255. ;;;;;;;;;;;;;;;;;;;;;;;;
  256. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  257. ;;;; LaTeX / math related ;;;;
  258. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  259. (add-to-list 'auto-mode-alist '("\\.m\\'" . octave-mode))
  260. (setq bibtex-align-at-equal-sign t) ; align = in bibtex using C-c C-q
  261. (if (display-graphic-p)
  262. (progn
  263. (use-package pdf-tools
  264. :ensure t
  265. :config
  266. (pdf-tools-install :no-query))
  267. (use-package org-noter
  268. :ensure t
  269. :after (pdf-tools)
  270. :custom
  271. (org-noter-notes-search-path (list bibliography-notes)))))
  272. (use-package tex
  273. :ensure auctex
  274. :after cdlatex
  275. :custom
  276. (TeX-source-correlate-mode t) ; for forward search
  277. :config
  278. ;; Make sure that when tabbing in org-cdlatex-mode it will not
  279. ;; complain of missing "LaTeX-indent-line".
  280. (defun own-LaTeX-indent-line ()
  281. (when (or (eq major-mode 'LaTeX-mode)
  282. (eq major-mode 'latex-mode))
  283. (LaTeX-indent-line)))
  284. (add-hook 'cdlatex-tab-hook 'own-LaTeX-indent-line)
  285. (add-to-list 'TeX-view-program-selection
  286. `(output-pdf ,pdf-viewer)) ; ` is like quote but allows
  287. ; evaluation inside using ,
  288. :hook
  289. ; Make \ part of words in LaTeX-mode
  290. ((latex-mode LaTeX-mode) . (lambda () (modify-syntax-entry
  291. (string-to-char TeX-esc)
  292. "w"
  293. LaTeX-mode-syntax-table))))
  294. (use-package cdlatex
  295. :ensure t
  296. :custom
  297. (cdlatex-takeover-parenthesis . nil)
  298. :hook
  299. ((latex-mode LaTeX-mode) . cdlatex-mode)
  300. (org-mode . turn-on-org-cdlatex)
  301. :config
  302. (setq cdlatex-env-alist
  303. '(("definition" "\\begin{definition} AUTOLABEL\n?\n\\end{definition}\n" nil)
  304. ("theorem" "\\begin{theorem} AUTOLABEL\n?\n\\end{theorem}\n" nil)
  305. ("lemma" "\\begin{lemma} AUTOLABEL\n?\n\\end{lemma}\n" nil)))
  306. (setq cdlatex-command-alist
  307. '(("def" "Insert definition env" "" cdlatex-environment ("definition") t nil)
  308. ("thm" "Insert theorem env" "" cdlatex-environment ("theorem") t nil)
  309. ("lem" "Insert lemma env" "" cdlatex-environment ("lemma") t nil)
  310. ("wt" "Insert \\widetilde{}" "\\widetilde{?}" cdlatex-position-cursor nil nil t))))
  311. (use-package reftex
  312. :ensure t
  313. :hook
  314. ((latex-mode LaTeX-mode) . turn-on-reftex))
  315. (use-package bibtex
  316. :custom
  317. ;; Ignore only lower case title words instead of all non-uppercased
  318. ;; ones when generating keys for bibtex
  319. (bibtex-autokey-titleword-ignore
  320. '("A" "An" "On" "The" "Eine?" "Der" "Die" "Das" "[[:lower:]].*" ".*[^[:upper:][:lower:]0-9].*")))
  321. ;; Helm-bibtex
  322. (use-package helm-bibtex
  323. :ensure t
  324. :demand t ; otherwise biblio-key will be bound to void
  325. :init ; can't have a form like biblio-key under :bind
  326. (bind-key biblio-key 'helm-command-prefix)
  327. :config
  328. (define-key helm-command-map biblio-key 'helm-resume)
  329. :bind
  330. (:map helm-command-map
  331. ("b" . helm-bibtex)
  332. ("B" . helm-bibtex-with-local-bibliography)
  333. ("n" . helm-bibtex-with-notes))
  334. ;; (define-key helm-command-map (kbd "<f12>") 'helm-resume)
  335. :custom
  336. (bibtex-completion-bibliography
  337. (list ; needs (list ...) for new org-ref to work
  338. bibliography-file))
  339. (bibtex-completion-library-path
  340. (list ; needs (list ...) for new org-ref to work
  341. bibliography-pdf-folder))
  342. (bibtex-completion-pdf-extension '(".pdf" ".djvu"))
  343. (bibtex-completion-pdf-open-function 'org-open-file)
  344. (bibtex-completion-notes-path bibliography-notes)
  345. (bibtex-completion-additional-search-fields '(keywords tags))
  346. (bibtex-completion-pdf-field "File")
  347. (bibtex-completion-pdf-symbol "⌘")
  348. (bibtex-completion-notes-symbol "✎")
  349. )
  350. (use-package org-ref ; Includes doi-utils
  351. :ensure t
  352. :custom
  353. ;; Words which shouldn't be capitalized in titles
  354. (org-ref-lower-case-words '("a" "an" "at" "on" "and" "for" "the" "of" "in"))
  355. ;; Allow the following fields Into Title Case of the Following Items
  356. (org-ref-title-case-types '(("article" "title")
  357. ("book" "booktitle")
  358. ("misc" "title")))
  359. ;; Don't convert ä,ö,å, etc when org-ref-clean-bibtex-entry
  360. (org-ref-clean-bibtex-entry-hook
  361. '(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)))
  362. (use-package emacsql :ensure t)
  363. (use-package org-roam
  364. :ensure t
  365. :after emacsql
  366. :init
  367. (setq org-roam-database-connector 'sqlite-builtin)
  368. :custom
  369. (org-roam-directory bibliography-notes)
  370. (org-roam-capture-templates
  371. `(("d" "default" plain "%?"
  372. :target (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}")
  373. :unnarrowed t)
  374. ("b" "bibliography notes" plain ; Org-noter integration
  375. (file ,(concat bibliography-notes "notes-template.org"))
  376. :target (file+head "${citekey}.org" "#+title: ${title}\n")
  377. :unnarrowed t)))
  378. :config
  379. (org-roam-db-autosync-mode 1))
  380. (use-package org-roam-bibtex
  381. :ensure t
  382. :custom
  383. (orb-preformat-keywords '("citekey" "title" "url" "author-or-editor" "keywords" "file")) ; customisation for notes, org-noter integration
  384. (orb-process-file-keyword t)
  385. (orb-attached-file-extensions '("pdf"))
  386. ;;(bibtex-completion-edit-notes-function 'bibtex-completion-edit-notes-default) ; default to org-ref for notes
  387. (bibtex-completion-edit-notes-function 'orb-bibtex-completion-edit-note) ; use org-roam-capture-templates for notes
  388. :config
  389. (require 'org-ref))
  390. (use-package org-roam-ui
  391. :ensure t
  392. :after org-roam
  393. :custom
  394. (org-roam-ui-sync-theme t)
  395. (org-roam-ui-follow t)
  396. (org-roam-ui-update-on-save t)
  397. (org-roam-ui-open-on-start t))
  398. (use-package scihub
  399. :ensure t
  400. :custom
  401. (scihub-download-directory (car bibtex-completion-library-path))
  402. (scihub-open-after-download nil)
  403. (scihub-fetch-domain 'scihub-fetch-domains-lovescihub))
  404. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  405. ;;;;;;;;;;;;;;;;;;;;;;;;;;
  406. ;;;; Org-mode related ;;;;
  407. ;;;;;;;;;;;;;;;;;;;;;;;;;;
  408. (use-package org
  409. :ensure t
  410. :bind
  411. ("C-c l" . org-store-link)
  412. ("C-c a" . org-agenda)
  413. ("C-c c" . org-capture)
  414. :custom
  415. (org-agenda-files (list own-calendar-file
  416. gtd-inbox
  417. gtd-gtd
  418. gtd-tickler
  419. gtd-someday))
  420. (org-agenda-start-on-weekday 1) ; nil means current day
  421. (org-agenda-span 7)
  422. (org-refile-targets '((org-agenda-files :maxlevel . 9)
  423. (gtd-inbox :maxlevel . 3)
  424. (gtd-someday :maxlevel . 2)
  425. (gtd-tickler :maxlevel . 2)
  426. (gtd-archive :level . 1)))
  427. (org-archive-reversed-order t) ; same for archiving with C-c C-x A
  428. (org-refile-use-outline-path t)
  429. (org-todo-keywords
  430. '((sequence "TODO(t)" "MEET(m)"
  431. "|" "DONE(d)" "WAIT(w@)" "CANCELLED(c@)")))
  432. (org-todo-repeat-to-state t)
  433. (org-log-done 'time)
  434. ;; See see http://cachestocaches.com/2016/9/my-workflow-org-agenda/
  435. (org-capture-templates
  436. `(("t" "Todo [gtd inbox]" entry (file+headline ,gtd-inbox "Tasks")
  437. "* TODO %i%? %A")
  438. ("T" "Tickler" entry (file+headline ,gtd-tickler "Tickler")
  439. "* %i%? \n%T")
  440. ("m" "Meeting" entry (file+headline ,gtd-inbox "Tasks")
  441. "* MEET %i%? %A")
  442. ("b" "Bookmark" entry (file+headline ,own-bookmark-file "Bookmarks")
  443. "* %x %?%^g\n:PROPERTIES:\n:CREATED: %U\n:END:\n\n" :empty-lines-before 1)
  444. ("n" "Pdf note from email" plain (file ,bibliography-file)
  445. "@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)))
  446. ;; Org & agendar look
  447. (org-todo-keyword-faces '(("MEET" .
  448. (:foreground "#486f66"
  449. :background "#f4bbce"
  450. :weight ultra-bold))))
  451. (org-agenda-prefix-format
  452. '((agenda . " %i %?-12t% s") ; default: " %i %-12:c%?-12t% s"
  453. (todo . " %i %-12:c")
  454. (tags . " %i %-12:c")
  455. (search . " %i %-12:c")))
  456. (org-format-latex-options '(:foreground default
  457. :background default
  458. :scale 1.0
  459. :html-foreground "Black"
  460. :html-background "Transparent"
  461. :html-scale 1.0
  462. :matchers ("begin" "$1" "$" "$$" "\\(" "\\[")))
  463. (org-outline-path-complete-in-steps nil) ; for completions to work in Helm
  464. :config
  465. ;; Open pdf & djvu outside emacs
  466. (defun alist-set (KEY PROP ALIST)
  467. (set ALIST (assoc-delete-all KEY (symbol-value ALIST)))
  468. (add-to-list ALIST (cons KEY PROP)))
  469. (alist-set "\\.pdf\\'" document-view 'org-file-apps)
  470. (alist-set "\\.djvu\\'" document-view 'org-file-apps)
  471. ;; C-c C-s RET inserts block. See ":exports both" for results.
  472. (org-babel-do-load-languages
  473. 'org-babel-load-languages
  474. '((calc . t)
  475. (octave . t)
  476. (R . t)
  477. (python . t) ; see https://emacs.stackexchange.com/a/64539
  478. (shell . t)))
  479. (setq org-babel-python-command
  480. "python3") ; add ":python python" to block for python2
  481. ;; Automagically save org-buffers after org-refile moves stuff
  482. (defun my-org-refile (&optional goto default-buffer rfloc msg)
  483. (interactive "P")
  484. "Does an ~org-refile~ and then a ~org-save-all-org-buffers~."
  485. (org-refile goto default-buffer rfloc msg) (org-save-all-org-buffers))
  486. (define-key org-mode-map (kbd "C-c C-w") 'my-org-refile)
  487. ;; F8 opens GTD file
  488. (global-set-key (kbd "<f8>") (lambda() (interactive)(find-file gtd-gtd)))
  489. )
  490. (use-package helm-org
  491. :ensure t
  492. :after (org helm)
  493. :config
  494. (add-to-list 'helm-completing-read-handlers-alist '(org-capture . helm-org-completing-read-tags))
  495. (add-to-list 'helm-completing-read-handlers-alist '(org-set-tags . helm-org-completing-read-tags)))
  496. (use-package suomalainen-kalenteri
  497. :ensure t
  498. :config
  499. (set-face-attribute 'org-agenda-calendar-sexp nil
  500. :inherit 'org-level-2)
  501. )
  502. ;;;;;;;;;;;;;;;;;;;;;;;;;;