Klimi's new dotfiles with stow.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

73 lines
3.0 KiB

преди 5 години
  1. ;;; solarized-theme-utils.el --- Utilities for solarized theme development
  2. ;; Copyright (C) 2012 Thomas Frössman
  3. ;; Author: Thomas Frössman <thomasf@jossystem.se>
  4. ;; URL: http://github.com/bbatsov/solarized-emacs
  5. ;; This program is free software; you can redistribute it and/or modify
  6. ;; it under the terms of the GNU General Public License as published by
  7. ;; the Free Software Foundation, either version 3 of the License, or
  8. ;; (at your option) any later version.
  9. ;; This program is distributed in the hope that it will be useful,
  10. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. ;; GNU General Public License for more details.
  13. ;; You should have received a copy of the GNU General Public License
  14. ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. ;;; Commentary:
  16. ;;
  17. ;; Development utilities, these are not needed for normal theme usage
  18. ;;
  19. ;;;; Code:
  20. (require 'cl-lib)
  21. (require 'solarized)
  22. (defun solarized-import-faces (&optional regexp already-defined)
  23. "Imports current effective face definitions by regular expression
  24. in the format of solarized-theme.el."
  25. (interactive (list (read-regexp "List faces matching regexp")))
  26. (let*
  27. ((all-faces (zerop (length regexp)))
  28. (faces
  29. (delq nil
  30. (mapcar (lambda (face)
  31. (let ((s (symbol-name face)))
  32. (when (or all-faces (string-match regexp s))
  33. face)))
  34. (sort (face-list) #'string-lessp)))))
  35. (mapc (lambda(face)
  36. (when (or (not (get face 'theme-face)) already-defined)
  37. (insert (format
  38. "`(%s ((,class %s)))%s
  39. "
  40. face
  41. (let (result)
  42. (dolist (entry face-attribute-name-alist result)
  43. (let* ((attribute (car entry))
  44. (value (face-attribute face attribute)))
  45. (unless (eq value 'unspecified)
  46. (setq result
  47. (nconc (list attribute
  48. (cond
  49. ((cl-member attribute
  50. '(":background"
  51. ":foreground")
  52. :test 'string=)
  53. (format "\"%s\"" value))
  54. (t value))) result))))))
  55. (if (get face 'theme-face)
  56. (format " ;; Already set by current theme!")
  57. "")))))
  58. faces)))
  59. ;; Local Variables:
  60. ;; byte-compile-warnings: (not cl-functions)
  61. ;; indent-tabs-mode: nil
  62. ;; End:
  63. (provide 'solarized-theme-utils)
  64. ;;; solarized-theme-utils.el ends here