summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbenjamin <benjamin.lindqvist@gmail.com>2018-10-02 22:47:49 +0200
committerbenjamin <benjamin.lindqvist@gmail.com>2018-10-02 22:47:49 +0200
commit462ba385fcd04ba6772f1aca3379d5e7acfeedea (patch)
treed08d68c2360ca947a0aeee7ed1b07253ec336771
parente4581850dd705740a5ccc2acdc91cce0eef1b0ae (diff)
Prototype customization improvement
-rw-r--r--feebleline-test.el63
1 files changed, 63 insertions, 0 deletions
diff --git a/feebleline-test.el b/feebleline-test.el
new file mode 100644
index 0000000..5bf4da7
--- /dev/null
+++ b/feebleline-test.el
@@ -0,0 +1,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))
+
+
+
+
+
+
+ ;