Archived
1
0
Fork 0

add doom modeline packages/support files

This commit is contained in:
KemoNine 2022-04-25 19:25:09 -04:00
parent 4e341095eb
commit 87577a5171
24 changed files with 10546 additions and 0 deletions

View file

@ -0,0 +1,135 @@
;;; doom-modeline-autoloads.el --- automatically extracted autoloads -*- lexical-binding: t -*-
;;
;;; Code:
(add-to-list 'load-path (directory-file-name
(or (file-name-directory #$) (car load-path))))
;;;### (autoloads nil "doom-modeline" "doom-modeline.el" (0 0 0 0))
;;; Generated autoloads from doom-modeline.el
(autoload 'doom-modeline-init "doom-modeline" "\
Initialize doom mode-line." nil nil)
(autoload 'doom-modeline-set-main-modeline "doom-modeline" "\
Set main mode-line.
If DEFAULT is non-nil, set the default mode-line for all buffers.
\(fn &optional DEFAULT)" nil nil)
(autoload 'doom-modeline-set-minimal-modeline "doom-modeline" "\
Set minimal mode-line." nil nil)
(autoload 'doom-modeline-set-special-modeline "doom-modeline" "\
Set special mode-line." nil nil)
(autoload 'doom-modeline-set-project-modeline "doom-modeline" "\
Set project mode-line." nil nil)
(autoload 'doom-modeline-set-dashboard-modeline "doom-modeline" "\
Set dashboard mode-line." nil nil)
(autoload 'doom-modeline-set-vcs-modeline "doom-modeline" "\
Set vcs mode-line." nil nil)
(autoload 'doom-modeline-set-info-modeline "doom-modeline" "\
Set Info mode-line." nil nil)
(autoload 'doom-modeline-set-package-modeline "doom-modeline" "\
Set package mode-line." nil nil)
(autoload 'doom-modeline-set-media-modeline "doom-modeline" "\
Set media mode-line." nil nil)
(autoload 'doom-modeline-set-message-modeline "doom-modeline" "\
Set message mode-line." nil nil)
(autoload 'doom-modeline-set-pdf-modeline "doom-modeline" "\
Set pdf mode-line." nil nil)
(autoload 'doom-modeline-set-org-src-modeline "doom-modeline" "\
Set org-src mode-line." nil nil)
(autoload 'doom-modeline-set-helm-modeline "doom-modeline" "\
Set helm mode-line.
\(fn &rest _)" nil nil)
(autoload 'doom-modeline-set-timemachine-modeline "doom-modeline" "\
Set timemachine mode-line." nil nil)
(defvar doom-modeline-mode nil "\
Non-nil if Doom-Modeline mode is enabled.
See the `doom-modeline-mode' command
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 `doom-modeline-mode'.")
(custom-autoload 'doom-modeline-mode "doom-modeline" nil)
(autoload 'doom-modeline-mode "doom-modeline" "\
Toggle doom-modeline on or off.
This is a minor mode. If called interactively, toggle the
`Doom-Modeline mode' mode. If the prefix argument is positive,
enable the mode, and if it is zero or negative, disable the mode.
If called from Lisp, toggle the mode if ARG is `toggle'. Enable
the mode if ARG is nil, omitted, or is a positive number.
Disable the mode if ARG is a negative number.
To check whether the minor mode is enabled in the current buffer,
evaluate `(default-value \\='doom-modeline-mode)'.
The mode's hook is called both when the mode is enabled and when
it is disabled.
\(fn &optional ARG)" t nil)
(register-definition-prefixes "doom-modeline" '("doom-modeline-mode-map"))
;;;***
;;;### (autoloads nil "doom-modeline-core" "doom-modeline-core.el"
;;;;;; (0 0 0 0))
;;; Generated autoloads from doom-modeline-core.el
(register-definition-prefixes "doom-modeline-core" '("doom-modeline"))
;;;***
;;;### (autoloads nil "doom-modeline-env" "doom-modeline-env.el"
;;;;;; (0 0 0 0))
;;; Generated autoloads from doom-modeline-env.el
(autoload 'doom-modeline-env-setup-python "doom-modeline-env")
(autoload 'doom-modeline-env-setup-ruby "doom-modeline-env")
(autoload 'doom-modeline-env-setup-perl "doom-modeline-env")
(autoload 'doom-modeline-env-setup-go "doom-modeline-env")
(autoload 'doom-modeline-env-setup-elixir "doom-modeline-env")
(autoload 'doom-modeline-env-setup-rust "doom-modeline-env")
(register-definition-prefixes "doom-modeline-env" '("doom-modeline-"))
;;;***
;;;### (autoloads nil "doom-modeline-segments" "doom-modeline-segments.el"
;;;;;; (0 0 0 0))
;;; Generated autoloads from doom-modeline-segments.el
(register-definition-prefixes "doom-modeline-segments" '("doom-modeline-"))
;;;***
;;;### (autoloads nil nil ("doom-modeline-pkg.el") (0 0 0 0))
;;;***
;; Local Variables:
;; version-control: never
;; no-byte-compile: t
;; no-update-autoloads: t
;; coding: utf-8
;; End:
;;; doom-modeline-autoloads.el ends here

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,275 @@
;;; doom-modeline-env.el --- A environment parser for doom-modeline -*- lexical-binding: t -*-
;; Copyright (C) 2019-2020 Justin Barclay, Vincent Zhang
;; 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 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 <https://www.gnu.org/licenses/>.
;;
;;; Commentary:
;;
;; Parse programming environment.
;;
;;; Code:
(require 'subr-x)
(require 'doom-modeline-core)
;; Externals
(defvar python-shell-interpreter)
;; Customizations
(defgroup doom-modeline-env nil
"The environment parser for doom-modeline."
:group 'doom-modeline
:link '(url-link :tag "Homepage" "https://github.com/seagle0128/doom-modeline"))
(defcustom doom-modeline-env-load-string "..."
"What to display as the version while a new one is being loaded."
:type 'string
:group 'doom-modeline-env)
(defcustom doom-modeline-before-update-env-hook nil
"Hooks that run before the modeline version string is updated."
:type 'hook
:group 'doom-modeline-env)
(defcustom doom-modeline-after-update-env-hook nil
"Hooks that run after the modeline version string is updated."
:type 'hook
:group 'doom-modeline-env)
;; Variables
;; Show version string for multi-version managers like rvm, rbenv, pyenv, etc.
(defvar-local doom-modeline-env--version nil
"The version to display with major-mode in mode-line.
Example: \"2.6.0\"")
(defvar-local doom-modeline-env--command nil
"A program that we're looking to extract version information from.
Example: \"ruby\"")
(defvar-local doom-modeline-env--command-args nil
"A list of arguments for the command to extract the version from.
Example: '(\"--version\") ")
(defvar-local doom-modeline-env--parser nil
"A function that returns version number from a command --version (or similar).
Example: 'doom-modeline-env--ruby")
;; Functions & Macros
(defun doom-modeline-update-env ()
"Update environment info on mode-line."
(when (and doom-modeline-env-version
doom-modeline-env--command
(executable-find doom-modeline-env--command)
doom-modeline-env--command-args
doom-modeline-env--parser)
(let ((default-directory (doom-modeline-project-root))
(buffer (current-buffer)))
(run-hooks 'doom-modeline-before-update-env-hook)
(setq doom-modeline-env--version doom-modeline-env-load-string)
(doom-modeline-env--get
doom-modeline-env--command
doom-modeline-env--command-args
(lambda (prog-version)
(with-current-buffer buffer
(setq doom-modeline-env--version
(funcall doom-modeline-env--parser prog-version))
(run-hooks 'doom-modeline-after-update-env-hook)))))))
(add-hook 'find-file-hook #'doom-modeline-update-env)
(with-no-warnings
(if (boundp 'after-focus-change-function)
(add-function
:after after-focus-change-function
(lambda ()
(if (frame-focus-state)
(doom-modeline-update-env))))
(add-hook 'focus-in-hook #'doom-modeline-update-env)))
(defun doom-modeline-env--get (prog args callback)
"Start a sub process using PROG and apply the ARGS to the sub process.
Once it receives information from STDOUT, it closes off the subprocess and
passes on the information into the CALLBACK.
Example:
(doom-modeline-env--get
\"ruby\"
'(\"--version\")
(lambda (line)
(message (doom-modeline-parser--ruby line)))"
(let ((proc (apply 'start-process
;; Flaten process-args into a single list so we can handle
;; variadic length args
(append
(list "doom-modeline-env" nil prog)
args)))
(parser callback))
(set-process-filter proc
(lambda (_proc line)
(ignore-errors
(funcall parser line))))))
(cl-defmacro doom-modeline-def-env (name &key hooks command parser)
"Defines a handler for updating & displaying a version string for a language.
NAME is an unquoted symbol representing the handler's unique ID.
HOOKS is a list of hook symbols where this handler should be triggered.
COMMAND should be a function that returns a shell command and its arguments (as
a list). It is run on HOOKS. It takes no arguments.
PARSER should be a function for parsing COMMAND's output line-by-line, to
extract the version string."
(declare (indent defun))
(unless (and hooks command parser)
(error "'%s' env is missing either :hooks, :command or :parser" name))
(let ((parse-fn (intern (format "doom-modeline-env--%s-parse" name)))
(action-fn (intern (format "doom-modeline-env--%s-args" name)))
(setup-fn (intern (format "doom-modeline-env-setup-%s" name)))
(update-fn (intern (format "doom-modeline-env-update-%s" name)))
(enable-var (intern (format "doom-modeline-env-enable-%s" name)))
(command-var (intern (format "doom-modeline-env-%s-command" name)))
(parser-var (intern (format "doom-modeline-env-%s-parser-fn" name)))
(exe-var (intern (format "doom-modeline-env-%s-executable" name))))
(macroexp-progn
`((defcustom ,enable-var t
,(format "Whether to display the version string for %s buffers." name)
:type 'boolean
:group 'doom-modeline-env)
(defvar ,command-var ',action-fn
,(concat "A function that returns the shell command and arguments (as a list) to\n"
"produce a version string."))
(defvar ,parser-var ',parse-fn
,(format "The function to parse each line of `%s'\'s output." command-var))
(defcustom ,exe-var nil
,(format (concat "What executable to use for the version indicator in %s buffers.\n\n"
"If nil, the default binary for this language is used.")
name)
:type 'string
:group 'doom-modeline-env)
(defalias ',parse-fn ,parser
(format "The line parser for %s buffers.\n\nUsed by `%s'."
',name ',update-fn))
(defalias ',action-fn ,command
(format "The command resolver for %s buffers.\n\nUsed by `%s'."
',name ',update-fn))
(defalias ',setup-fn
(lambda ()
(if enable-local-variables
(add-hook 'hack-local-variables-hook #',update-fn nil t)
(,update-fn)))
(format "Prepares the modeline to later display the %s version string."
',name))
(defalias ',update-fn
(lambda ()
(when ,enable-var
(when-let* ((command-list (funcall ,command-var))
(exe (executable-find (car command-list))))
(setq doom-modeline-env--command exe
doom-modeline-env--command-args (cdr command-list)
doom-modeline-env--parser ,parser-var)
(doom-modeline-update-env))))
(format "Updates the %s version string in the modeline." ',name))
(let ((hooks ',(eval hooks)))
(dolist (hook (if (listp hooks) hooks (list hooks)))
(add-hook hook #',setup-fn)))))))
;; Bootstrap
;; Versions, support Python, Ruby, Perl and Golang, etc.
;;;###autoload (autoload 'doom-modeline-env-setup-python "doom-modeline-env")
(doom-modeline-def-env python
:hooks 'python-mode-hook
:command (lambda () (cond ((and (fboundp 'pipenv-project-p)
(pipenv-project-p))
(list "pipenv" "run"
(or doom-modeline-env-python-executable
python-shell-interpreter
"python")
"--version"))
((executable-find "pyenv") (list "pyenv" "version-name"))
((list (or doom-modeline-env-python-executable
python-shell-interpreter
"python")
"--version"))))
:parser (lambda (line) (let ((version (split-string line)))
(if (>= (length version) 2)
(cadr version)
(car version)))))
;;;###autoload (autoload 'doom-modeline-env-setup-ruby "doom-modeline-env")
(doom-modeline-def-env ruby
:hooks '(ruby-mode-hook enh-ruby-mode-hook)
:command (lambda () (list (or doom-modeline-env-ruby-executable "ruby") "--version"))
:parser (lambda (line)
(car (split-string
(cadr
(split-string line))
"p"))))
;;;###autoload (autoload 'doom-modeline-env-setup-perl "doom-modeline-env")
(doom-modeline-def-env perl
:hooks 'perl-mode-hook
:command (lambda () (list (or doom-modeline-env-perl-executable "perl") "--version"))
:parser (lambda (line)
(cadr
(split-string
(car
(split-string
(cadr
(split-string line "("))
")"))
"v"))))
;;;###autoload (autoload 'doom-modeline-env-setup-go "doom-modeline-env")
(doom-modeline-def-env go
:hooks 'go-mode-hook
:command (lambda () (list (or doom-modeline-env-go-executable "go") "version"))
:parser (lambda (line)
(cadr
(split-string
(cadr
(cdr
(split-string line)))
"go"))))
;;;###autoload (autoload 'doom-modeline-env-setup-elixir "doom-modeline-env")
(doom-modeline-def-env elixir
:hooks 'elixir-mode-hook
:command (lambda () (list (or doom-modeline-env-elixir-executable "elixir") "--version"))
:parser (lambda (line) (cadr (split-string line))))
;;;###autoload (autoload 'doom-modeline-env-setup-rust "doom-modeline-env")
(doom-modeline-def-env rust
:hooks 'rust-mode-hook
:command (lambda () (list (or doom-modeline-env-rust-executable "rustc") "--version"))
:parser (lambda (line)
(car
(split-string
(cadr
(split-string line))
"-"))))
(provide 'doom-modeline-env)
;;; doom-modeline-env.el ends here

View file

@ -0,0 +1,15 @@
(define-package "doom-modeline" "20220412.853" "A minimal and modern mode-line"
'((emacs "25.1")
(all-the-icons "2.2.0")
(shrink-path "0.2.0")
(dash "2.11.0"))
:commit "7d8eb7c44087a62d8dd6e8ba1afc26facd914fbc" :authors
'(("Vincent Zhang" . "seagle0128@gmail.com"))
:maintainer
'("Vincent Zhang" . "seagle0128@gmail.com")
:keywords
'("faces" "mode-line")
:url "https://github.com/seagle0128/doom-modeline")
;; Local Variables:
;; no-byte-compile: t
;; End:

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,311 @@
;;; doom-modeline.el --- A minimal and modern mode-line -*- lexical-binding: t; -*-
;; Copyright (C) 2018-2020 Vincent Zhang
;; Author: Vincent Zhang <seagle0128@gmail.com>
;; Homepage: https://github.com/seagle0128/doom-modeline
;; Version: 3.3.0
;; Package-Requires: ((emacs "25.1") (all-the-icons "2.2.0") (shrink-path "0.2.0") (dash "2.11.0"))
;; Keywords: faces mode-line
;; 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 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 <https://www.gnu.org/licenses/>.
;;
;;; Commentary:
;;
;; This package offers a fancy and fast mode-line inspired by minimalism design.
;;
;; It's integrated into Doom Emacs (https://github.com/hlissner/doom-emacs) and
;; Centaur Emacs (https://github.com/seagle0128/.emacs.d).
;;
;; The doom-modeline offers:
;; - A match count panel (for anzu, iedit, multiple-cursors, symbol-overlay,
;; evil-search and evil-substitute)
;; - An indicator for recording a macro
;; - Current environment version (e.g. python, ruby, go, etc.) in the major-mode
;; - A customizable mode-line height (see doom-modeline-height)
;; - A minor modes segment which is compatible with minions
;; - An error/warning count segment for flymake/flycheck
;; - A workspace number segment for eyebrowse
;; - A perspective name segment for persp-mode
;; - A window number segment for winum and window-numbering
;; - An indicator for modal editing state, including evil, overwrite, god, ryo
;; and xah-fly-keys, etc.
;; - An indicator for battery status
;; - An indicator for current input method
;; - An indicator for debug state
;; - An indicator for remote host
;; - An indicator for LSP state with lsp-mode or eglot
;; - An indicator for github notifications
;; - An indicator for unread emails with mu4e-alert
;; - An indicator for unread emails with gnus (basically builtin)
;; - An indicator for irc notifications with circe, rcirc or erc.
;; - An indicator for buffer position which is compatible with nyan-mode or poke-line
;; - An indicator for party parrot
;; - An indicator for PDF page number with pdf-tools
;; - An indicator for markdown/org previews with grip
;; - Truncated file name, file icon, buffer state and project name in buffer
;; information segment, which is compatible with project, find-file-in-project
;; and projectile
;; - New mode-line for Info-mode buffers
;; - New package mode-line for paradox
;; - New mode-line for helm buffers
;; - New mode-line for git-timemachine buffers
;;
;; Installation:
;; From melpa, `M-x package-install RET doom-modeline RET`.
;; In `init.el`,
;; (require 'doom-modeline)
;; (doom-modeline-mode 1)
;; or
;; (use-package doom-modeline
;; :ensure t
;; :hook (after-init . doom-modeline-mode))
;;
;;; Code:
(require 'doom-modeline-core)
(require 'doom-modeline-segments)
;;
;; Mode lines
;;
(doom-modeline-def-modeline 'main
'(bar workspace-name window-number modals matches follow buffer-info remote-host buffer-position word-count parrot selection-info)
'(objed-state misc-info persp-name battery grip irc mu4e gnus github debug repl lsp minor-modes input-method indent-info buffer-encoding major-mode process vcs checker))
(doom-modeline-def-modeline 'minimal
'(bar matches buffer-info-simple)
'(media-info major-mode))
(doom-modeline-def-modeline 'special
'(bar window-number modals matches buffer-info buffer-position word-count parrot selection-info)
'(objed-state misc-info battery irc-buffers debug minor-modes input-method indent-info buffer-encoding major-mode process))
(doom-modeline-def-modeline 'project
'(bar window-number modals buffer-default-directory)
'(misc-info battery irc mu4e gnus github debug minor-modes input-method major-mode process))
(doom-modeline-def-modeline 'dashboard
'(bar window-number buffer-default-directory-simple)
'(misc-info battery irc mu4e gnus github debug minor-modes input-method major-mode process))
(doom-modeline-def-modeline 'vcs
'(bar window-number modals matches buffer-info buffer-position parrot selection-info)
'(misc-info battery irc mu4e gnus github debug minor-modes buffer-encoding major-mode process))
(doom-modeline-def-modeline 'package
'(bar window-number package)
'(misc-info major-mode process))
(doom-modeline-def-modeline 'info
'(bar window-number buffer-info info-nodes buffer-position parrot selection-info)
'(misc-info buffer-encoding major-mode))
(doom-modeline-def-modeline 'media
'(bar window-number buffer-size buffer-info)
'(misc-info media-info major-mode process vcs))
(doom-modeline-def-modeline 'message
'(bar window-number modals matches buffer-info-simple buffer-position word-count parrot selection-info)
'(objed-state misc-info battery debug minor-modes input-method indent-info buffer-encoding major-mode))
(doom-modeline-def-modeline 'pdf
'(bar window-number matches buffer-info pdf-pages)
'(misc-info major-mode process vcs))
(doom-modeline-def-modeline 'org-src
'(bar window-number modals matches buffer-info-simple buffer-position word-count parrot selection-info)
'(objed-state misc-info debug lsp minor-modes input-method indent-info buffer-encoding major-mode process checker))
(doom-modeline-def-modeline 'helm
'(bar helm-buffer-id helm-number helm-follow helm-prefix-argument)
'(helm-help))
(doom-modeline-def-modeline 'timemachine
'(bar window-number modals matches git-timemachine buffer-position word-count parrot selection-info)
'(misc-info minor-modes indent-info buffer-encoding major-mode))
;;
;; Interfaces
;;
;;;###autoload
(defun doom-modeline-init ()
"Initialize doom mode-line."
(doom-modeline-mode 1))
(make-obsolete 'doom-modeline-init 'doom-modeline-mode "1.6.0")
;;;###autoload
(defun doom-modeline-set-main-modeline (&optional default)
"Set main mode-line.
If DEFAULT is non-nil, set the default mode-line for all buffers."
(doom-modeline-set-modeline 'main default))
;;;###autoload
(defun doom-modeline-set-minimal-modeline ()
"Set minimal mode-line."
(doom-modeline-set-modeline 'minimal))
;;;###autoload
(defun doom-modeline-set-special-modeline ()
"Set special mode-line."
(doom-modeline-set-modeline 'special))
;;;###autoload
(defun doom-modeline-set-project-modeline ()
"Set project mode-line."
(doom-modeline-set-modeline 'project))
;;;###autoload
(defun doom-modeline-set-dashboard-modeline ()
"Set dashboard mode-line."
(doom-modeline-set-modeline 'dashboard))
;;;###autoload
(defun doom-modeline-set-vcs-modeline ()
"Set vcs mode-line."
(doom-modeline-set-modeline 'vcs))
;;;###autoload
(defun doom-modeline-set-info-modeline ()
"Set Info mode-line."
(doom-modeline-set-modeline 'info))
;;;###autoload
(defun doom-modeline-set-package-modeline ()
"Set package mode-line."
(doom-modeline-set-modeline 'package))
;;;###autoload
(defun doom-modeline-set-media-modeline ()
"Set media mode-line."
(doom-modeline-set-modeline 'media))
;;;###autoload
(defun doom-modeline-set-message-modeline ()
"Set message mode-line."
(doom-modeline-set-modeline 'message))
;;;###autoload
(defun doom-modeline-set-pdf-modeline ()
"Set pdf mode-line."
(doom-modeline-set-modeline 'pdf))
;;;###autoload
(defun doom-modeline-set-org-src-modeline ()
"Set org-src mode-line."
(doom-modeline-set-modeline 'org-src))
;;;###autoload
(defun doom-modeline-set-helm-modeline (&rest _) ; To advice helm
"Set helm mode-line."
(doom-modeline-set-modeline 'helm))
;;;###autoload
(defun doom-modeline-set-timemachine-modeline ()
"Set timemachine mode-line."
(doom-modeline-set-modeline 'timemachine))
;;
;; Minor mode
;;
(defvar doom-modeline-mode-map (make-sparse-keymap))
;; Suppress warnings
(defvar 2C-mode-line-format)
(declare-function helm-display-mode-line "ext:helm-core")
;;;###autoload
(define-minor-mode doom-modeline-mode
"Toggle doom-modeline on or off."
:group 'doom-modeline
:global t
:lighter nil
:keymap doom-modeline-mode-map
(if doom-modeline-mode
(progn
(doom-modeline-refresh-bars) ; Create bars
(doom-modeline-set-main-modeline t) ; Set default mode-line
;; Apply to all existing buffers.
(dolist (buf (buffer-list))
(with-current-buffer buf
(doom-modeline-set-main-modeline)))
;; For two-column editing
(setq 2C-mode-line-format (doom-modeline 'special))
;; Add hooks
(add-hook 'Info-mode-hook #'doom-modeline-set-info-modeline)
(add-hook 'dired-mode-hook #'doom-modeline-set-project-modeline)
(add-hook 'dashboard-mode-hook #'doom-modeline-set-dashboard-modeline)
(add-hook 'image-mode-hook #'doom-modeline-set-media-modeline)
(add-hook 'message-mode-hook #'doom-modeline-set-message-modeline)
(add-hook 'git-commit-mode-hook #'doom-modeline-set-message-modeline)
(add-hook 'magit-mode-hook #'doom-modeline-set-vcs-modeline)
(add-hook 'circe-mode-hook #'doom-modeline-set-special-modeline)
(add-hook 'erc-mode-hook #'doom-modeline-set-special-modeline)
(add-hook 'rcirc-mode-hook #'doom-modeline-set-special-modeline)
(add-hook 'pdf-view-mode-hook #'doom-modeline-set-pdf-modeline)
(add-hook 'org-src-mode-hook #'doom-modeline-set-org-src-modeline)
(add-hook 'git-timemachine-mode-hook #'doom-modeline-set-timemachine-modeline)
(add-hook 'paradox-menu-mode-hook #'doom-modeline-set-package-modeline)
(add-hook 'xwidget-webkit-mode-hook #'doom-modeline-set-minimal-modeline)
;; Add advices
(advice-add #'helm-display-mode-line :after #'doom-modeline-set-helm-modeline))
(progn
;; Restore mode-line
(let ((original-format (doom-modeline--original-value 'mode-line-format)))
(setq-default mode-line-format original-format)
(dolist (buf (buffer-list))
(with-current-buffer buf
(setq mode-line-format original-format))))
;; For two-column editing
(setq 2C-mode-line-format (doom-modeline--original-value '2C-mode-line-format))
;; Remove hooks
(remove-hook 'Info-mode-hook #'doom-modeline-set-info-modeline)
(remove-hook 'dired-mode-hook #'doom-modeline-set-project-modeline)
(remove-hook 'dashboard-mode-hook #'doom-modeline-set-dashboard-modeline)
(remove-hook 'image-mode-hook #'doom-modeline-set-media-modeline)
(remove-hook 'message-mode-hook #'doom-modeline-set-message-modeline)
(remove-hook 'git-commit-mode-hook #'doom-modeline-set-message-modeline)
(remove-hook 'magit-mode-hook #'doom-modeline-set-vcs-modeline)
(remove-hook 'circe-mode-hook #'doom-modeline-set-special-modeline)
(remove-hook 'erc-mode-hook #'doom-modeline-set-special-modeline)
(remove-hook 'rcirc-mode-hook #'doom-modeline-set-special-modeline)
(remove-hook 'pdf-view-mode-hook #'doom-modeline-set-pdf-modeline)
(remove-hook 'org-src-mode-hook #'doom-modeline-set-org-src-modeline)
(remove-hook 'git-timemachine-mode-hook #'doom-modeline-set-timemachine-modeline)
(remove-hook 'paradox-menu-mode-hook #'doom-modeline-set-package-modeline)
(remove-hook 'xwidget-webkit-mode-hook #'doom-modeline-set-minimal-modeline)
;; Remove advices
(advice-remove #'helm-display-mode-line #'doom-modeline-set-helm-modeline))))
(provide 'doom-modeline)
;;; doom-modeline.el ends here

View file

@ -0,0 +1,22 @@
;;; shrink-path-autoloads.el --- automatically extracted autoloads -*- lexical-binding: t -*-
;;
;;; Code:
(add-to-list 'load-path (directory-file-name
(or (file-name-directory #$) (car load-path))))
;;;### (autoloads nil "shrink-path" "shrink-path.el" (0 0 0 0))
;;; Generated autoloads from shrink-path.el
(register-definition-prefixes "shrink-path" '("shrink-path-"))
;;;***
;; Local Variables:
;; version-control: never
;; no-byte-compile: t
;; no-update-autoloads: t
;; coding: utf-8
;; End:
;;; shrink-path-autoloads.el ends here

View file

@ -0,0 +1,2 @@
;;; Generated package description from shrink-path.el -*- no-byte-compile: t -*-
(define-package "shrink-path" "20190208.1335" "fish-style path" '((emacs "24") (s "1.6.1") (dash "1.8.0") (f "0.10.0")) :commit "c14882c8599aec79a6e8ef2d06454254bb3e1e41" :authors '(("Benjamin Andresen")) :maintainer '("Benjamin Andresen") :url "https://gitlab.com/bennya/shrink-path.el")

View file

@ -0,0 +1,150 @@
;;; shrink-path.el --- fish-style path -*- lexical-binding: t; -*-
;; Copyright (C) 2017 Benjamin Andresen
;; Author: Benjamin Andresen
;; Version: 0.3.1
;; Package-Version: 20190208.1335
;; Package-Commit: c14882c8599aec79a6e8ef2d06454254bb3e1e41
;; URL: https://gitlab.com/bennya/shrink-path.el
;; Package-Requires: ((emacs "24") (s "1.6.1") (dash "1.8.0") (f "0.10.0"))
;; 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 3, 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 GNU Emacs; see the file LICENSE. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;; Commentary:
;; Provides functions that offer fish shell[1] path truncation.
;; Directory /usr/share/emacs/site-lisp => /u/s/e/site-lisp
;;
;; Also includes utility functions that make integration in eshell or the
;; modeline easier.
;;
;; [1] https://fishshell.com/
;;; Code:
(require 'dash)
(require 's)
(require 'f)
(require 'rx)
(defun shrink-path--truncate (str)
"Return STR's first character or first two characters if hidden."
(substring str 0 (if (s-starts-with? "." str) 2 1)))
(defun shrink-path--dirs-internal (full-path &optional truncate-all)
"Return fish-style truncated string based on FULL-PATH.
Optional parameter TRUNCATE-ALL will cause the function to truncate the last
directory too."
(let* ((home (expand-file-name "~"))
(path (replace-regexp-in-string
(s-concat "^" home) "~" full-path))
(split (s-split "/" path 'omit-nulls))
(split-len (length split))
shrunk)
(->> split
(--map-indexed (if (= it-index (1- split-len))
(if truncate-all (shrink-path--truncate it) it)
(shrink-path--truncate it)))
(s-join "/")
(setq shrunk))
(s-concat (unless (s-matches? (rx bos (or "~" "/")) shrunk) "/")
shrunk
(unless (s-ends-with? "/" shrunk) "/"))))
(defun shrink-path-dirs (&optional path truncate-tail)
"Given PATH return fish-styled shrunken down path.
TRUNCATE-TAIL will cause the function to truncate the last directory too."
(let* ((path (or path default-directory))
(path (f-full path)))
(cond
((s-equals? (f-short path) "/") "/")
((s-matches? (rx bos (or "~" "/") eos) "~/"))
(t (shrink-path--dirs-internal path truncate-tail)))))
(defun shrink-path-expand (str &optional absolute-p)
"Return expanded path from STR if found or list of matches on multiple.
The path referred to by STR has to exist for this to work.
If ABSOLUTE-P is t the returned path will be absolute."
(let* ((str-split (s-split "/" str 'omit-nulls))
(head (car str-split)))
(if (= (length str-split) 1)
(s-concat "/" str-split)
(--> (-drop 1 str-split) ;; drop head
(-map (lambda (e) (s-concat e "*")) it)
(-drop-last 1 it) ;; drop tail as it may not exist
(s-join "/" it)
(s-concat (if (s-equals? head "~") "~/" head) it)
(f-glob it)
(-map (lambda (e) (s-concat e "/" (-last-item str-split))) it)
(if absolute-p (-map #'f-full it) (-map #'f-abbrev it))
(if (= (length it) 1) (car it) it)))))
(defun shrink-path-prompt (&optional pwd)
"Return cons of BASE and DIR for PWD.
If PWD isn't provided will default to `default-directory'."
(let* ((pwd (or pwd default-directory))
(shrunk (shrink-path-dirs pwd))
(split (--> shrunk (s-split "/" it 'omit-nulls)))
base dir)
(setq dir (or (-last-item split) "/"))
(setq base (if (s-equals? dir "/") ""
(s-chop-suffix (s-concat dir "/") shrunk)))
(cons base dir)))
(defun shrink-path-file (file &optional truncate-tail)
"Return FILE's shrunk down path and filename.
TRUNCATE-TAIL controls if the last directory should also be shortened."
(let ((filename (f-filename file))
(dirname (f-dirname file)))
(s-concat (shrink-path-dirs dirname truncate-tail) filename)))
(defun shrink-path-file-expand (str &optional exists-p absolute-p)
"Return STR's expanded filename.
The path referred to by STR has to exist for this to work.
If EXISTS-P is t the filename also has to exist.
If ABSOLUTE-P is t the returned path will be absolute."
(let ((expanded (shrink-path-expand str absolute-p)))
(if (and expanded exists-p)
(if (f-exists? expanded) expanded)
expanded)))
(defun shrink-path-file-mixed (shrink-path rel-path filename)
"Returns list of mixed truncated file name locations.
Consists of SHRINK-PATH's parent, SHRINK-PATH basename, relative REL-PATH and
FILENAME.
For use in modeline or prompts, etc."
(let ((shrunk-dirs (shrink-path-prompt shrink-path))
sp-parent sp-rel rel-rel nd-file)
(when (f-descendant-of? filename shrink-path)
(when shrunk-dirs
(setq sp-parent (car shrunk-dirs)
sp-rel (cdr shrunk-dirs)))
(setq rel-rel (if (or (f-same? rel-path shrink-path)
(s-equals? (f-relative rel-path shrink-path) "."))
nil
(f-relative rel-path shrink-path)))
(setq nd-file (file-name-nondirectory filename))
(list sp-parent sp-rel rel-rel nd-file))))
(provide 'shrink-path)
;;; shrink-path.el ends here

Binary file not shown.

BIN
common/fonts/file-icons.ttf Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
common/fonts/octicons.ttf Normal file

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,135 @@
;;; doom-modeline-autoloads.el --- automatically extracted autoloads -*- lexical-binding: t -*-
;;
;;; Code:
(add-to-list 'load-path (directory-file-name
(or (file-name-directory #$) (car load-path))))
;;;### (autoloads nil "doom-modeline" "doom-modeline.el" (0 0 0 0))
;;; Generated autoloads from doom-modeline.el
(autoload 'doom-modeline-init "doom-modeline" "\
Initialize doom mode-line." nil nil)
(autoload 'doom-modeline-set-main-modeline "doom-modeline" "\
Set main mode-line.
If DEFAULT is non-nil, set the default mode-line for all buffers.
\(fn &optional DEFAULT)" nil nil)
(autoload 'doom-modeline-set-minimal-modeline "doom-modeline" "\
Set minimal mode-line." nil nil)
(autoload 'doom-modeline-set-special-modeline "doom-modeline" "\
Set special mode-line." nil nil)
(autoload 'doom-modeline-set-project-modeline "doom-modeline" "\
Set project mode-line." nil nil)
(autoload 'doom-modeline-set-dashboard-modeline "doom-modeline" "\
Set dashboard mode-line." nil nil)
(autoload 'doom-modeline-set-vcs-modeline "doom-modeline" "\
Set vcs mode-line." nil nil)
(autoload 'doom-modeline-set-info-modeline "doom-modeline" "\
Set Info mode-line." nil nil)
(autoload 'doom-modeline-set-package-modeline "doom-modeline" "\
Set package mode-line." nil nil)
(autoload 'doom-modeline-set-media-modeline "doom-modeline" "\
Set media mode-line." nil nil)
(autoload 'doom-modeline-set-message-modeline "doom-modeline" "\
Set message mode-line." nil nil)
(autoload 'doom-modeline-set-pdf-modeline "doom-modeline" "\
Set pdf mode-line." nil nil)
(autoload 'doom-modeline-set-org-src-modeline "doom-modeline" "\
Set org-src mode-line." nil nil)
(autoload 'doom-modeline-set-helm-modeline "doom-modeline" "\
Set helm mode-line.
\(fn &rest _)" nil nil)
(autoload 'doom-modeline-set-timemachine-modeline "doom-modeline" "\
Set timemachine mode-line." nil nil)
(defvar doom-modeline-mode nil "\
Non-nil if Doom-Modeline mode is enabled.
See the `doom-modeline-mode' command
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 `doom-modeline-mode'.")
(custom-autoload 'doom-modeline-mode "doom-modeline" nil)
(autoload 'doom-modeline-mode "doom-modeline" "\
Toggle doom-modeline on or off.
This is a minor mode. If called interactively, toggle the
`Doom-Modeline mode' mode. If the prefix argument is positive,
enable the mode, and if it is zero or negative, disable the mode.
If called from Lisp, toggle the mode if ARG is `toggle'. Enable
the mode if ARG is nil, omitted, or is a positive number.
Disable the mode if ARG is a negative number.
To check whether the minor mode is enabled in the current buffer,
evaluate `(default-value \\='doom-modeline-mode)'.
The mode's hook is called both when the mode is enabled and when
it is disabled.
\(fn &optional ARG)" t nil)
(register-definition-prefixes "doom-modeline" '("doom-modeline-mode-map"))
;;;***
;;;### (autoloads nil "doom-modeline-core" "doom-modeline-core.el"
;;;;;; (0 0 0 0))
;;; Generated autoloads from doom-modeline-core.el
(register-definition-prefixes "doom-modeline-core" '("doom-modeline"))
;;;***
;;;### (autoloads nil "doom-modeline-env" "doom-modeline-env.el"
;;;;;; (0 0 0 0))
;;; Generated autoloads from doom-modeline-env.el
(autoload 'doom-modeline-env-setup-python "doom-modeline-env")
(autoload 'doom-modeline-env-setup-ruby "doom-modeline-env")
(autoload 'doom-modeline-env-setup-perl "doom-modeline-env")
(autoload 'doom-modeline-env-setup-go "doom-modeline-env")
(autoload 'doom-modeline-env-setup-elixir "doom-modeline-env")
(autoload 'doom-modeline-env-setup-rust "doom-modeline-env")
(register-definition-prefixes "doom-modeline-env" '("doom-modeline-"))
;;;***
;;;### (autoloads nil "doom-modeline-segments" "doom-modeline-segments.el"
;;;;;; (0 0 0 0))
;;; Generated autoloads from doom-modeline-segments.el
(register-definition-prefixes "doom-modeline-segments" '("doom-modeline-"))
;;;***
;;;### (autoloads nil nil ("doom-modeline-pkg.el") (0 0 0 0))
;;;***
;; Local Variables:
;; version-control: never
;; no-byte-compile: t
;; no-update-autoloads: t
;; coding: utf-8
;; End:
;;; doom-modeline-autoloads.el ends here

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,275 @@
;;; doom-modeline-env.el --- A environment parser for doom-modeline -*- lexical-binding: t -*-
;; Copyright (C) 2019-2020 Justin Barclay, Vincent Zhang
;; 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 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 <https://www.gnu.org/licenses/>.
;;
;;; Commentary:
;;
;; Parse programming environment.
;;
;;; Code:
(require 'subr-x)
(require 'doom-modeline-core)
;; Externals
(defvar python-shell-interpreter)
;; Customizations
(defgroup doom-modeline-env nil
"The environment parser for doom-modeline."
:group 'doom-modeline
:link '(url-link :tag "Homepage" "https://github.com/seagle0128/doom-modeline"))
(defcustom doom-modeline-env-load-string "..."
"What to display as the version while a new one is being loaded."
:type 'string
:group 'doom-modeline-env)
(defcustom doom-modeline-before-update-env-hook nil
"Hooks that run before the modeline version string is updated."
:type 'hook
:group 'doom-modeline-env)
(defcustom doom-modeline-after-update-env-hook nil
"Hooks that run after the modeline version string is updated."
:type 'hook
:group 'doom-modeline-env)
;; Variables
;; Show version string for multi-version managers like rvm, rbenv, pyenv, etc.
(defvar-local doom-modeline-env--version nil
"The version to display with major-mode in mode-line.
Example: \"2.6.0\"")
(defvar-local doom-modeline-env--command nil
"A program that we're looking to extract version information from.
Example: \"ruby\"")
(defvar-local doom-modeline-env--command-args nil
"A list of arguments for the command to extract the version from.
Example: '(\"--version\") ")
(defvar-local doom-modeline-env--parser nil
"A function that returns version number from a command --version (or similar).
Example: 'doom-modeline-env--ruby")
;; Functions & Macros
(defun doom-modeline-update-env ()
"Update environment info on mode-line."
(when (and doom-modeline-env-version
doom-modeline-env--command
(executable-find doom-modeline-env--command)
doom-modeline-env--command-args
doom-modeline-env--parser)
(let ((default-directory (doom-modeline-project-root))
(buffer (current-buffer)))
(run-hooks 'doom-modeline-before-update-env-hook)
(setq doom-modeline-env--version doom-modeline-env-load-string)
(doom-modeline-env--get
doom-modeline-env--command
doom-modeline-env--command-args
(lambda (prog-version)
(with-current-buffer buffer
(setq doom-modeline-env--version
(funcall doom-modeline-env--parser prog-version))
(run-hooks 'doom-modeline-after-update-env-hook)))))))
(add-hook 'find-file-hook #'doom-modeline-update-env)
(with-no-warnings
(if (boundp 'after-focus-change-function)
(add-function
:after after-focus-change-function
(lambda ()
(if (frame-focus-state)
(doom-modeline-update-env))))
(add-hook 'focus-in-hook #'doom-modeline-update-env)))
(defun doom-modeline-env--get (prog args callback)
"Start a sub process using PROG and apply the ARGS to the sub process.
Once it receives information from STDOUT, it closes off the subprocess and
passes on the information into the CALLBACK.
Example:
(doom-modeline-env--get
\"ruby\"
'(\"--version\")
(lambda (line)
(message (doom-modeline-parser--ruby line)))"
(let ((proc (apply 'start-process
;; Flaten process-args into a single list so we can handle
;; variadic length args
(append
(list "doom-modeline-env" nil prog)
args)))
(parser callback))
(set-process-filter proc
(lambda (_proc line)
(ignore-errors
(funcall parser line))))))
(cl-defmacro doom-modeline-def-env (name &key hooks command parser)
"Defines a handler for updating & displaying a version string for a language.
NAME is an unquoted symbol representing the handler's unique ID.
HOOKS is a list of hook symbols where this handler should be triggered.
COMMAND should be a function that returns a shell command and its arguments (as
a list). It is run on HOOKS. It takes no arguments.
PARSER should be a function for parsing COMMAND's output line-by-line, to
extract the version string."
(declare (indent defun))
(unless (and hooks command parser)
(error "'%s' env is missing either :hooks, :command or :parser" name))
(let ((parse-fn (intern (format "doom-modeline-env--%s-parse" name)))
(action-fn (intern (format "doom-modeline-env--%s-args" name)))
(setup-fn (intern (format "doom-modeline-env-setup-%s" name)))
(update-fn (intern (format "doom-modeline-env-update-%s" name)))
(enable-var (intern (format "doom-modeline-env-enable-%s" name)))
(command-var (intern (format "doom-modeline-env-%s-command" name)))
(parser-var (intern (format "doom-modeline-env-%s-parser-fn" name)))
(exe-var (intern (format "doom-modeline-env-%s-executable" name))))
(macroexp-progn
`((defcustom ,enable-var t
,(format "Whether to display the version string for %s buffers." name)
:type 'boolean
:group 'doom-modeline-env)
(defvar ,command-var ',action-fn
,(concat "A function that returns the shell command and arguments (as a list) to\n"
"produce a version string."))
(defvar ,parser-var ',parse-fn
,(format "The function to parse each line of `%s'\'s output." command-var))
(defcustom ,exe-var nil
,(format (concat "What executable to use for the version indicator in %s buffers.\n\n"
"If nil, the default binary for this language is used.")
name)
:type 'string
:group 'doom-modeline-env)
(defalias ',parse-fn ,parser
(format "The line parser for %s buffers.\n\nUsed by `%s'."
',name ',update-fn))
(defalias ',action-fn ,command
(format "The command resolver for %s buffers.\n\nUsed by `%s'."
',name ',update-fn))
(defalias ',setup-fn
(lambda ()
(if enable-local-variables
(add-hook 'hack-local-variables-hook #',update-fn nil t)
(,update-fn)))
(format "Prepares the modeline to later display the %s version string."
',name))
(defalias ',update-fn
(lambda ()
(when ,enable-var
(when-let* ((command-list (funcall ,command-var))
(exe (executable-find (car command-list))))
(setq doom-modeline-env--command exe
doom-modeline-env--command-args (cdr command-list)
doom-modeline-env--parser ,parser-var)
(doom-modeline-update-env))))
(format "Updates the %s version string in the modeline." ',name))
(let ((hooks ',(eval hooks)))
(dolist (hook (if (listp hooks) hooks (list hooks)))
(add-hook hook #',setup-fn)))))))
;; Bootstrap
;; Versions, support Python, Ruby, Perl and Golang, etc.
;;;###autoload (autoload 'doom-modeline-env-setup-python "doom-modeline-env")
(doom-modeline-def-env python
:hooks 'python-mode-hook
:command (lambda () (cond ((and (fboundp 'pipenv-project-p)
(pipenv-project-p))
(list "pipenv" "run"
(or doom-modeline-env-python-executable
python-shell-interpreter
"python")
"--version"))
((executable-find "pyenv") (list "pyenv" "version-name"))
((list (or doom-modeline-env-python-executable
python-shell-interpreter
"python")
"--version"))))
:parser (lambda (line) (let ((version (split-string line)))
(if (>= (length version) 2)
(cadr version)
(car version)))))
;;;###autoload (autoload 'doom-modeline-env-setup-ruby "doom-modeline-env")
(doom-modeline-def-env ruby
:hooks '(ruby-mode-hook enh-ruby-mode-hook)
:command (lambda () (list (or doom-modeline-env-ruby-executable "ruby") "--version"))
:parser (lambda (line)
(car (split-string
(cadr
(split-string line))
"p"))))
;;;###autoload (autoload 'doom-modeline-env-setup-perl "doom-modeline-env")
(doom-modeline-def-env perl
:hooks 'perl-mode-hook
:command (lambda () (list (or doom-modeline-env-perl-executable "perl") "--version"))
:parser (lambda (line)
(cadr
(split-string
(car
(split-string
(cadr
(split-string line "("))
")"))
"v"))))
;;;###autoload (autoload 'doom-modeline-env-setup-go "doom-modeline-env")
(doom-modeline-def-env go
:hooks 'go-mode-hook
:command (lambda () (list (or doom-modeline-env-go-executable "go") "version"))
:parser (lambda (line)
(cadr
(split-string
(cadr
(cdr
(split-string line)))
"go"))))
;;;###autoload (autoload 'doom-modeline-env-setup-elixir "doom-modeline-env")
(doom-modeline-def-env elixir
:hooks 'elixir-mode-hook
:command (lambda () (list (or doom-modeline-env-elixir-executable "elixir") "--version"))
:parser (lambda (line) (cadr (split-string line))))
;;;###autoload (autoload 'doom-modeline-env-setup-rust "doom-modeline-env")
(doom-modeline-def-env rust
:hooks 'rust-mode-hook
:command (lambda () (list (or doom-modeline-env-rust-executable "rustc") "--version"))
:parser (lambda (line)
(car
(split-string
(cadr
(split-string line))
"-"))))
(provide 'doom-modeline-env)
;;; doom-modeline-env.el ends here

View file

@ -0,0 +1,15 @@
(define-package "doom-modeline" "20220412.853" "A minimal and modern mode-line"
'((emacs "25.1")
(all-the-icons "2.2.0")
(shrink-path "0.2.0")
(dash "2.11.0"))
:commit "7d8eb7c44087a62d8dd6e8ba1afc26facd914fbc" :authors
'(("Vincent Zhang" . "seagle0128@gmail.com"))
:maintainer
'("Vincent Zhang" . "seagle0128@gmail.com")
:keywords
'("faces" "mode-line")
:url "https://github.com/seagle0128/doom-modeline")
;; Local Variables:
;; no-byte-compile: t
;; End:

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,311 @@
;;; doom-modeline.el --- A minimal and modern mode-line -*- lexical-binding: t; -*-
;; Copyright (C) 2018-2020 Vincent Zhang
;; Author: Vincent Zhang <seagle0128@gmail.com>
;; Homepage: https://github.com/seagle0128/doom-modeline
;; Version: 3.3.0
;; Package-Requires: ((emacs "25.1") (all-the-icons "2.2.0") (shrink-path "0.2.0") (dash "2.11.0"))
;; Keywords: faces mode-line
;; 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 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 <https://www.gnu.org/licenses/>.
;;
;;; Commentary:
;;
;; This package offers a fancy and fast mode-line inspired by minimalism design.
;;
;; It's integrated into Doom Emacs (https://github.com/hlissner/doom-emacs) and
;; Centaur Emacs (https://github.com/seagle0128/.emacs.d).
;;
;; The doom-modeline offers:
;; - A match count panel (for anzu, iedit, multiple-cursors, symbol-overlay,
;; evil-search and evil-substitute)
;; - An indicator for recording a macro
;; - Current environment version (e.g. python, ruby, go, etc.) in the major-mode
;; - A customizable mode-line height (see doom-modeline-height)
;; - A minor modes segment which is compatible with minions
;; - An error/warning count segment for flymake/flycheck
;; - A workspace number segment for eyebrowse
;; - A perspective name segment for persp-mode
;; - A window number segment for winum and window-numbering
;; - An indicator for modal editing state, including evil, overwrite, god, ryo
;; and xah-fly-keys, etc.
;; - An indicator for battery status
;; - An indicator for current input method
;; - An indicator for debug state
;; - An indicator for remote host
;; - An indicator for LSP state with lsp-mode or eglot
;; - An indicator for github notifications
;; - An indicator for unread emails with mu4e-alert
;; - An indicator for unread emails with gnus (basically builtin)
;; - An indicator for irc notifications with circe, rcirc or erc.
;; - An indicator for buffer position which is compatible with nyan-mode or poke-line
;; - An indicator for party parrot
;; - An indicator for PDF page number with pdf-tools
;; - An indicator for markdown/org previews with grip
;; - Truncated file name, file icon, buffer state and project name in buffer
;; information segment, which is compatible with project, find-file-in-project
;; and projectile
;; - New mode-line for Info-mode buffers
;; - New package mode-line for paradox
;; - New mode-line for helm buffers
;; - New mode-line for git-timemachine buffers
;;
;; Installation:
;; From melpa, `M-x package-install RET doom-modeline RET`.
;; In `init.el`,
;; (require 'doom-modeline)
;; (doom-modeline-mode 1)
;; or
;; (use-package doom-modeline
;; :ensure t
;; :hook (after-init . doom-modeline-mode))
;;
;;; Code:
(require 'doom-modeline-core)
(require 'doom-modeline-segments)
;;
;; Mode lines
;;
(doom-modeline-def-modeline 'main
'(bar workspace-name window-number modals matches follow buffer-info remote-host buffer-position word-count parrot selection-info)
'(objed-state misc-info persp-name battery grip irc mu4e gnus github debug repl lsp minor-modes input-method indent-info buffer-encoding major-mode process vcs checker))
(doom-modeline-def-modeline 'minimal
'(bar matches buffer-info-simple)
'(media-info major-mode))
(doom-modeline-def-modeline 'special
'(bar window-number modals matches buffer-info buffer-position word-count parrot selection-info)
'(objed-state misc-info battery irc-buffers debug minor-modes input-method indent-info buffer-encoding major-mode process))
(doom-modeline-def-modeline 'project
'(bar window-number modals buffer-default-directory)
'(misc-info battery irc mu4e gnus github debug minor-modes input-method major-mode process))
(doom-modeline-def-modeline 'dashboard
'(bar window-number buffer-default-directory-simple)
'(misc-info battery irc mu4e gnus github debug minor-modes input-method major-mode process))
(doom-modeline-def-modeline 'vcs
'(bar window-number modals matches buffer-info buffer-position parrot selection-info)
'(misc-info battery irc mu4e gnus github debug minor-modes buffer-encoding major-mode process))
(doom-modeline-def-modeline 'package
'(bar window-number package)
'(misc-info major-mode process))
(doom-modeline-def-modeline 'info
'(bar window-number buffer-info info-nodes buffer-position parrot selection-info)
'(misc-info buffer-encoding major-mode))
(doom-modeline-def-modeline 'media
'(bar window-number buffer-size buffer-info)
'(misc-info media-info major-mode process vcs))
(doom-modeline-def-modeline 'message
'(bar window-number modals matches buffer-info-simple buffer-position word-count parrot selection-info)
'(objed-state misc-info battery debug minor-modes input-method indent-info buffer-encoding major-mode))
(doom-modeline-def-modeline 'pdf
'(bar window-number matches buffer-info pdf-pages)
'(misc-info major-mode process vcs))
(doom-modeline-def-modeline 'org-src
'(bar window-number modals matches buffer-info-simple buffer-position word-count parrot selection-info)
'(objed-state misc-info debug lsp minor-modes input-method indent-info buffer-encoding major-mode process checker))
(doom-modeline-def-modeline 'helm
'(bar helm-buffer-id helm-number helm-follow helm-prefix-argument)
'(helm-help))
(doom-modeline-def-modeline 'timemachine
'(bar window-number modals matches git-timemachine buffer-position word-count parrot selection-info)
'(misc-info minor-modes indent-info buffer-encoding major-mode))
;;
;; Interfaces
;;
;;;###autoload
(defun doom-modeline-init ()
"Initialize doom mode-line."
(doom-modeline-mode 1))
(make-obsolete 'doom-modeline-init 'doom-modeline-mode "1.6.0")
;;;###autoload
(defun doom-modeline-set-main-modeline (&optional default)
"Set main mode-line.
If DEFAULT is non-nil, set the default mode-line for all buffers."
(doom-modeline-set-modeline 'main default))
;;;###autoload
(defun doom-modeline-set-minimal-modeline ()
"Set minimal mode-line."
(doom-modeline-set-modeline 'minimal))
;;;###autoload
(defun doom-modeline-set-special-modeline ()
"Set special mode-line."
(doom-modeline-set-modeline 'special))
;;;###autoload
(defun doom-modeline-set-project-modeline ()
"Set project mode-line."
(doom-modeline-set-modeline 'project))
;;;###autoload
(defun doom-modeline-set-dashboard-modeline ()
"Set dashboard mode-line."
(doom-modeline-set-modeline 'dashboard))
;;;###autoload
(defun doom-modeline-set-vcs-modeline ()
"Set vcs mode-line."
(doom-modeline-set-modeline 'vcs))
;;;###autoload
(defun doom-modeline-set-info-modeline ()
"Set Info mode-line."
(doom-modeline-set-modeline 'info))
;;;###autoload
(defun doom-modeline-set-package-modeline ()
"Set package mode-line."
(doom-modeline-set-modeline 'package))
;;;###autoload
(defun doom-modeline-set-media-modeline ()
"Set media mode-line."
(doom-modeline-set-modeline 'media))
;;;###autoload
(defun doom-modeline-set-message-modeline ()
"Set message mode-line."
(doom-modeline-set-modeline 'message))
;;;###autoload
(defun doom-modeline-set-pdf-modeline ()
"Set pdf mode-line."
(doom-modeline-set-modeline 'pdf))
;;;###autoload
(defun doom-modeline-set-org-src-modeline ()
"Set org-src mode-line."
(doom-modeline-set-modeline 'org-src))
;;;###autoload
(defun doom-modeline-set-helm-modeline (&rest _) ; To advice helm
"Set helm mode-line."
(doom-modeline-set-modeline 'helm))
;;;###autoload
(defun doom-modeline-set-timemachine-modeline ()
"Set timemachine mode-line."
(doom-modeline-set-modeline 'timemachine))
;;
;; Minor mode
;;
(defvar doom-modeline-mode-map (make-sparse-keymap))
;; Suppress warnings
(defvar 2C-mode-line-format)
(declare-function helm-display-mode-line "ext:helm-core")
;;;###autoload
(define-minor-mode doom-modeline-mode
"Toggle doom-modeline on or off."
:group 'doom-modeline
:global t
:lighter nil
:keymap doom-modeline-mode-map
(if doom-modeline-mode
(progn
(doom-modeline-refresh-bars) ; Create bars
(doom-modeline-set-main-modeline t) ; Set default mode-line
;; Apply to all existing buffers.
(dolist (buf (buffer-list))
(with-current-buffer buf
(doom-modeline-set-main-modeline)))
;; For two-column editing
(setq 2C-mode-line-format (doom-modeline 'special))
;; Add hooks
(add-hook 'Info-mode-hook #'doom-modeline-set-info-modeline)
(add-hook 'dired-mode-hook #'doom-modeline-set-project-modeline)
(add-hook 'dashboard-mode-hook #'doom-modeline-set-dashboard-modeline)
(add-hook 'image-mode-hook #'doom-modeline-set-media-modeline)
(add-hook 'message-mode-hook #'doom-modeline-set-message-modeline)
(add-hook 'git-commit-mode-hook #'doom-modeline-set-message-modeline)
(add-hook 'magit-mode-hook #'doom-modeline-set-vcs-modeline)
(add-hook 'circe-mode-hook #'doom-modeline-set-special-modeline)
(add-hook 'erc-mode-hook #'doom-modeline-set-special-modeline)
(add-hook 'rcirc-mode-hook #'doom-modeline-set-special-modeline)
(add-hook 'pdf-view-mode-hook #'doom-modeline-set-pdf-modeline)
(add-hook 'org-src-mode-hook #'doom-modeline-set-org-src-modeline)
(add-hook 'git-timemachine-mode-hook #'doom-modeline-set-timemachine-modeline)
(add-hook 'paradox-menu-mode-hook #'doom-modeline-set-package-modeline)
(add-hook 'xwidget-webkit-mode-hook #'doom-modeline-set-minimal-modeline)
;; Add advices
(advice-add #'helm-display-mode-line :after #'doom-modeline-set-helm-modeline))
(progn
;; Restore mode-line
(let ((original-format (doom-modeline--original-value 'mode-line-format)))
(setq-default mode-line-format original-format)
(dolist (buf (buffer-list))
(with-current-buffer buf
(setq mode-line-format original-format))))
;; For two-column editing
(setq 2C-mode-line-format (doom-modeline--original-value '2C-mode-line-format))
;; Remove hooks
(remove-hook 'Info-mode-hook #'doom-modeline-set-info-modeline)
(remove-hook 'dired-mode-hook #'doom-modeline-set-project-modeline)
(remove-hook 'dashboard-mode-hook #'doom-modeline-set-dashboard-modeline)
(remove-hook 'image-mode-hook #'doom-modeline-set-media-modeline)
(remove-hook 'message-mode-hook #'doom-modeline-set-message-modeline)
(remove-hook 'git-commit-mode-hook #'doom-modeline-set-message-modeline)
(remove-hook 'magit-mode-hook #'doom-modeline-set-vcs-modeline)
(remove-hook 'circe-mode-hook #'doom-modeline-set-special-modeline)
(remove-hook 'erc-mode-hook #'doom-modeline-set-special-modeline)
(remove-hook 'rcirc-mode-hook #'doom-modeline-set-special-modeline)
(remove-hook 'pdf-view-mode-hook #'doom-modeline-set-pdf-modeline)
(remove-hook 'org-src-mode-hook #'doom-modeline-set-org-src-modeline)
(remove-hook 'git-timemachine-mode-hook #'doom-modeline-set-timemachine-modeline)
(remove-hook 'paradox-menu-mode-hook #'doom-modeline-set-package-modeline)
(remove-hook 'xwidget-webkit-mode-hook #'doom-modeline-set-minimal-modeline)
;; Remove advices
(advice-remove #'helm-display-mode-line #'doom-modeline-set-helm-modeline))))
(provide 'doom-modeline)
;;; doom-modeline.el ends here

View file

@ -0,0 +1,22 @@
;;; shrink-path-autoloads.el --- automatically extracted autoloads -*- lexical-binding: t -*-
;;
;;; Code:
(add-to-list 'load-path (directory-file-name
(or (file-name-directory #$) (car load-path))))
;;;### (autoloads nil "shrink-path" "shrink-path.el" (0 0 0 0))
;;; Generated autoloads from shrink-path.el
(register-definition-prefixes "shrink-path" '("shrink-path-"))
;;;***
;; Local Variables:
;; version-control: never
;; no-byte-compile: t
;; no-update-autoloads: t
;; coding: utf-8
;; End:
;;; shrink-path-autoloads.el ends here

View file

@ -0,0 +1,2 @@
;;; Generated package description from shrink-path.el -*- no-byte-compile: t -*-
(define-package "shrink-path" "20190208.1335" "fish-style path" '((emacs "24") (s "1.6.1") (dash "1.8.0") (f "0.10.0")) :commit "c14882c8599aec79a6e8ef2d06454254bb3e1e41" :authors '(("Benjamin Andresen")) :maintainer '("Benjamin Andresen") :url "https://gitlab.com/bennya/shrink-path.el")

View file

@ -0,0 +1,150 @@
;;; shrink-path.el --- fish-style path -*- lexical-binding: t; -*-
;; Copyright (C) 2017 Benjamin Andresen
;; Author: Benjamin Andresen
;; Version: 0.3.1
;; Package-Version: 20190208.1335
;; Package-Commit: c14882c8599aec79a6e8ef2d06454254bb3e1e41
;; URL: https://gitlab.com/bennya/shrink-path.el
;; Package-Requires: ((emacs "24") (s "1.6.1") (dash "1.8.0") (f "0.10.0"))
;; 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 3, 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 GNU Emacs; see the file LICENSE. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;; Commentary:
;; Provides functions that offer fish shell[1] path truncation.
;; Directory /usr/share/emacs/site-lisp => /u/s/e/site-lisp
;;
;; Also includes utility functions that make integration in eshell or the
;; modeline easier.
;;
;; [1] https://fishshell.com/
;;; Code:
(require 'dash)
(require 's)
(require 'f)
(require 'rx)
(defun shrink-path--truncate (str)
"Return STR's first character or first two characters if hidden."
(substring str 0 (if (s-starts-with? "." str) 2 1)))
(defun shrink-path--dirs-internal (full-path &optional truncate-all)
"Return fish-style truncated string based on FULL-PATH.
Optional parameter TRUNCATE-ALL will cause the function to truncate the last
directory too."
(let* ((home (expand-file-name "~"))
(path (replace-regexp-in-string
(s-concat "^" home) "~" full-path))
(split (s-split "/" path 'omit-nulls))
(split-len (length split))
shrunk)
(->> split
(--map-indexed (if (= it-index (1- split-len))
(if truncate-all (shrink-path--truncate it) it)
(shrink-path--truncate it)))
(s-join "/")
(setq shrunk))
(s-concat (unless (s-matches? (rx bos (or "~" "/")) shrunk) "/")
shrunk
(unless (s-ends-with? "/" shrunk) "/"))))
(defun shrink-path-dirs (&optional path truncate-tail)
"Given PATH return fish-styled shrunken down path.
TRUNCATE-TAIL will cause the function to truncate the last directory too."
(let* ((path (or path default-directory))
(path (f-full path)))
(cond
((s-equals? (f-short path) "/") "/")
((s-matches? (rx bos (or "~" "/") eos) "~/"))
(t (shrink-path--dirs-internal path truncate-tail)))))
(defun shrink-path-expand (str &optional absolute-p)
"Return expanded path from STR if found or list of matches on multiple.
The path referred to by STR has to exist for this to work.
If ABSOLUTE-P is t the returned path will be absolute."
(let* ((str-split (s-split "/" str 'omit-nulls))
(head (car str-split)))
(if (= (length str-split) 1)
(s-concat "/" str-split)
(--> (-drop 1 str-split) ;; drop head
(-map (lambda (e) (s-concat e "*")) it)
(-drop-last 1 it) ;; drop tail as it may not exist
(s-join "/" it)
(s-concat (if (s-equals? head "~") "~/" head) it)
(f-glob it)
(-map (lambda (e) (s-concat e "/" (-last-item str-split))) it)
(if absolute-p (-map #'f-full it) (-map #'f-abbrev it))
(if (= (length it) 1) (car it) it)))))
(defun shrink-path-prompt (&optional pwd)
"Return cons of BASE and DIR for PWD.
If PWD isn't provided will default to `default-directory'."
(let* ((pwd (or pwd default-directory))
(shrunk (shrink-path-dirs pwd))
(split (--> shrunk (s-split "/" it 'omit-nulls)))
base dir)
(setq dir (or (-last-item split) "/"))
(setq base (if (s-equals? dir "/") ""
(s-chop-suffix (s-concat dir "/") shrunk)))
(cons base dir)))
(defun shrink-path-file (file &optional truncate-tail)
"Return FILE's shrunk down path and filename.
TRUNCATE-TAIL controls if the last directory should also be shortened."
(let ((filename (f-filename file))
(dirname (f-dirname file)))
(s-concat (shrink-path-dirs dirname truncate-tail) filename)))
(defun shrink-path-file-expand (str &optional exists-p absolute-p)
"Return STR's expanded filename.
The path referred to by STR has to exist for this to work.
If EXISTS-P is t the filename also has to exist.
If ABSOLUTE-P is t the returned path will be absolute."
(let ((expanded (shrink-path-expand str absolute-p)))
(if (and expanded exists-p)
(if (f-exists? expanded) expanded)
expanded)))
(defun shrink-path-file-mixed (shrink-path rel-path filename)
"Returns list of mixed truncated file name locations.
Consists of SHRINK-PATH's parent, SHRINK-PATH basename, relative REL-PATH and
FILENAME.
For use in modeline or prompts, etc."
(let ((shrunk-dirs (shrink-path-prompt shrink-path))
sp-parent sp-rel rel-rel nd-file)
(when (f-descendant-of? filename shrink-path)
(when shrunk-dirs
(setq sp-parent (car shrunk-dirs)
sp-rel (cdr shrunk-dirs)))
(setq rel-rel (if (or (f-same? rel-path shrink-path)
(s-equals? (f-relative rel-path shrink-path) "."))
nil
(f-relative rel-path shrink-path)))
(setq nd-file (file-name-nondirectory filename))
(list sp-parent sp-rel rel-rel nd-file))))
(provide 'shrink-path)
;;; shrink-path.el ends here