[org] Customize date view in the agenda

master
Jacopo De Simoi 5 years ago
parent 0440a0cfc8
commit b4ef2eafa0
  1. 74
      global.org

@ -769,6 +769,77 @@
#+begin_src emacs-lisp
(setq org-use-speed-commands t)
#+end_src
Customize the agenda interface a bit
- Sleeker time-grid
#+begin_src emacs-lisp
(setq org-agenda-time-grid '((daily today require-timed)
(800 1000 1200 1400 1600 1800 2000)
" ······ " "───────────────")
org-agenda-current-time-string "····· now ·····")
#+end_src
- Use figlet-type fonts to display the date
#+begin_src emacs-lisp
(setq figlet
[["███" "██ " "███" "███" "█ █" "███" "███" "███" "███" "███"]
["█ █" " █ " " █" " █" "█ █" "█ " "█ " " █" "█ █" "█ █"]
["█ █" " █ " "███" "███" "███" "███" "███" " █" "███" "███"]
["█ █" " █ " "█ " " █" " █" " █" "█ █" " █" "█ █" " █"]
["███" "███" "███" "███" " █" "███" "███" " █" "███" "███"]])
(setq figlet-lean
[["┌──┐" "╶┐ " "╶──┐" "╶──┐" "╷ ╷" "┌──╴" "┌──╴" "╶──┐" "┌──┐" "┌──┐"]
["│ │" " │ " " │" " │" "│ │" "│ " "│ " " │" "│ │" "│ │"]
["│ │" " │ " "┌──┘" "╶──┤" "└──┤" "└──┐" "├──┐" " │" "├──┤" "└──┤"]
["│ │" " │ " "│ " " │" " │" " │" "│ │" " │" "│ │" " │"]
["└──┘" "╶┴╴" "└──╴" "╶──┘" " ╵" "╶──┘" "└──┘" " ╵" "└──┘" "╶──┘"]])
(defun figlet-digit (digit row)
(aref (aref figlet-lean row) digit))
(defun figlet-num (number row)
(let ((n number)
(d (list)))
(while (> n 0)
(setq d (append (list (mod n 10)) d))
(setq n (/ n 10)))
(string-join (mapcar
(lambda (digit) (concat (figlet-digit digit row) " "))
d))))
(defun org-agenda-format-date-figlet (date)
"Format a DATE string for display in the daily/weekly agenda.
This function makes sure that dates are aligned for easy reading."
;(require 'cal-iso)
(let* ((dayname (calendar-day-name date))
(day (cadr date))
(day-of-week (calendar-day-of-week date))
(month (car date))
(monthname (calendar-month-name month))
(year (nth 2 date))nf
(iso-week (org-days-to-iso-week
(calendar-absolute-from-gregorian date)))
(weekyear (cond ((and (= month 1) (>= iso-week 52))
(1- year))
((and (= month 12) (<= iso-week 1))
(1+ year))
(t year)))
(weekstring (if (= day-of-week 1)
(format " W%02d" iso-week)
"")))
(format (concat "\n"
"%-13s %s %4d%s\n"
"%-13s\n"
"%-13s %-10s\n"
"%-13s\n"
"%-13s %s\n")
(figlet-num day 0) monthname year weekstring
(figlet-num day 1)
(figlet-num day 2) dayname
(figlet-num day 3)
(figlet-num day 4) (sunrise-sunset))))
(setq org-agenda-format-date #'org-agenda-format-date-figlet)
#+end_src
Improve the org-habit graph thing
#+begin_src emacs-lisp
(setq org-habit-regular-glyph ?□
@ -968,7 +1039,8 @@
(setq buffer-read-only nil))))
(add-hook 'org-agenda-mode-hook
(lambda () (setq truncate-lines t)))
(lambda () (setq truncate-lines t
show-trailing-whitespace nil)))
#+end_src
*** Automate saving

Loading…
Cancel
Save