Improve indent

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

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

Loading…
Cancel
Save