Add smart-mode-line package

This commit is contained in:
Gergely Polonkai 2016-09-21 16:09:08 +02:00
parent d2a37c963e
commit cb7b4594a4
10 changed files with 2293 additions and 1 deletions

View File

@ -0,0 +1,40 @@
;;; rich-minority-autoloads.el --- automatically extracted autoloads
;;
;;; Code:
(add-to-list 'load-path (or (file-name-directory #$) (car load-path)))
;;;### (autoloads nil "rich-minority" "rich-minority.el" (22498 28594
;;;;;; 619364 66000))
;;; Generated autoloads from rich-minority.el
(autoload 'rm--mode-list-as-string-list "rich-minority" "\
Return `minor-mode-list' as a simple list of strings.
\(fn)" nil nil)
(defvar rich-minority-mode nil "\
Non-nil if Rich minority mode is enabled.
See the command `rich-minority-mode' for a description of this minor mode.
Setting this variable directly does not take effect;
either customize it (see the info node `Easy Customization')
or call the function `rich-minority-mode'.")
(custom-autoload 'rich-minority-mode "rich-minority" nil)
(autoload 'rich-minority-mode "rich-minority" "\
Toggle Rich minority mode on or off.
With a prefix argument ARG, enable Rich minority mode if ARG is
positive, and disable it otherwise. If called from Lisp, enable
the mode if ARG is omitted or nil, and toggle it if ARG is `toggle'.
\\{rich-minority-mode-map}
\(fn &optional ARG)" t nil)
;;;***
;; Local Variables:
;; version-control: never
;; no-byte-compile: t
;; no-update-autoloads: t
;; End:
;;; rich-minority-autoloads.el ends here

View File

@ -0,0 +1 @@
(define-package "rich-minority" "20160725.1255" "Clean-up and Beautify the list of minor-modes." '((cl-lib "0.5")) :url "https://github.com/Malabarba/rich-minority" :keywords '("mode-line" "faces"))

View File

@ -0,0 +1,299 @@
;;; rich-minority.el --- Clean-up and Beautify the list of minor-modes.
;; Copyright (C) 2014, 2015 Free Software Foundation, Inc.
;; Author: Artur Malabarba <emacs@endlessparentheses.com>
;; URL: https://github.com/Malabarba/rich-minority
;; Package-Version: 20160725.1255
;; Package-Requires: ((cl-lib "0.5"))
;; Version: 1.0.1
;; Keywords: mode-line faces
;;; Commentary:
;;
;; Emacs package for hiding and/or highlighting the list of minor-modes
;; in the mode-line.
;;
;;
;; Usage
;; ─────
;;
;; To activate the enrichment of your minor-modes list, call `M-x
;; rich-minority-mode', or add this to your init file:
;;
;; ┌────
;; │ (rich-minority-mode 1)
;; └────
;;
;; By default, this has a couple of small effects (provided as examples)
;; it is up to you to customize it to your liking with the following
;; three variables:
;;
;; `rm-blacklist': List of minor mode names that will be hidden from the
;; minor-modes list. Use this to hide *only* a few modes
;; that are always active and dont really contribute
;; information.
;; `rm-whitelist': List of minor mode names that are allowed on the
;; minor-modes list. Use this to hide *all but* a few
;; modes.
;; `rm-text-properties': List text properties to apply to each minor-mode
;; lighter. For instance, by default we highlight
;; `Ovwrt' with a red face, so you always know if
;; youre in `overwrite-mode'.
;;
;;
;; Comparison to Diminish
;; ──────────────────────
;;
;; Diminish is an established player in the mode-line world, who also
;; handles the minor-modes list. What can rich-minority /offer in
;; contrast/?
;;
;; • rich-minority is more versatile:
;; 1. It accepts *regexps*, instead of having to specify each
;; minor-mode individually;
;; 2. It also offers a *whitelist* behaviour, in addition to the
;; blacklist;
;; 3. It supports *highlighting* specific minor-modes with completely
;; arbitrary text properties.
;; • rich-minority takes a cleaner, functional approach. It doesnt hack
;; into the `minor-mode-alist' variable.
;;
;; What is rich-minority /missing/?
;;
;; 1. It doesnt have a quick and simple replacement functionality yet.
;; Although you can set the `display' property of a minor-mode to
;; whatever string you want and that will function as a replacement.
;; 2. Its source comments lack [Will Mengarinis poetry]. :-)
;;
;;
;; [Will Mengarinis poetry] http://www.eskimo.com/~seldon/diminish.el
;;
;;
;; Installation
;; ────────────
;;
;; This package is available fom Melpa, you may install it by calling
;; `M-x package-install'.
;;; Code:
(require 'cl-lib)
(declare-function lm-version "lisp-mnt")
(defun rm-bug-report ()
"Opens github issues page in a web browser. Please send any bugs you find.
Please include your Emacs and rich-minority versions."
(interactive)
(require 'lisp-mnt)
(message "Your rm-version is: %s, and your emacs version is: %s.\nPlease include this in your report!"
(lm-version "rich-minority.el") emacs-version)
(browse-url "https://github.com/Malabarba/rich-minority/issues/new"))
(defun rm-customize ()
"Open the customization menu in the `rich-minority' group."
(interactive)
(customize-group 'rich-minority t))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Customization variables.
(defcustom rm-blacklist '(" hl-p")
"List of minor modes you want to hide from the mode-line.
Has three possible values:
- nil: All minor modes are shown in the mode-line (but see also
`rm-whitelist').
- List of strings: Represents a list of minor mode names that
will be hidden from the minor-modes list.
- A string: If this variable is set to a single string, this
string must be a regexp. This regexp will be compared to each
minor-mode lighter, and those which match are hidden from the
minor-mode list.
If you'd like to use a list of regexps, simply use something like the following:
(setq rm-blacklist (mapconcat 'identity list-of-regexps \"\\\\|\"))
Don't forget to start each string with a blank space, as most
minor-mode lighters start with a space."
:type '(choice (repeat string)
(regexp :tag "Regular expression."))
:group 'rich-minority
:package-version '(rich-minority . "0.1.1"))
(define-obsolete-variable-alias 'rm-excluded-modes 'rm-blacklist "0.1.1")
(define-obsolete-variable-alias 'rm-hidden-modes 'rm-blacklist "0.1.1")
(defcustom rm-whitelist nil
"List of minor modes you want to include in the mode-line.
- nil: All minor modes are shown in the mode-line (but see also
`rm-blacklist').
- List of strings: Represents a list of minor mode names that are
allowed on the minor-modes list. Any minor-mode whose lighter
is not in this list will NOT be displayed.
- A string: If this variable is set to a single string, this
string must be a regexp. This regexp will be compared to each
minor-mode lighter, and only those which match are displayed on
the minor-mode list.
If you'd like to use a list of regexps, simply use something like the following:
(setq rm-whitelist (mapconcat 'identity list-of-regexps \"\\\\|\"))
Don't forget to start each string with a blank space, as most
minor-mode lighters start with a space."
:type '(choice (repeat string)
(regexp :tag "Regular expression."))
:group 'rich-minority
:package-version '(rich-minority . "0.1.1"))
(define-obsolete-variable-alias 'rm-included-modes 'rm-whitelist "0.1.1")
(defcustom rm-text-properties
'(("\\` Ovwrt\\'" 'face 'font-lock-warning-face))
"Alist of text properties to be applied to minor-mode lighters.
The car of each element must be a regexp, and the cdr must be a
list of text properties.
(REGEXP PROPERTY-NAME PROPERTY-VALUE ...)
If the regexp matches a minor mode lighter, the text properties
are applied to it. They are tested in order, and search stops at
the first match.
These properties take priority over those defined in
`rm-base-text-properties'."
:type '(repeat (cons regexp (repeat sexp)))
:group 'rich-minority
:package-version '(rich-minority . "0.1"))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Functions and Defvars
(defconst rm--help-echo-bottom
"Mouse-1: Mode Menu.\nMouse-2: Mode Help.\nMouse-3: Toggle Minor Modes.")
(defvar-local rm--help-echo nil
"Used to set the help-echo string dynamically.")
(defun rm-format-mode-line-entry (entry)
"Format an ENTRY of `minor-mode-alist'.
Return a cons of the mode line string and the mode name, or nil
if the mode line string is empty."
(let ((mode-symbol (car entry))
(mode-string (format-mode-line entry)))
(unless (string= mode-string "")
(cons mode-string mode-symbol))))
;;;###autoload
(defun rm--mode-list-as-string-list ()
"Return `minor-mode-list' as a simple list of strings."
(let ((full-list (delq nil (mapcar #'rm-format-mode-line-entry
minor-mode-alist)))
(spacer (propertize " " 'display '(space :align-to 15))))
(setq rm--help-echo
(format "Full list:\n%s\n\n%s"
(mapconcat (lambda (pair)
(format " %s%s(%S)"
(car pair) spacer (cdr pair)))
full-list "\n")
rm--help-echo-bottom))
(mapcar #'rm--propertize
(rm--remove-hidden-modes
(mapcar #'car full-list)))))
(defcustom rm-base-text-properties
'('help-echo 'rm--help-echo
'mouse-face 'mode-line-highlight
'local-map mode-line-minor-mode-keymap)
"List of text propeties to apply to every minor mode."
:type '(repeat sexp)
:group 'rich-minority
:package-version '(rich-minority . "0.1"))
(defun rm--propertize (mode)
"Propertize the string MODE according to `rm-text-properties'."
(if (null (stringp mode))
`(:propertize ,mode ,@rm-base-text-properties)
(let ((al rm-text-properties)
done prop)
(while (and (null done) al)
(setq done (pop al))
(if (string-match (car done) mode)
(setq prop (cdr done))
(setq done nil)))
(eval `(propertize ,mode ,@prop ,@rm-base-text-properties)))))
(defun rm--remove-hidden-modes (li)
"Remove from LI elements that match `rm-blacklist' or don't match `rm-whitelist'."
(let ((pred (if (listp rm-blacklist) #'member #'rm--string-match))
(out li))
(when rm-blacklist
(setq out
(remove nil
(mapcar
(lambda (x) (unless (and (stringp x)
(funcall pred x rm-blacklist))
x))
out))))
(when rm-whitelist
(setq pred (if (listp rm-whitelist) #'member #'rm--string-match))
(setq out
(remove nil
(mapcar
(lambda (x) (unless (and (stringp x)
(null (funcall pred x rm-whitelist)))
x))
out))))
out))
(defun rm--string-match (string regexp)
"Like `string-match', but arg STRING comes before REGEXP."
(string-match regexp string))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; minor-mode
(defvar rm--mode-line-construct
'(:eval (rm--mode-list-as-string-list))
"Construct used to replace `minor-mode-alist'.")
(defvar rm--warning-absent-element
"Couldn't find %S inside `mode-line-modes'. If you didn't change it yourself, please file a bug report with M-x rm-bug-report"
"Warning message used when something wasn't found.")
(defvar rm--backup-construct nil
"Construct containing `minor-mode-alist' which we removed from the mode-line.")
;;;###autoload
(define-minor-mode rich-minority-mode nil nil " $"
:global t
(if rich-minority-mode
(let ((place (or (member 'minor-mode-alist mode-line-modes)
(cl-member-if
(lambda (x) (and (listp x)
(equal (car x) :propertize)
(equal (cadr x) '("" minor-mode-alist))))
mode-line-modes))))
(if place
(progn
(setq rm--backup-construct (car place))
(setcar place rm--mode-line-construct))
(setq rich-minority-mode nil)
(if (member 'sml/pos-id-separator mode-line-format)
(message "You don't need to activate rich-minority-mode if you're using smart-mode-line")
(warn rm--warning-absent-element 'minor-mode-alist))))
(let ((place (member rm--mode-line-construct mode-line-modes)))
(if place
(setcar place rm--backup-construct)
(warn rm--warning-absent-element rm--mode-line-construct)))))
(provide 'rich-minority)
;;; rich-minority.el ends here
;; Local Variables:
;; nameless-current-name: "rm"
;; End:

View File

@ -0,0 +1,58 @@
;;; smart-mode-line-autoloads.el --- automatically extracted autoloads
;;
;;; Code:
(add-to-list 'load-path (or (file-name-directory #$) (car load-path)))
;;;### (autoloads nil "smart-mode-line" "smart-mode-line.el" (22498
;;;;;; 28595 835364 436000))
;;; Generated autoloads from smart-mode-line.el
(when load-file-name (let ((dir (file-name-as-directory (file-name-directory load-file-name)))) (add-to-list 'custom-theme-load-path dir) (when (file-directory-p (file-name-as-directory (concat dir "themes"))) (add-to-list 'custom-theme-load-path (file-name-as-directory (concat dir "themes"))))))
(autoload 'sml/setup "smart-mode-line" "\
Setup the mode-line to be smart and sexy.
ARG is ignored. Just call this function in your init file, and
the mode-line will be setup.
\(fn &optional ARG)" t nil)
(defalias 'smart-mode-line-enable #'sml/setup)
;;;***
;;;### (autoloads nil "smart-mode-line-dark-theme" "smart-mode-line-dark-theme.el"
;;;;;; (22498 28595 843364 438000))
;;; Generated autoloads from smart-mode-line-dark-theme.el
(when load-file-name (add-to-list 'custom-theme-load-path (file-name-as-directory (file-name-directory load-file-name))))
;;;***
;;;### (autoloads nil "smart-mode-line-light-theme" "smart-mode-line-light-theme.el"
;;;;;; (22498 28595 831364 434000))
;;; Generated autoloads from smart-mode-line-light-theme.el
(when load-file-name (add-to-list 'custom-theme-load-path (file-name-as-directory (file-name-directory load-file-name))))
;;;***
;;;### (autoloads nil "smart-mode-line-respectful-theme" "smart-mode-line-respectful-theme.el"
;;;;;; (22498 28595 827364 432000))
;;; Generated autoloads from smart-mode-line-respectful-theme.el
(when load-file-name (add-to-list 'custom-theme-load-path (file-name-as-directory (file-name-directory load-file-name))))
;;;***
;;;### (autoloads nil nil ("smart-mode-line-pkg.el") (22498 28595
;;;;;; 858409 67000))
;;;***
;; Local Variables:
;; version-control: never
;; no-byte-compile: t
;; no-update-autoloads: t
;; End:
;;; smart-mode-line-autoloads.el ends here

View File

@ -0,0 +1,49 @@
;;; smart-mode-line-dark-theme.el --- Dark theme for smart-mode-line
;; Copyright (C) 2014 Artur Malabarba <bruce.connor.am@gmail.com>
;; Author: Artur Malabarba <bruce.connor.am@gmail.com>
;; URL: http://github.com/Bruce-Connor/smart-mode-line
;; Separator: -
;;; License:
;;
;; This file is NOT part of GNU Emacs.
;;
;; 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 2
;; 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.
;;
;;; Change Log:
;; 0.1a - 2014/05/14 - Created File.
;;; Code:
(deftheme smart-mode-line-dark "Dark theme for smart-mode-line.")
(custom-theme-set-faces
'smart-mode-line-dark
'(mode-line-buffer-id ((t :inherit sml/filename :foreground nil :background nil)))
'(mode-line-inactive ((t :foreground "gray60" :background "#404045" :inverse-video nil)))
'(mode-line ((t :foreground "gray60" :background "black" :inverse-video nil)))
'(sml/global ((t :foreground "gray50" :inverse-video nil)))
'(sml/modes ((t :inherit sml/global :foreground "White")))
'(sml/filename ((t :inherit sml/global :foreground "#eab700" :weight bold)))
'(sml/prefix ((t :inherit sml/global :foreground "#bf6000")))
'(sml/read-only ((t :inherit sml/not-modified :foreground "DeepSkyBlue")))
'(persp-selected-face ((t :foreground "ForestGreen" :inherit sml/filename)))
'(helm-candidate-number ((t :foreground nil :background nil :inherit sml/filename))))
;;;###autoload
(when load-file-name
(add-to-list 'custom-theme-load-path
(file-name-as-directory (file-name-directory load-file-name))))
(provide-theme 'smart-mode-line-dark)
;;; smart-mode-line-dark-theme.el ends here.

View File

@ -0,0 +1,47 @@
;;; smart-mode-line-light-theme.el --- Light theme for smart-mode-line
;; Copyright (C) 2014 Artur Malabarba <bruce.connor.am@gmail.com>
;; Author: Artur Malabarba <bruce.connor.am@gmail.com>
;; URL: http://github.com/Bruce-Connor/smart-mode-line
;; Separator: -
;;; License:
;;
;; This file is NOT part of GNU Emacs.
;;
;; 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 2
;; 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.
;;
;;; Change Log:
;; 0.1a - 2014/05/14 - Created File.
;;; Code:
(deftheme smart-mode-line-light "Light theme for smart-mode-line.")
(custom-theme-set-faces
'smart-mode-line-light
'(mode-line-buffer-id ((t :inherit sml/filename :foreground nil :background nil)))
'(mode-line-inactive ((t :foreground "grey20" :background "#fdf6e3" :inverse-video nil)))
'(mode-line ((t :foreground "black" :background "grey85" :inverse-video nil)))
'(sml/global ((t :foreground "gray20" :inverse-video nil)))
'(sml/modes ((t :inherit sml/global :foreground "Black")))
'(sml/filename ((t :inherit sml/global :foreground "Blue" :weight bold)))
'(sml/prefix ((t :inherit sml/global :foreground "#5b2507" :weight bold)))
'(sml/read-only ((t :inherit sml/not-modified :foreground "DarkGreen" :weight bold))))
;;;###autoload
(when load-file-name
(add-to-list 'custom-theme-load-path
(file-name-as-directory (file-name-directory load-file-name))))
(provide-theme 'smart-mode-line-light)
;;; smart-mode-line-light-theme.el ends here.

View File

@ -0,0 +1,8 @@
(define-package "smart-mode-line" "20160818.508" "A color coded smart mode-line."
'((emacs "24.3")
(rich-minority "0.1.1"))
:url "http://github.com/Malabarba/smart-mode-line" :keywords
'("mode-line" "faces" "themes"))
;; Local Variables:
;; no-byte-compile: t
;; End:

View File

@ -0,0 +1,49 @@
;;; smart-mode-line-respectful-theme.el --- Respectful theme for smart-mode-line
;; Copyright (C) 2014 Artur Malabarba <bruce.connor.am@gmail.com>
;; Author: Artur Malabarba <bruce.connor.am@gmail.com>
;; URL: http://github.com/Bruce-Connor/smart-mode-line
;; Separator: -
;;; License:
;;
;; This file is NOT part of GNU Emacs.
;;
;; 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 2
;; 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.
;;
;;; Change Log:
;; 0.1a - 2014/05/14 - Created File.
;;; Code:
(deftheme smart-mode-line-respectful
"Respectful theme for smart-mode-line.
Tries to respect the colors chosen by your global theme.
Results may vary.")
(custom-theme-set-faces
'smart-mode-line-respectful
'(mode-line-inactive ((t :inverse-video nil)))
'(mode-line ((t :inverse-video nil)))
'(sml/global ((t :inherit font-lock-preprocessor-face)))
'(sml/filename ((t :inherit mode-line-buffer-id)))
'(sml/prefix ((t :inherit (font-lock-variable-name-face sml/global))))
'(sml/read-only ((t :inherit (font-lock-type-face sml/not-modified))))
'(sml/modes ((t :foreground nil :inherit sml/filename :weight normal))))
;;;###autoload
(when load-file-name
(add-to-list 'custom-theme-load-path
(file-name-as-directory (file-name-directory load-file-name))))
(provide-theme 'smart-mode-line-respectful)
;;; smart-mode-line-respectful-theme.el ends here.

File diff suppressed because it is too large Load Diff

View File

@ -19,7 +19,7 @@
'(custom-enabled-themes (quote (tango-dark)))
'(custom-safe-themes
(quote
("1e7e097ec8cb1f8c3a912d7e1e0331caeed49fef6cff220be63bd2a6ba4cc365" "fc5fcb6f1f1c1bc01305694c59a1a861b008c534cae8d0e48e4d5e81ad718bc6" default)))
("a27c00821ccfd5a78b01e4f35dc056706dd9ede09a8b90c6955ae6a390eb1c1e" "1e7e097ec8cb1f8c3a912d7e1e0331caeed49fef6cff220be63bd2a6ba4cc365" "fc5fcb6f1f1c1bc01305694c59a1a861b008c534cae8d0e48e4d5e81ad718bc6" default)))
'(ediff-merge-split-window-function (quote split-window-horizontally))
'(ediff-split-window-function (quote split-window-vertically))
'(fiplr-ignored-globs
@ -351,3 +351,5 @@ Version 2016-02-16"
(global-set-key (kbd "C->") 'mc/mark-next-like-this)
(global-set-key (kbd "C-<") 'mc/mark-previous-like-this)
(global-set-key (kbd "C-c C-<") 'mc/mark-all-like-this)
(sml/setup)