summaryrefslogtreecommitdiff
path: root/feebleline-test.el
blob: 5bf4da7cf9e151e4a0152c17f544ba820ad191fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63



;;; Code:

(defvar feebleline-msg-functions nil)

(defun my-own-linecol-string ()
  "Hey guy!"
  (format "%5s:%-2s" (format-mode-line "%l") (current-column)))

(setq
 feebleline-msg-functions
 '(
   (my-own-linecol-string)
   (buffer-file-name
    ((face . feebleline-dir-face) (post . "")))
   ((lambda () ":") ((post . "")))
   (magit-get-current-branch ((face . font-lock-comment-face)))
   ((lambda () "some string") ((pre . "@")))
   ))

;; and you can append stuff (todo: wrapper function)
(add-to-list
 'feebleline-msg-functions
 '((lambda () "end") ((pre . "/")
                      (face . font-lock-comment-face)))
 t
 (lambda (x y) nil))

(defun feebleline--insert ()
  "Insert stuff into the mini buffer."
  (let ((tmp-string ""))
    (dolist (idx feebleline-msg-functions)
      (let ((string-func (car idx) )
            (props (cadr  idx)))
        (let ((string-face (cdr (assoc 'face props)))
              (pre (cdr (assoc 'pre props)))
              (post (cdr (assoc 'post props)))
              )
          (unless string-face (setq string-face 'feebleline-default-face))
          (unless post (setq post " "))
          ;; todo: format string as a variable?
          (setq
           tmp-string
           (concat tmp-string (propertize
                               (concat pre
                                       (apply string-func nil)
                                       post)
                               'face string-face))))))
    (with-current-buffer " *Minibuf-0*"
      (erase-buffer)
      (insert tmp-string))))

(defvar feebleline--new-timer)
(setq feebleline--new-timer (run-with-timer 0 1 'feebleline--insert))






                                        ;