From c6d4ada60ff19dfaf8ac0fa6d2346bf552f172c8 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Mon, 27 Apr 2015 12:39:53 +0200 Subject: Rename my-smt to oni-smt --- emacs/.emacs.d/Makefile | 2 +- emacs/.emacs.d/init.el | 4 +- emacs/.emacs.d/site-lisp/my-smt.el | 176 ------------------------------------ emacs/.emacs.d/site-lisp/oni-smt.el | 174 +++++++++++++++++++++++++++++++++++ 4 files changed, 177 insertions(+), 179 deletions(-) delete mode 100644 emacs/.emacs.d/site-lisp/my-smt.el create mode 100644 emacs/.emacs.d/site-lisp/oni-smt.el diff --git a/emacs/.emacs.d/Makefile b/emacs/.emacs.d/Makefile index 11f3640..d7528a4 100644 --- a/emacs/.emacs.d/Makefile +++ b/emacs/.emacs.d/Makefile @@ -1,5 +1,5 @@ .PHONY: all site-lisp -all: init2.elc init.elc site-lisp/my-smt.elc site-lisp/appt-init.elc \ +all: init2.elc init.elc site-lisp/oni-smt.elc site-lisp/appt-init.elc \ site-lisp/jabber-init.elc site-lisp/org-init.elc \ site-lisp/gnus-init.elc site-lisp/drd.elc diff --git a/emacs/.emacs.d/init.el b/emacs/.emacs.d/init.el index f6d2308..44a200e 100644 --- a/emacs/.emacs.d/init.el +++ b/emacs/.emacs.d/init.el @@ -678,8 +678,8 @@ For `python-mode' I prefer `python-imenu-create-flat-index'." (load-theme 'yoshi t) (require 'svg-mode-line-themes) (smt/enable) - (require 'my-smt) - (smt/set-theme 'my-smt) + (require 'oni-smt) + (smt/set-theme 'oni-smt) (set-face-attribute 'mode-line nil :box nil) (set-face-attribute 'mode-line-inactive nil :box nil)))) diff --git a/emacs/.emacs.d/site-lisp/my-smt.el b/emacs/.emacs.d/site-lisp/my-smt.el deleted file mode 100644 index 4c4f6ee..0000000 --- a/emacs/.emacs.d/site-lisp/my-smt.el +++ /dev/null @@ -1,176 +0,0 @@ -;;; my-smt.el --- My SVG mode-line theme -*- lexical-binding: t; -*- - -;; Copyright (C) 2014 Tom Willemse - -;; Author: Tom Willemse -;; Keywords: faces - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: - -;; - -;;; Code: - -(require 'svg-mode-line-themes) -(require 'flycheck) -(require 'cl) - -(defun oni-smt-flycheck-errors-text (_) - "Show an indicator of the number of errors and warnings from flycheck." - (when flycheck-mode - (let* ((counts (flycheck-count-errors flycheck-current-errors)) - (err-color (if (smt/window-active-p) "#a85454" "#969696")) - (warn-color (if (smt/window-active-p) "#a88654" "#969696")) - (info-color (if (smt/window-active-p) "#5476a8" "#969696")) - (err-count (alist-get 'error counts 0)) - (warn-count (alist-get 'warning counts 0)) - (info-count (alist-get 'info counts 0))) - `(tspan " " (tspan :fill ,err-color ,err-count) - "/" (tspan :fill ,warn-color ,warn-count) - "/" (tspan :fill ,info-color ,info-count))))) - -(smt/defwidget oni-smt-flycheck-errors - :text #'oni-smt-flycheck-errors-text) - -(smt/defwidget my-smt-jabber-activity - :text (lambda (widget) - (ignore widget) - (if (and (smt/window-active-p) - (boundp 'jabber-activity-mode-string) - (not (equal jabber-activity-mode-string ""))) - (concat jabber-activity-mode-string " ")))) - -;;; TODO Turn: -;; #("message: (FORMAT-STRING &rest ARGS)" -;; 0 7 (face font-lock-function-name-face) -;; 10 23 (face eldoc-highlight-function-argument)) -;;; into: -;;; (tspan (tspan :fill (fg-color font-lock-function-name-face) "message:") -;;; " (" -;;; (tspan :fill (fg-color highlight-function-argument) "FORMAT-STRING") -;;; " &rest ARGS)") -(defun my-smt-eldoc-minibuffer-message (format-string &rest args) - (if (minibufferp) - (progn - (add-hook 'minibuffer-exit-hook - (lambda () (setq my-smt-eldoc-message nil - eldoc-mode-line-string nil - eldoc-last-message nil)) - nil t) - (setq my-smt-eldoc-message - (when (stringp format-string) - (apply 'format format-string args))) - (force-mode-line-update t)) - (apply 'message format-string args))) - -(defvar my-smt-eldoc-message nil) -(smt/defwidget my-smt-eldoc-message - :text (lambda (widget) - (ignore widget) - (when my-smt-eldoc-message - `(tspan :fill "#bfbfbf" " (" (tspan :fill "#5476a8" ,my-smt-eldoc-message) ")")))) - -(defun my-smt-yoshi-title-style (widget) - "Fill color for either active or inactive windows. - -WIDGET is ignored." - (ignore widget) - (list :fill (if (smt/window-active-p) - "#a85454" - "#969696"))) - -(smt/defwidget my-smt-po-counters - :text (lambda (widget) - (ignore widget) - (when (eql major-mode 'po-mode) - (format " %dt+%df+%du+%do" po-translated-counter - po-fuzzy-counter po-untranslated-counter - po-obsolete-counter)))) - -(smt/defwidget my-smt-buffer-identification - :style 'my-smt-yoshi-title-style - :text (lambda (widget) - (ignore widget) - (concat - (s-trim - (substring-no-properties - (format-mode-line mode-line-buffer-identification))) - (when (and (or buffer-file-name - buffer-offer-save) - (buffer-modified-p)) - "*")))) - -(smt/defwidget my-smt-current-dictionary - :text (lambda (widget) - (ignore widget) - (if flyspell-mode - (concat " " (or ispell-current-dictionary - ispell-local-dictionary - flyspell-default-dictionary))))) - -(smt/defwidget my-smt-position - :text (lambda (widget) - (ignore widget) - (format-mode-line "%l/%c:%p"))) - -(defun my-smt-extra-minor-modes (minor-modes) - "Add some more info to MINOR-MODES." - (if (boundp 'evil-state) - (let ((l (capitalize (elt (symbol-name evil-state) 0)))) - `(tspan ,minor-modes (tspan :fill "#54a875" ,(char-to-string l)))) - minor-modes)) - -(add-function - :filter-return - (symbol-function 'smt/minor-mode-indicator-text) - #'my-smt-extra-minor-modes) - -(smt/defrow my-smt-right - :prototype 'default-right - :widgets '(my-smt-jabber-activity - major-mode - my-smt-current-dictionary - oni-smt-flycheck-errors - version-control minor-modes) - :margin 16) - -(smt/defrow my-smt-left - :prototype 'default-left - :widgets '(buffer-info my-smt-buffer-identification my-smt-po-counters - which-function my-smt-eldoc-message)) - -(smt/defrow my-smt-position - :prototype 'default-position - :widgets '(my-smt-position)) - -(defun my-smt-major-mode-style (widget) - (ignore widget) - '(:fill "#ccc" :font-family "Fantasque Sans" :filter nil - :font-weight "bold" :font-style "italic")) - -(smt/deftheme my-smt - :prototype 'black-crystal - :local-widgets (list (cons 'major-mode - (smt/make-widget - :prototype 'major-mode - :style 'my-smt-major-mode-style))) - :rows '(my-smt-left my-smt-position my-smt-right)) - -(add-function :override (symbol-function 'eldoc-minibuffer-message) - #'my-smt-eldoc-minibuffer-message) - -(provide 'my-smt) -;;; my-smt.el ends here diff --git a/emacs/.emacs.d/site-lisp/oni-smt.el b/emacs/.emacs.d/site-lisp/oni-smt.el new file mode 100644 index 0000000..7568358 --- /dev/null +++ b/emacs/.emacs.d/site-lisp/oni-smt.el @@ -0,0 +1,174 @@ +;;; oni-smt.el --- My SVG mode-line theme -*- lexical-binding: t; -*- + +;; Copyright (C) 2014 Tom Willemse + +;; Author: Tom Willemse +;; Keywords: faces + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . + +;;; Commentary: + +;; + +;;; Code: + +(require 'svg-mode-line-themes) +(require 'flycheck) +(require 'cl) + +(defun oni-smt-flycheck-errors-text (_) + "Show an indicator of the number of errors and warnings from flycheck." + (when flycheck-mode + (let* ((counts (flycheck-count-errors flycheck-current-errors)) + (err-color (if (smt/window-active-p) "#a85454" "#969696")) + (warn-color (if (smt/window-active-p) "#a88654" "#969696")) + (info-color (if (smt/window-active-p) "#5476a8" "#969696")) + (err-count (alist-get 'error counts 0)) + (warn-count (alist-get 'warning counts 0)) + (info-count (alist-get 'info counts 0))) + `(tspan " " (tspan :fill ,err-color ,err-count) + "/" (tspan :fill ,warn-color ,warn-count) + "/" (tspan :fill ,info-color ,info-count))))) + +(smt/defwidget oni-smt-flycheck-errors + :text #'oni-smt-flycheck-errors-text) + +(defun oni-smt-jabber-activity-text (_) + "Show jabber activity indicator." + (if (and (smt/window-active-p) + (boundp 'jabber-activity-mode-string) + (not (equal jabber-activity-mode-string ""))) + (concat jabber-activity-mode-string " "))) + +(smt/defwidget oni-smt-jabber-activity + :text #'oni-smt-jabber-activity-text) + +;;; TODO Turn: +;; #("message: (FORMAT-STRING &rest ARGS)" +;; 0 7 (face font-lock-function-name-face) +;; 10 23 (face eldoc-highlight-function-argument)) +;;; into: +;;; (tspan (tspan :fill (fg-color font-lock-function-name-face) "message:") +;;; " (" +;;; (tspan :fill (fg-color highlight-function-argument) "FORMAT-STRING") +;;; " &rest ARGS)") +(defun oni-smt-eldoc-minibuffer-message (format-string &rest args) + (if (minibufferp) + (progn + (add-hook 'minibuffer-exit-hook + (lambda () (setq oni-smt-eldoc-message nil + eldoc-mode-line-string nil + eldoc-last-message nil)) + nil t) + (setq oni-smt-eldoc-message + (when (stringp format-string) + (apply 'format format-string args))) + (force-mode-line-update t)) + (apply 'message format-string args))) + +(defvar oni-smt-eldoc-message nil) +(smt/defwidget oni-smt-eldoc-message + :text (lambda (widget) + (ignore widget) + (when oni-smt-eldoc-message + `(tspan :fill "#bfbfbf" " (" (tspan :fill "#5476a8" ,oni-smt-eldoc-message) ")")))) + +(defun oni-smt-yoshi-title-style (_) + "Fill color for either active or inactive windows." + (list :fill (if (smt/window-active-p) "#65a854" "#969696") + :font-weight (if (smt/window-active-p) "bold" "normal"))) + +(smt/defwidget oni-smt-po-counters + :text (lambda (widget) + (ignore widget) + (when (eql major-mode 'po-mode) + (format " %dt+%df+%du+%do" po-translated-counter + po-fuzzy-counter po-untranslated-counter + po-obsolete-counter)))) + +(smt/defwidget oni-smt-buffer-identification + :style 'oni-smt-yoshi-title-style + :text (lambda (widget) + (ignore widget) + (concat + (s-trim + (substring-no-properties + (format-mode-line mode-line-buffer-identification))) + (when (and (or buffer-file-name + buffer-offer-save) + (buffer-modified-p)) + "*")))) + +(smt/defwidget oni-smt-current-dictionary + :text (lambda (widget) + (ignore widget) + (if flyspell-mode + (concat " " (or ispell-current-dictionary + ispell-local-dictionary + flyspell-default-dictionary))))) + +(smt/defwidget oni-smt-position + :text (lambda (widget) + (ignore widget) + (format-mode-line "%l/%c:%p"))) + +(defun oni-smt-extra-minor-modes (minor-modes) + "Add some more info to MINOR-MODES." + (if (boundp 'evil-state) + (let ((l (capitalize (elt (symbol-name evil-state) 0)))) + `(tspan ,minor-modes (tspan :fill "#54a875" ,(char-to-string l)))) + minor-modes)) + +(add-function + :filter-return + (symbol-function 'smt/minor-mode-indicator-text) + #'oni-smt-extra-minor-modes) + +(smt/defrow oni-smt-right + :prototype 'default-right + :widgets '(oni-smt-jabber-activity + major-mode + oni-smt-current-dictionary + oni-smt-flycheck-errors + version-control minor-modes) + :margin 16) + +(smt/defrow oni-smt-left + :prototype 'default-left + :widgets '(buffer-info oni-smt-buffer-identification oni-smt-po-counters + which-function oni-smt-eldoc-message)) + +(smt/defrow oni-smt-position + :prototype 'default-position + :widgets '(oni-smt-position)) + +(defun oni-smt-major-mode-style (widget) + (ignore widget) + '(:fill "#ccc" :font-family "Fantasque Sans" :filter nil + :font-weight "bold" :font-style "italic")) + +(smt/deftheme oni-smt + :prototype 'black-crystal + :local-widgets (list (cons 'major-mode + (smt/make-widget + :prototype 'major-mode + :style 'oni-smt-major-mode-style))) + :rows '(oni-smt-left oni-smt-position oni-smt-right)) + +(add-function :override (symbol-function 'eldoc-minibuffer-message) + #'oni-smt-eldoc-minibuffer-message) + +(provide 'oni-smt) +;;; oni-smt.el ends here -- cgit v1.2.3-54-g00ecf