master
Jacopo De Simoi 5 years ago
parent 0575a70c73
commit 43a9d34fc0
  1. 146
      global.org

@ -779,67 +779,95 @@
#+end_src #+end_src
- Use figlet-type fonts to display the date - Use figlet-type fonts to display the date
#+begin_src emacs-lisp #+begin_src emacs-lisp
(setq figlet (setq figlet
[["███" "██ " "███" "███" "█ █" "███" "███" "███" "███" "███"] [["███" "██ " "███" "███" "█ █" "███" "███" "███" "███" "███"]
["█ █" " █ " " █" " █" "█ █" "█ " "█ " " █" "█ █" "█ █"] ["█ █" " █ " " █" " █" "█ █" "█ " "█ " " █" "█ █" "█ █"]
["█ █" " █ " "███" "███" "███" "███" "███" " █" "███" "███"] ["█ █" " █ " "███" "███" "███" "███" "███" " █" "███" "███"]
["█ █" " █ " "█ " " █" " █" " █" "█ █" " █" "█ █" " █"] ["█ █" " █ " "█ " " █" " █" " █" "█ █" " █" "█ █" " █"]
["███" "███" "███" "███" " █" "███" "███" " █" "███" "███"]]) ["███" "███" "███" "███" " █" "███" "███" " █" "███" "███"]])
(setq figlet-lean (setq figlet-lean
[["┌──┐" "╶┐ " "╶──┐" "╶──┐" "╷ ╷" "┌──╴" "┌──╴" "╶──┐" "┌──┐" "┌──┐"] [["┌──┐" "╶┐ " "╶──┐" "╶──┐" "╷ ╷" "┌──╴" "┌──╴" "╶──┐" "┌──┐" "┌──┐"]
["│ │" " │ " " │" " │" "│ │" "│ " "│ " " │" "│ │" "│ │"] ["│ │" " │ " " │" " │" "│ │" "│ " "│ " " │" "│ │" "│ │"]
["│ │" " │ " "┌──┘" "╶──┤" "└──┤" "└──┐" "├──┐" " │" "├──┤" "└──┤"] ["│ │" " │ " "┌──┘" "╶──┤" "└──┤" "└──┐" "├──┐" " │" "├──┤" "└──┤"]
["│ │" " │ " "│ " " │" " │" " │" "│ │" " │" "│ │" " │"] ["│ │" " │ " "│ " " │" " │" " │" "│ │" " │" "│ │" " │"]
["└──┘" "╶┴╴" "└──╴" "╶──┘" " ╵" "╶──┘" "└──┘" " ╵" "└──┘" "╶──┘"]]) ["└──┘" "╶┴╴" "└──╴" "╶──┘" " ╵" "╶──┘" "└──┘" " ╵" "└──┘" "╶──┘"]])
(defun figlet-digit (digit row) (defun figlet-digit (digit row)
(aref (aref figlet-lean row) digit)) (aref (aref figlet-lean row) digit))
(defun figlet-num (number row) (defun figlet-num (number row)
(let ((n number) (let ((n number)
(d (list))) (d (list)))
(while (> n 0) (while (> n 0)
(setq d (append (list (mod n 10)) d)) (setq d (append (list (mod n 10)) d))
(setq n (/ n 10))) (setq n (/ n 10)))
(string-join (mapcar (string-join (mapcar
(lambda (digit) (concat (figlet-digit digit row) " ")) (lambda (digit) (concat (figlet-digit digit row) " "))
d)))) d))))
(defun org-agenda-format-date-figlet (date) (defun org-agenda-format-date-figlet (date)
"Format a DATE string for display in the daily/weekly agenda. "Format a DATE string for display in the daily/weekly agenda.
This function makes sure that dates are aligned for easy reading." This function makes sure that dates are aligned for easy reading."
;(require 'cal-iso) ;(require 'cal-iso)
(let* ((dayname (calendar-day-name date)) (let* ((dayname (calendar-day-name date))
(day (cadr date)) (day (cadr date))
(day-of-week (calendar-day-of-week date)) (day-of-week (calendar-day-of-week date))
(month (car date)) (month (car date))
(monthname (calendar-month-name month)) (monthname (calendar-month-name month))
(year (nth 2 date))nf (year (nth 2 date))nf
(iso-week (org-days-to-iso-week (iso-week (org-days-to-iso-week
(calendar-absolute-from-gregorian date))) (calendar-absolute-from-gregorian date)))
(weekyear (cond ((and (= month 1) (>= iso-week 52)) (weekyear (cond ((and (= month 1) (>= iso-week 52))
(1- year)) (1- year))
((and (= month 12) (<= iso-week 1)) ((and (= month 12) (<= iso-week 1))
(1+ year)) (1+ year))
(t year))) (t year)))
(weekstring (if (= day-of-week 1) (weekstring (if (= day-of-week 1)
(format " W%02d" iso-week) (format " W%02d" iso-week)
""))) "")))
(format (concat "\n" (format (concat "\n"
"%-13s %s %4d%s\n" "%12s %s %4d%s\n"
"%-13s\n" "%12s \n"
"%-13s %-10s\n" "%12s %-10s\n"
"%-13s\n" "%12s \n"
"%-13s %s\n") "%12s %s\n")
(figlet-num day 0) monthname year weekstring (figlet-num day 0) monthname year weekstring
(figlet-num day 1) (figlet-num day 1)
(figlet-num day 2) dayname (figlet-num day 2) dayname
(figlet-num day 3) (figlet-num day 3)
(figlet-num day 4) (sunrise-sunset)))) (figlet-num day 4) (sunrise-sunset))))
(setq org-agenda-format-date #'org-agenda-format-date-figlet) (setq org-agenda-format-date #'org-agenda-format-date-figlet)
(setq org-agenda-prefix-format
'((agenda . " %i %9c · %?-12t% s")
(todo . " %i %9c · ")
(tags . " %i %9c · ")
(search . " %i %9c · ")))
#+end_src
- Add a whiteline after the header Now, this is a horrible hack:
the string that forms the header is obtained by constructing
some pretty-text in a temporary buffer and then retrieving the
string with #'buffer-string Hence we add (and remove) an advice
to the function buffer-string that concat's a newline around
each function that produces the headers
#+begin_src emacs-lisp
(defun concat-newline (s)
(concat s "\n"))
(mapcar (lambda (fun)
(advice-add fun :around
(lambda (orig-fun &rest args)
(advice-add #'buffer-string :filter-return #'concat-newline)
(apply orig-fun args)
(advice-remove #'buffer-string #'concat-newline))))
'(org-tags-view org-todo-list))
#+end_src
#+begin_src emacs-lisp
(advice-add #'org-agenda--insert-overriding-header :filter-args
(lambda (params)
(list `(concat ,(car params) "\n"))))
#+end_src #+end_src
Improve the org-habit graph thing Improve the org-habit graph thing
#+begin_src emacs-lisp #+begin_src emacs-lisp
(setq org-habit-regular-glyph ?□ (setq org-habit-regular-glyph ?□

Loading…
Cancel
Save