Emacs personal configuration
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

132 lines
4.4KB

  1. (when (< emacs-major-version 24)
  2. (require-package 'org))
  3. (require-package 'org-fstree)
  4. ;(when *is-a-mac*
  5. ; (require-package 'org-mac-link)
  6. ; (autoload 'org-mac-grab-link "org-mac-link" nil t)
  7. ; (require-package 'org-mac-iCal))
  8. (define-key global-map (kbd "C-c l") 'org-store-link)
  9. (define-key global-map (kbd "C-c a") 'org-agenda)
  10. ;; Various preferences
  11. (setq org-log-done t
  12. org-completion-use-ido t
  13. org-edit-timestamp-down-means-later t
  14. org-agenda-start-on-weekday nil
  15. org-agenda-span 14
  16. org-agenda-include-diary t
  17. org-agenda-window-setup 'current-window
  18. org-fast-tag-selection-single-key 'expert
  19. org-html-validation-link nil
  20. org-export-kill-product-buffer-when-displayed t
  21. org-tags-column 80)
  22. ; Refile targets include this file and any file contributing to the agenda - up to 5 levels deep
  23. (setq org-refile-targets (quote ((nil :maxlevel . 5) (org-agenda-files :maxlevel . 5))))
  24. ; Targets start with the file name - allows creating level 1 tasks
  25. (setq org-refile-use-outline-path (quote file))
  26. ; Targets complete in steps so we start with filename, TAB shows the next level of targets etc
  27. (setq org-outline-path-complete-in-steps t)
  28. (setq org-todo-keywords
  29. (quote ((sequence "TODO(t)" "STARTED(s)" "|" "DONE(d!/!)")
  30. (sequence "WAITING(w@/!)" "SOMEDAY(S)" "|" "CANCELLED(c@/!)"))))
  31. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  32. ;; Org clock
  33. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  34. ;; Save the running clock and all clock history when exiting Emacs, load it on startup
  35. (setq org-clock-persistence-insinuate t)
  36. (setq org-clock-persist t)
  37. (setq org-clock-in-resume t)
  38. ;; Change task state to STARTED when clocking in
  39. (setq org-clock-in-switch-to-state "STARTED")
  40. ;; Save clock data and notes in the LOGBOOK drawer
  41. (setq org-clock-into-drawer t)
  42. ;; Removes clocked tasks with 0:00 duration
  43. (setq org-clock-out-remove-zero-time-clocks t)
  44. ;; Show clock sums as hours and minutes, not "n days" etc.
  45. (setq org-time-clocksum-format
  46. '(:hours "%d" :require-hours t :minutes ":%02d" :require-minutes t))
  47. ;; Show the clocked-in task - if any - in the header line
  48. (defun sanityinc/show-org-clock-in-header-line ()
  49. (setq-default header-line-format '((" " org-mode-line-string " "))))
  50. (defun sanityinc/hide-org-clock-from-header-line ()
  51. (setq-default header-line-format nil))
  52. (add-hook 'org-clock-in-hook 'sanityinc/show-org-clock-in-header-line)
  53. (add-hook 'org-clock-out-hook 'sanityinc/hide-org-clock-from-header-line)
  54. (add-hook 'org-clock-cancel-hook 'sanityinc/hide-org-clock-from-header-line)
  55. (after-load 'org-clock
  56. (define-key org-clock-mode-line-map [header-line mouse-2] 'org-clock-goto)
  57. (define-key org-clock-mode-line-map [header-line mouse-1] 'org-clock-menu))
  58. (require-package 'org-pomodoro)
  59. (after-load 'org-agenda
  60. (define-key org-agenda-mode-map (kbd "P") 'org-pomodoro))
  61. ;; ;; Show iCal calendars in the org agenda
  62. ;; (when (and *is-a-mac* (require 'org-mac-iCal nil t))
  63. ;; (setq org-agenda-include-diary t
  64. ;; org-agenda-custom-commands
  65. ;; '(("I" "Import diary from iCal" agenda ""
  66. ;; ((org-agenda-mode-hook #'org-mac-iCal)))))
  67. ;; (add-hook 'org-agenda-cleanup-fancy-diary-hook
  68. ;; (lambda ()
  69. ;; (goto-char (point-min))
  70. ;; (save-excursion
  71. ;; (while (re-search-forward "^[a-z]" nil t)
  72. ;; (goto-char (match-beginning 0))
  73. ;; (insert "0:00-24:00 ")))
  74. ;; (while (re-search-forward "^ [a-z]" nil t)
  75. ;; (goto-char (match-beginning 0))
  76. ;; (save-excursion
  77. ;; (re-search-backward "^[0-9]+:[0-9]+-[0-9]+:[0-9]+ " nil t))
  78. ;; (insert (match-string 0))))))
  79. (after-load 'org
  80. (define-key org-mode-map (kbd "C-M-<up>") 'org-up-element)
  81. ; (when *is-a-mac*
  82. ; (define-key org-mode-map (kbd "M-h") nil))
  83. (define-key org-mode-map (kbd "C-M-<up>") 'org-up-element)
  84. ; (when *is-a-mac*
  85. ; (define-key org-mode-map (kbd "C-c g") 'org-mac-grab-link)))
  86. )
  87. (after-load 'org
  88. (org-babel-do-load-languages
  89. 'org-babel-load-languages
  90. '((R . t)
  91. (ditaa . t)
  92. (dot . t)
  93. (emacs-lisp . t)
  94. (gnuplot . t)
  95. (haskell . nil)
  96. (latex . t)
  97. (ledger . t)
  98. (ocaml . nil)
  99. (octave . t)
  100. (python . t)
  101. (ruby . t)
  102. (screen . nil)
  103. (sh . t)
  104. (sql . nil)
  105. (sqlite . t))))
  106. (provide 'init-org)