---
(progn
(if (not (boundp 'prefs-advanced-user-p))
(setq prefs-advanced-user-p t))
(if (not (boundp 'prefs-home-emacs-p))
(setq prefs-home-emacs-p t))
(require 'early-bindings)
(require 'd-electric)
)
(defun d-groups-get-face (dirname)
(if (not dirname)
(list "#ccc" "#000")
(save-match-data
(assert (boundp 'c2java-version))
(setq dirname (expand-file-name dirname))
(if (and dirname
(not (file-directory-p dirname)))
(setq dirname (file-name-directory dirname)))
(if (and dirname
(file-directory-p dirname)
(not (string-match "/$" dirname)))
(setq dirname (concat dirname "/")))
(let ((black "#000")
(rq-c2java-version (regexp-quote c2java-version))
(case-fold-search t)
(rv nil))
(cond
((or (string-match "/bak/" dirname)
(string-match "/old/" dirname)
(string-match "/test.texinfo$" dirname))
(list "#f44" black nil 'bold))
((string-match "/output/" dirname)
(list "#0ff" black))
((and prefs-home-emacs-p (string-match "/ro[a-z-]*/" dirname))
(list "#f88" "yellow"))
((and prefs-home-emacs-p
(string-match "/lisp\\+\\+-projects/2006/libd/" dirname)
)
(list "#00ffff" "#ff0000"))
((and prefs-home-emacs-p
(string-match "/lisp\\+\\+-projects/2018/map[0-9]?/" dirname)
)
(list "goldenrod" "springgreen"))
((and prefs-home-emacs-p
(or (string-match "^/home/www/c2java/" dirname)
(string-match (format "^/home/www/2016/c2java-1%s/" rq-c2java-version) dirname)
(string-match (format "^/home/www/hairy-lemon/src/50webs-com/research/2016/c2java-%s/" rq-c2java-version) dirname)
(string-match (format "^c:/home/hairy-lemon/src/50webs-com/research/2016/c2java-%s/" rq-c2java-version) dirname)
(string-match (format "^/media/www/C1TB/home/hairy-lemon/src/50webs-com/research/2016/c2java-%s/" rq-c2java-version) dirname)
))
(list "#fc0" black))
((or (string-match "/home/www/2015/c2java-1\\.[0-9]+/" dirname)
(string-match "/home/www/hairy-lemon/src/50webs-com/research/2015/c2java-1\\.[0-9]+/" dirname)
(string-match "/media/www/C1TB/home/hairy-lemon/src/50webs-com/research/2015/c2java-1\\.[0-9]+/" dirname))
(list "#f00" "#ff0"))
((or (string-match "/jtw-tutorials-here/" dirname)
(string-match "/jtw-tutorials-here/[-a-zA-Z0-9_]*\\.el$" dirname)
(string-match "/jtw-tutorials-here/Makefile$" dirname)
(string-match "hairy-lemon/src/50webs-com/J\\.T\\.W/texinfo/texinfo\\.tex$" dirname)
(string-match "lisp\\+\\+-projects-\\(unix\\|dos\\)" dirname))
(list "#f0f" black))
((string-match "/jtw-tutorials/" dirname)
(list black "#ffaabb"))
((progn (condition-case err (setq rv (string-match
(concat (regexp-quote "/lisp++-projects/")
"$") dirname))
(error
(message "Error matching regexp"))
)
rv)
(list black "#0f0"))
((or (string-match "/tutorial-[0-9]+/" dirname)
(string-match "/jtw-tutorials/" dirname)
)
(list "#f88" "black"))
((or (string-match "/hairy-lemon/" dirname)
(string-match "/book/" dirname)
(string-match "~/here/" dirname)
)
(list black "#0f0" nil 'bold))
((string-match "/Downloads/" dirname)
(setq truncate-lines t)
(list black "#88f"))
((or (string-match "/bak/" dirname)
(string-match "/TRASHCAN/" dirname)
(string-match "/RECYCLER/" dirname)
(string-match "/System Volume Information/" dirname))
(list "#f00" "#ff0"))
((string-match "/R4/" dirname)
(list "#ff0" black))
((string-match "/dlisp/" dirname)
(list "#8f8" "#000"))
((and prefs-home-emacs-p
(or (string-match "/cosc/" dirname)
(string-match "/java-projects/" dirname)))
(list "#fc0" black))
((string-match "/Driver Pack Solution/" dirname)
(list "#ff8" black))
((or (string-match "/My Documents/" dirname)
(string-match "/Davin's Stuff/" dirname))
(list black "#0f0"))
((or (string-match "^/media/www/C1TB/" dirname)
(string-match "^/home/www/C/" dirname))
(list "#ffffff" black 'italic 'bold))
((or (string-match "^/media/www/F2TB/" dirname)
(string-match "^/home/www/F/" dirname))
(list "#f0f" black 'italic 'bold))
((or (string-match "^/media/www/G16GB/" dirname)
(string-match "^/home/www/G/" dirname))
(list "#0ff" black 'italic 'bold))
((or (string-match "^/media/www/[-a-zA-Z0-9_:]+/" dirname)
(string-match "^/home/www/[A-Z]/" dirname))
(list "#0ff" black 'italic 'bold))
((or (string-match "^[a-z]:/wamp/" dirname)
(string-match "^/home/www/\\(headers\\|plugins\\|themes\\|wp\\|varwww\\)/" dirname)
(string-match "^/var/www/" dirname))
(list "#faf" black))
((string-match (concat "^" (safe-expand-file-name (getenv "HOME")) "/") dirname)
(list "#ccf" black))
((string-match "^[a-zA-Z]:/" dirname)
(list "#fcc" black))
(t
(list "#ccc" black)))))))
(defun f5 ()
(interactive)
(read-only-mode -1)
(put-text-property (point-at-bol) (1+ (point-at-eol)) 'face 'line000)
)
(when prefs-davins-keybindings-online-p
(global-set-key [f5] 'f5)
)
(defadvice electric-buffer-menu-mode (around d-groups activate)
(setq font-lock-keywords nil)
ad-do-it
(save-excursion
(save-match-data
(let (array elt)
(setq array (make-vector 1000 0))
(let ((i 0) (len (length array)))
(while (< i len)
(aset array i (d-read-str (eval (format "line%03d" i))))
(setq elt (aref array i))
(make-face elt)
(incf i)
))
(let (string (case-fold-search t) f (i 0) (len (length array)))
(read-only-mode -1)
(goto-char (point-min))
(while (and (not (eobp)) (< i len))
(assert (< i len))
(setq string (d-current-line-as-string))
(save-match-data
(if (string-match "[ ][ ]+\\(/\\|[a-zA-Z]:/\\|~[a-z]*/\\)[-() /a-zA-Z0-9_+.]*$" string)
(progn (setq string (substring string (match-beginning 1)))
)
(setq string nil)
))
(setq f (if string
(d-groups-get-face string)
(list "#fff" "#080" 'italics)))
(setq c1 (nth 0 f))
(setq c2 (nth 1 f))
(setq c-italic (nth 2 f))
(setq c-bold (nth 3 f))
(setq elt (aref array i))
(set-face-background elt c1)
(set-face-foreground elt c2)
(if c-italic
(make-face-italic elt)
(make-face-unitalic elt))
(if c-bold
(make-face-bold elt)
(make-face-unbold elt))
(read-only-mode -1)
(put-text-property (point-at-bol) (1+ (point-at-eol)) 'face elt)
(incf i)
(forward-line)))
) ) ) (read-only-mode 1)
)
(byte-compile 'electric-buffer-menu-mode)
(defun d-groups-online ()
(interactive)
(progn
(add-hook 'post-command-hook 'd-groups-modeline-hook)
))
(defun d-groups-offline ()
(interactive)
(setq post-command-hook (remq 'd-groups-modeline-hook post-command-hook)))
(d-groups-online)
(when prefs-davins-keybindings-online-p
)
(progn
(setq d-groups-obarray (make-vector 11 nil))
(intern "prior" d-groups-obarray)
(intern "next" d-groups-obarray)
(intern "up" d-groups-obarray)
(intern "down" d-groups-obarray)
(intern "left" d-groups-obarray)
(intern "right" d-groups-obarray))
(defun d-groups-modeline-hook ()
(interactive)
(if (and (not (numberp last-command-event))
(intern-soft
(prin1-to-string last-command-event)
d-groups-obarray))
t
(let (f list c1 c2 is-italic is-bold)
(setq f (buffer-file-name))
(if (eq major-mode 'dired-mode)
(setq f dired-directory)
(if (eq major-mode 'compilation-mode)
(setq f default-directory)))
(setq list (d-groups-get-face f))
(setq c1 (car list)) (setq c2 (cadr list))
(setq is-italic (caddr list))
(setq is-bold (cadddr list))
(if c1 (set-face-background 'mode-line c1))
(if c2 (set-face-foreground 'mode-line c2))
(if c1 (set-face-background 'mode-line-buffer-id c1))
(if c2 (set-face-foreground 'mode-line-buffer-id c2))))
t
)
(d-quote
(if is-italic
(progn
(make-face-italic 'mode-line)
(make-face-italic 'mode-line-buffer-id))
(progn
(make-face-unitalic 'mode-line)
(make-face-unitalic 'mode-line-buffer-id))
)
(if is-bold
(progn
(make-face-bold 'mode-line)
(make-face-bold 'mode-line-buffer-id))
(progn
(make-face-unbold 'mode-line)
(make-face-unbold 'mode-line-buffer-id))
)
(make-face-bold 'mode-line-buffer-id)
)
(byte-compile 'd-groups-get-face)
(byte-compile 'd-groups-modeline-hook)
(defadvice d-recenter (after d-groups activate)
(when (not (memq 'd-groups-modeline-hook post-command-hook))
(d-beeps "*** Warning post-command-hook missing d-groups-modeline-hook")
(add-hook 'post-command-hook 'd-groups-modeline-hook)
))
(when prefs-davins-keybindings-online-p
(global-set-key [f5] 'flk)
)
(defun flk ()
(interactive)
(describe-variable 'font-lock-keywords))
(provide 'd-groups)