summaryrefslogtreecommitdiff
path: root/modeline.el
blob: a564a103a4df6a428b787148c2b65591f8d7b034 (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
64
65
66
;;;###autoload
(defun modeline-format-main ()
  "The main mode line format."
  (let ((left (modeline-format-left))
	(right (modeline-format-right))
	(left-len (length left))
	(right-len (length right))
	(middle (propertize " " 'display
			    (make-string (- (window-width)
					    left-len
					    right-len)
					 32))))
    (concat left middle right)))

;;;###autoload
(defun modeline-format-left ()
  "The left mode line format."
  )

;;;###autoload
(defvar modeline-bar-width 3
  "The width of the mode line bar")

;;;###autoload
(defvar modeline-bar-height 27
  "The height of the mode line bar")

;;;###autoload
(defun modeline-format-bar ()
  "We need a bar to ensure the mode line has the specified height."
  (cond
   ((and (display-graphic-p)
         (image-type-available-p 'xpm))
    (propertize
     " " 'display
     (let ((data (make-list modeline-bar-height
			    (make-list modeline-bar-width 97)))
	   (color (face-background 'modus-theme-active-blue nil t)))
       (ignore-errors
	 (create-image
	  (concat
	   "/* XPM */\nstatic char * bar[]={\n"
	   (format "\"%d %d 1 1\",\n\"a c %s\",\n"
		   modeline-bar-width modeline-bar-height
		   color)
	   (mapconcat
	    (lambda (row)
	      (format "\"%s\""
		      (apply #'string row)))
	    data ",\n")
	   "\n};")
	  'xpm t :ascent 'center)))))))

;;;###autoload
(defun modeline-format-right ()
  "The right mode line format.")







(setq mode-line-format '("%e" (:eval (modeline-format-main))))