time.el 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. ;;; time.el --- Time, calendar, diary, appointments, notifications, …
  2. ;; Copyright © 2014–2016, 2018 Alex Kost
  3. ;; This program is free software; you can redistribute it and/or modify
  4. ;; it under the terms of the GNU General Public License as published by
  5. ;; the Free Software Foundation, either version 3 of the License, or
  6. ;; (at your option) any later version.
  7. ;;
  8. ;; This program is distributed in the hope that it will be useful,
  9. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. ;; GNU General Public License for more details.
  12. ;;
  13. ;; You should have received a copy of the GNU General Public License
  14. ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. (require 'al-key)
  16. ;;; Global keys
  17. (al/bind-keys
  18. :prefix-map al/calendar-map
  19. :prefix-docstring "Map for calendar, diary, notifications, etc."
  20. :prefix "M-C"
  21. ("M-C" . calendar)
  22. ("c" . calendar)
  23. ("d" . diary)
  24. ("D" . al/diary-file)
  25. ("A" . appt-activate)
  26. ("a n" . appt-add)
  27. ("a k" . appt-delete)
  28. ("M-T" (al/timer-set "Tea!!" 180))
  29. ("T" (al/timer-set "Break!!" (* 15 60)))
  30. ("t n" . al/timer-set)
  31. ("t t" . al/timer-remaining-time)
  32. ("t k" . al/timer-cancel))
  33. ;;; Misc settings and packages
  34. (with-eval-after-load 'time
  35. (setq
  36. display-time-interval 5
  37. display-time-format " %H:%M:%S"))
  38. (setq calendar-date-style 'iso)
  39. (with-eval-after-load 'calendar
  40. (setq
  41. diary-file (al/notes-dir-file "diary")
  42. calendar-week-start-day 1
  43. calendar-date-display-form '(dayname ", " day " " monthname " " year)
  44. calendar-mark-diary-entries-flag t)
  45. (al/bind-keys
  46. :map calendar-mode-map
  47. ("t" . calendar-goto-today)
  48. ("o" . calendar-backward-day)
  49. ("u" . calendar-forward-day)
  50. ("." . calendar-backward-week)
  51. ("e" . calendar-forward-week)
  52. ("z" . calendar-unmark)
  53. ("l" . holidays)
  54. ("C-a" . calendar-beginning-of-week)
  55. ("<ctrl-i>" . calendar-end-of-week)
  56. ("M-o" . calendar-backward-month)
  57. ("M-u" . calendar-forward-month)
  58. ("M-." . calendar-scroll-right-three-months)
  59. ("M-e" . calendar-scroll-left-three-months)
  60. ("M-A" . calendar-beginning-of-month)
  61. ("M-I" . calendar-end-of-month)
  62. ("H-." . calendar-backward-year)
  63. ("H-e" . calendar-forward-year)
  64. ("n" . al/diary-insert-entry)
  65. ("i d" . al/diary-insert-entry))
  66. ;; Do not ruin the mode-line.
  67. (setq calendar-mode-line-format nil)
  68. (al/add-hook-maybe 'calendar-mode-hook 'al/bar-cursor-type)
  69. (add-hook 'calendar-today-visible-hook 'calendar-mark-today))
  70. (with-eval-after-load 'al-calendar
  71. (setq al/calendar-date-display-form
  72. '((format "%s %.3s %2s" year monthname day))))
  73. (with-eval-after-load 'solar
  74. (setq
  75. calendar-latitude 50.6
  76. calendar-longitude 36.6
  77. calendar-location-name "home"
  78. calendar-time-display-form
  79. '(24-hours ":" minutes
  80. (if time-zone " (") time-zone (if time-zone ")"))))
  81. (with-eval-after-load 'diary-lib
  82. (setq
  83. diary-number-of-entries 3
  84. diary-comment-start "#")
  85. (add-hook 'diary-list-entries-hook 'diary-sort-entries t))
  86. (with-eval-after-load 'appt
  87. (setq
  88. appt-audible nil
  89. appt-display-diary nil
  90. appt-message-warning-time 5
  91. appt-display-interval 1)
  92. (when (require 'sauron nil t)
  93. (add-to-list 'sauron-modules 'sauron-org))
  94. (when (require 'al-appt nil t)
  95. (advice-add 'appt-display-message
  96. :override 'al/appt-display-message)))
  97. (al/eval-after-init
  98. (when (string= server-name "server")
  99. (appt-activate)))
  100. (with-eval-after-load 'al-appt
  101. (when (require 'al-file nil t)
  102. (al/setq-file
  103. al/appt-notify-normal-sound (al/sound-dir-file "drums.wav")
  104. al/appt-notify-urgent-sound (al/sound-dir-file "bell.oga"))))
  105. (with-eval-after-load 'al-notification
  106. (setq al/timer-format "%M min %S sec")
  107. (when (require 'al-file nil t)
  108. (al/setq-file
  109. al/notification-sound (al/sound-dir-file "alarm.wav"))))
  110. (al/bind-keys
  111. ("C-c s" . al/sauron-toggle-hide-show)
  112. ("C-c S" . al/sauron-restart))
  113. (with-eval-after-load 'sauron
  114. (setq
  115. sauron-max-line-length 174
  116. sauron-separate-frame nil
  117. sauron-modules nil
  118. sauron-nick-insensitivity 10
  119. sauron-scroll-to-bottom nil))
  120. ;;; time.el ends here