Skip to content

Instantly share code, notes, and snippets.

@lijigang lijigang/init.el

Created May 5, 2020
Embed
What would you like to do?
orgmode configuration of agenda (sunrise and sunset)
;; learn from https://github.com/AbstProcDo/Master-Emacs-From-Scrach-with-Solid-Procedures/blob/master/05.Emacs-as-a-Agenda-by-Org.org
(setq org-agenda-include-diary t)
(setq org-agenda-diary-file "your/path/to/standard-diary")
(setq diary-file "your/path/to/standard-diary")
;; 设置本地经纬度坐标
(setq calendar-latitude 39.9042)
(setq calendar-longitude 116.4074)
;;Sunrise and Sunset
;;日出而作, 日落而息
(defun diary-sunrise ()
(let ((dss (diary-sunrise-sunset)))
(with-temp-buffer
(insert dss)
(goto-char (point-min))
(while (re-search-forward " ([^)]*)" nil t)
(replace-match "" nil nil))
(goto-char (point-min))
(search-forward ",")
(buffer-substring (point-min) (match-beginning 0)))))
(defun diary-sunset ()
(let ((dss (diary-sunrise-sunset))
start end)
(with-temp-buffer
(insert dss)
(goto-char (point-min))
(while (re-search-forward " ([^)]*)" nil t)
(replace-match "" nil nil))
(goto-char (point-min))
(search-forward ", ")
(setq start (match-end 0))
(search-forward " at")
(setq end (match-beginning 0))
(goto-char start)
(capitalize-word 1)
(buffer-substring start end))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.