Improve indent

master
Jacopo De Simoi 2 years ago
parent e0625ff8ca
commit 617c21afc5
  1. 196
      global.org

@ -1270,114 +1270,114 @@
#+end_src #+end_src
- Sleeker time-grid - Sleeker time-grid
#+begin_src emacs-lisp #+begin_src emacs-lisp
(setq org-agenda-time-grid '((daily today require-timed remove-match) (setq org-agenda-time-grid '((daily today require-timed remove-match)
(800 900 1000 1100 1200 1300 1400 1500 1600 1700 1800 1900 2000) (800 900 1000 1100 1200 1300 1400 1500 1600 1700 1800 1900 2000)
" ······· " "───────────────") " ······· " "───────────────")
org-agenda-current-time-string "····· now ·····" org-agenda-current-time-string "····· now ·····"
org-agenda-time-leading-zero t) org-agenda-time-leading-zero t)
#+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)
(if (not (eq 'day org-agenda-current-span)) (if (not (eq 'day org-agenda-current-span))
(concat "\n" (org-agenda-format-date-aligned date) (concat "\n" (org-agenda-format-date-aligned date)
" ────────────────────────────────────────────────────\n") " ────────────────────────────────────────────────────\n")
(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"
"%9s %s %4d%s\n" "%9s %s %4d%s\n"
"%9s \n" "%9s \n"
"%9s %-10s\n" "%9s %-10s\n"
"%9s \n" "%9s \n"
"%9s %s\n") "%9s %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 (setq org-agenda-prefix-format
'((agenda . " %i %6c %s %?-12t") '((agenda . " %i %6c %s %?-12t")
(todo . " %i %6c · ") (todo . " %i %6c · ")
(tags . " %i %6c · ") (tags . " %i %6c · ")
(search . " %i %6c · "))) (search . " %i %6c · ")))
(advice-add 'org-agenda-get-scheduled :around (advice-add 'org-agenda-get-scheduled :around
(lambda (orig-fun &rest args) (lambda (orig-fun &rest args)
"Only show habits on day wiew, not on week view" "Only show habits on day wiew, not on week view"
(let ((org-habit-show-habits (let ((org-habit-show-habits
(with-current-buffer org-agenda-buffer (eq org-agenda-current-span 'day)))) (with-current-buffer org-agenda-buffer (eq org-agenda-current-span 'day))))
(apply orig-fun args)))) (apply orig-fun args))))
#+end_src #+end_src
- Add a whiteline after the header Now, this is a horrible hack: - Add a whiteline after the header Now, this is a horrible hack:
the string that forms the header is obtained by constructing the string that forms the header is obtained by constructing
some pretty-text in a temporary buffer and then retrieving the some pretty-text in a temporary buffer and then retrieving the
string with #'buffer-string Hence we add (and remove) an advice string with #'buffer-string Hence we add (and remove) an advice
to the function buffer-string that concat's a newline around to the function buffer-string that concat's a newline around
each function that produces the headers each function that produces the headers
#+begin_src emacs-lisp #+begin_src emacs-lisp
(defun concat-newline (s) (defun concat-newline (s)
(concat s "\n")) (concat s "\n"))
(dolist (fun '(org-tags-view org-todo-list)) (dolist (fun '(org-tags-view org-todo-list))
(advice-add fun :around (advice-add fun :around
(lambda (orig-fun &rest args) (lambda (orig-fun &rest args)
(advice-add #'buffer-string :filter-return #'concat-newline) (advice-add #'buffer-string :filter-return #'concat-newline)
(apply orig-fun args) (apply orig-fun args)
(advice-remove #'buffer-string #'concat-newline)))) (advice-remove #'buffer-string #'concat-newline))))
#+end_src #+end_src
#+begin_src emacs-lisp #+begin_src emacs-lisp
(advice-add #'org-agenda--insert-overriding-header :filter-args (advice-add #'org-agenda--insert-overriding-header :filter-args
(lambda (params) (lambda (params)
(list `(concat ,(car params) "\n")))) (list `(concat ,(car params) "\n"))))
#+end_src #+end_src
#+begin_src emacs-lisp #+begin_src emacs-lisp
(defun wilder/delta-list (l op) (defun wilder/delta-list (l op)
(unless (< (length l) 2) (unless (< (length l) 2)
(cons (funcall op (car l) (cadr l)) (wilder/delta-list (cdr l) op)))) (cons (funcall op (car l) (cadr l)) (wilder/delta-list (cdr l) op))))

Loading…
Cancel
Save