Skip to content

Commit

Permalink
feat: Update customization options
Browse files Browse the repository at this point in the history
  • Loading branch information
nagy committed Apr 8, 2022
1 parent a1e52ed commit 3308412
Showing 1 changed file with 28 additions and 8 deletions.
36 changes: 28 additions & 8 deletions tokei.el
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
;; Created: April 1, 2022
;; Version: 0.1
;; Homepage: https://github.com/nagy/tokei.el
;; Package-Requires: ((emacs "27.1") magit-section)
;; Package-Requires: ((emacs "27.1") (magit-section "3.3.0"))
;;
;; This file is NOT part of GNU Emacs.
;;
Expand All @@ -30,21 +30,40 @@
;;
;;; Code:

(require 'cl-lib)
(require 'magit-section)
(require 'json)
(eval-when-compile
(require 'cl-lib))

;;; Options

(defgroup tokei nil
"Display codebase statistics."
:group 'extensions
:prefix "tokei-")

(defcustom tokei-program "tokei"
"Path to the 'tokei' program."
:type 'string)

;;;; Faces

(defgroup tokei-faces nil
"Faces used by Tokei."
:group 'tokei
:group 'faces)

(defface tokei-num-code-face nil
"Tokei number of lines of code."
:group 'faces)
:group 'tokei-faces)

(defface tokei-num-comments-face nil
"Tokei number of lines of comments."
:group 'faces)
:group 'tokei-faces)

(defvar-local tokei-data nil "Tokei buffer local data.")
;;; Commands

(defvar tokei-program "tokei" "Path to the tokei program.")
(defvar-local tokei-data nil "Tokei buffer local data.")

(defun tokei--data ()
"Return newly created tokei data for this directory."
Expand Down Expand Up @@ -96,6 +115,7 @@ Data is provided via the JSON argument"

(define-derived-mode tokei-mode magit-section-mode "Tokei"
"Tokei mode."
:group 'tokei
(setq tokei-data (tokei--data))
(setq-local revert-buffer-function (lambda (&rest _) (tokei-mode)))
(let ((inhibit-read-only t))
Expand Down Expand Up @@ -135,10 +155,10 @@ Data is provided via the JSON argument"
;; TODO virtual dired from one language files
;; TODO context-menu
;; TODO dired tokei only marked entries to filter out
;; TODO count all marked lines
;; TODO region counter
;; TODO count all marked lines ( region )
;; TODO show only minimum amount of code/comment lines. take prefix argument
;; TODO segment definition for telephone line
;; TODO project.el mode new in emacs

(provide 'tokei)
;;; tokei.el ends here

0 comments on commit 3308412

Please sign in to comment.