Emacs personal configuration
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

127 行
4.2KB

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