From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philip Kaludercic Newsgroups: gmane.emacs.devel Subject: Re: [NonGNU Elpa] New package: ETT Date: Wed, 03 May 2023 06:08:31 +0000 Message-ID: <87mt2m9cbk.fsf@posteo.net> References: <86r0rybf2b.fsf@disroot.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22796"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: John Task Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed May 03 08:09:13 2023 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pu5ft-0005hW-0j for ged-emacs-devel@m.gmane-mx.org; Wed, 03 May 2023 08:09:13 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pu5fQ-0004iS-3u; Wed, 03 May 2023 02:08:44 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pu5fK-0004iJ-Fh for emacs-devel@gnu.org; Wed, 03 May 2023 02:08:38 -0400 Original-Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pu5fH-0000oI-Gj for emacs-devel@gnu.org; Wed, 03 May 2023 02:08:38 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 3AE2C240207 for ; Wed, 3 May 2023 08:08:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1683094112; bh=k40yW1pMyLDyRDUw4TI7akWz9DYgki0bA8GCC3zcb7I=; h=From:To:Cc:Subject:Autocrypt:Date:From; b=KwYDFh4KulfdUPzYnWq+o0IueEQ69HxzXcCDU3Nx828cZM3HEdEQil+3G6ZZuSkL4 C6+0lk5WAzWWySObnZ9vUpDZF0WKia8br/pIK+U9Jlu/1PjtSD0JBWCw+aEEQseBeP 0EKpwmFHcL8mlqfDs3ZpxbsLo1xqiHJF57mc9dmRXx5pGcoiPMOb4PgFMiR1lH18us hKHRYZeem4iHUCalyx902wzdqnFYbYrl7e+dzhwxXe5RNN/Q98xSNPwirvaiup8lxU 7y809IsRZNFGAqx516/NLhZzbtRqa8YH6h1QM8z4HpMnk94mFGrF5unKDKACXM7I6T LYVLz6umy24nQ== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4QB62R5PF7z6txS; Wed, 3 May 2023 08:08:31 +0200 (CEST) In-Reply-To: <86r0rybf2b.fsf@disroot.org> (John Task's message of "Tue, 02 May 2023 18:21:14 -0300") Autocrypt: addr=philipk@posteo.net; keydata= mDMEZBBQQhYJKwYBBAHaRw8BAQdAHJuofBrfqFh12uQu0Yi7mrl525F28eTmwUDflFNmdui0QlBo aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0 ZW8ubmV0PoiWBBMWCAA+FiEEDg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwMFCQHhM4AFCwkI BwIGFQoJCAsCBBYCAwECHgECF4AACgkQ8xYDWXahwulikAEA77hloUiSrXgFkUVJhlKBpLCHUjA0 mWZ9j9w5d08+jVwBAK6c4iGP7j+/PhbkxaEKa4V3MzIl7zJkcNNjHCXmvFcEuDgEZBBQQhIKKwYB BAGXVQEFAQEHQI5NLiLRjZy3OfSt1dhCmFyn+fN/QKELUYQetiaoe+MMAwEIB4h+BBgWCAAmFiEE Dg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwwFCQHhM4AACgkQ8xYDWXahwukm+wEA8cml4JpK NeAu65rg+auKrPOP6TP/4YWRCTIvuYDm0joBALw98AMz7/qMHvSCeU/hw9PL6u6R2EScxtpKnWof z4oM Received-SPF: pass client-ip=185.67.36.65; envelope-from=philipk@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:305764 Archived-At: --=-=-= Content-Type: text/plain John Task writes: > [Disclaimer: A similar message was posted here a couple months ago by > me. Sorry if that's an annoyance. This one is clearer, though.] > > Hello. My name is John Task and I'd like to submit a package to > NonGNU ELPA. I'm the author of this program and also (at the time of > writing) the only contributor to the code. As far as I can tell, > everything is in line with the guidances and I plan to keep it that > way. > > The URL of the repository is: https://gitlab.com/q01_code/ett > > The description is as follows: > > ---------------------------------------------------------------------- > Emacs Time Tracker (or short ETT) is a simple yet powerful time > tracker for Emacs. Even though it's based on a minimalist plain > text file, it can show statistics for current day, week, month or > year, and even compare tags recording for the same item given any > of these periods. > > Advanced features include percentages, graphs and icons. > > Clock-in with M-x ett-add-track, go to file with M-x ett-find-file, > and get report with M-x ett-report. You probably want to bind these > functions to easy keys. > ---------------------------------------------------------------------- > > The corresponding patch would be: > > --- > From 72c7ba2c1ecd375be52b071d25217088e66e9abb Mon Sep 17 00:00:00 2001 > From: John Task > Date: Tue, 2 May 2023 17:40:44 -0300 > Subject: [PATCH] New package > > --- > elpa-packages | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/elpa-packages b/elpa-packages > index c333cc8bb3..385a76264d 100644 > --- a/elpa-packages > +++ b/elpa-packages > @@ -154,6 +154,11 @@ > :readme "README.md" > :ignored-files ("doc/demo.gif")) > > + (ett :url "https://gitlab.com/q01_code/ett" > + :readme ignore > + :doc "ett-manual.org" > + :ignored-files ("ett-manual.org" "COPYING" "ETT.png" "doclicense.texi")) > + > (evil :url "https://github.com/emacs-evil/evil" > :ignored-files ("COPYING" "lib" "scripts") > :doc "doc/build/texinfo/evil.texi") I would track the ignored files in a .elpaignore file that would look something like this --8<---------------cut here---------------start------------->8--- /ett-pkg.el /ett-autoloads.el /ett-manual.org /COPYING /ETT.png /doclicense.texi --8<---------------cut here---------------end--------------->8--- and I have prepared a few comments here: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable diff --git a/ett.el b/ett.el index c37d7f15b0..de6a017248 100644 --- a/ett.el +++ b/ett.el @@ -89,7 +89,7 @@ Something like '-->' or '=3D=3D=3D=3D>' would be acceptab= le." Unlike `ett-separator', you can safely change this to anything you want." :type '(string)) =20 -(defcustom ett-file (concat user-emacs-directory "tracks.ett") +(defcustom ett-file (locate-user-emacs-file "tracks.ett") "File for storing ETT tracks." :type '(file)) =20 @@ -125,10 +125,10 @@ size to be displayed. Only even numbers are allowed. Indeed, it's a weird bug." :type '(natnum)) =20 -(defcustom ett-graph-icon "=E2=94=82" +(defcustom ett-graph-icon ?=E2=94=82 "Icon used for building ETT graphs. It must be a single char string." - :type '(string)) + :type 'character) =20 (defface ett-heading '((((class color) (min-colors 88) (background light)) @@ -170,7 +170,7 @@ It must be a single char string." (list "^\\(Less time .*\\): " '(1 'underline)) (list "^\\(Tags report\\):$" '(1 'underline)) (list "^\\(Pending goals\\):$" '(1 'underline)) - (list (concat ett-graph-icon "+") '(0 'ett-separator-face))) + (list (concat (string ett-graph-icon) "+") '(0 'ett-separator-face= ))) "Keywords for syntax highlighting on ETT report buffer.") =20 (defvar ett-items-internal nil) @@ -269,41 +269,36 @@ Here are some translations (*starred* values are curr= ent at the time): 3-2 ---> 03-02-*23* 03 ---> 03-*02*-*23* 3 ---> 03-*02*-*23*" - (pcase (length date) - ;; DD-MM-YY - (8 date) - ;; DD-MM - (5 (setq date (concat date (format-time-string "-%y")))) - ;; DD - (2 (setq date (concat date (format-time-string "-%m-%y")))) - ;; D - (1 (setq date (concat "0" date (format-time-string "-%m-%y")))) - ;; DD-M - (4 - (setq date - ;; Or D-MM? - (pcase (string-search "0" date) - (2 (concat "0" date (format-time-string "-%y"))) - (_ (concat + (setq date + (pcase (length date) + ;; DD-MM-YY + (8 date) + ;; DD-MM + (5 (concat date (format-time-string "-%y"))) + ;; DD + (2 (concat date (format-time-string "-%m-%y"))) + ;; D + (1 (concat "0" date (format-time-string "-%m-%y"))) + ;; DD-M + (4 + ;; Or D-MM? + (pcase (string-search "0" date) + (2 (concat "0" date (format-time-string "-%y"))) + (_ (concat (replace-regexp-in-string "-\\(.*\\)" "-0\\1" date) - (format-time-string "-%y")))))) - ;; D-M - (3 (setq date - (concat "0" (replace-regexp-in-string "-\\(.*\\)" "-0\\1" dat= e) - (format-time-string "-%y")))) - ;; D-MM-YY - (7 (setq date - ;; Or DD-M-YY? - (pcase (string-search "0" date) - (2 (concat "0" date)) - (_ (concat - (replace-regexp-in-string "-\\(.*\\)-" "-0\\1-" date)))= ))) - ;; D-M-YY (who writes like that?) - (6 (setq date - (concat "0" - (replace-regexp-in-string "-\\(.*\\)-" "-0\\1-" date)= )))) - ;; Return date - date) + (format-time-string "-%y"))))) + ;; D-M + (3 (concat "0" (replace-regexp-in-string "-\\(.*\\)" "-0\\1" date) + (format-time-string "-%y"))) + ;; D-MM-YY + (7 ;; Or DD-M-YY? + (pcase (string-search "0" date) + (2 (concat "0" date)) + (_ (concat + (replace-regexp-in-string "-\\(.*\\)-" "-0\\1-" date))))) + ;; D-M-YY (who writes like that?) + (6 (concat "0" + (replace-regexp-in-string "-\\(.*\\)-" "-0\\1-" date)))))) =20 (defun ett-custom-date (date &optional date2) "Operate on current buffer so the only date is DATE. @@ -329,7 +324,7 @@ With optional DATE2, include every date between DATE an= d DATE2." (ett-finalize-scope "00:00"))))) =20 (defun ett-do-division (num1 num2) - "Divide NUM1 between NUM2." + "Divide NUM1 between NUM2." ;can you explain why this is needed? (if (/=3D (% num1 num2) 0) (/ (float num1) num2) (/ num1 num2))) @@ -511,7 +506,7 @@ Like `insert-rectangle', but doesn't set mark." (insert (mapconcat #'concat (make-list (- col (current-column)) " ") ""= ))) (ett-insert-rectangle - (make-list graph-f ett-graph-icon))) + (make-list graph-f (string ett-graph-icon)))) (setq list (cdr list) col (current-column))) (setq beacon (point) @@ -545,7 +540,7 @@ Like `insert-rectangle', but doesn't set mark." (defun ett-prettify-time (time) "Return a prettified string for TIME." (let ((hr 0)) - (while (>=3D time 60) + (while (>=3D time 60) ;the loop here shouldn't be necessary, you can= calculate the same thing using remainder and floor (setq hr (1+ hr) time (- time 60))) (concat @@ -789,7 +784,7 @@ When NOTOTAL is non-nil, don't add total indicator." (save-excursion ;; Sort items ;; We need to do it in two steps because it's somehow complicated - (sort-regexp-fields t "^.*$" "\\(:[0-9]+\\)" (point-min) (point-max)) + (sort-regexp-fields t "^.*$" "\\(:[0-9]+\\)" (point-min) (point-max)= ) ;have you considered using rx? (sort-regexp-fields t "^.*$" "\\([0-9]+:\\)" (point-min) (point-max)) ;; We now align (align-regexp @@ -1174,13 +1169,27 @@ Use the command `ett-modeline-mode' to change this = variable.") ;; Clock in (ett-add-track item tag))) =20 +(defvar ett-view-mode-map + (let ((map (make-sparse-keymap))) + (define-key map (kbd "C-c C-c") #'ett-add-track) + (define-key map (kbd "SPC") #'ett-space-dwim) + map)) + (define-derived-mode ett-mode text-mode "ETT" "Major mode for editing ETT based texts." (setq font-lock-defaults '(ett-font-lock-keywords t)) - (setq-local outline-regexp "[0-9]+-[0-9]+-[0-9]+") + (setq-local outline-regexp "[0-9]+-[0-9]+-[0-9]+") ;does this need to st= art with a ^ ;; show-paren-mode can be somehow annoying here (show-paren-local-mode -1)) =20 +(defvar ett-view-mode-map + (let ((map (make-sparse-keymap))) + (define-key map (kbd "q") #'bury-buffer) + (define-key map (kbd "SPC") #'ett-choose-view) + (define-key map (kbd "") #'scroll-down-command) + (define-key map (kbd "") #'scroll-up-command) + map)) + (define-derived-mode ett-view-mode ett-mode "ETT [report]" "Major mode for viewing ETT reports." (setq font-lock-defaults '(ett-view-font-lock-keywords t)) @@ -1188,15 +1197,8 @@ Use the command `ett-modeline-mode' to change this v= ariable.") (setq-local view-read-only nil) (setq cursor-type nil)) =20 -(define-key ett-view-mode-map (kbd "q") #'bury-buffer) -(define-key ett-view-mode-map (kbd "SPC") #'ett-choose-view) -(define-key ett-view-mode-map (kbd "") #'scroll-down-command) -(define-key ett-view-mode-map (kbd "") #'scroll-up-command) -(define-key ett-mode-map (kbd "C-c C-c") #'ett-add-track) -(define-key ett-mode-map (kbd "SPC") #'ett-space-dwim) - ;;;###autoload -(add-to-list 'auto-mode-alist (cons (purecopy "\\.ett\\'") 'ett-mode)) +(add-to-list 'auto-mode-alist '("\\.ett\\'" . ett-mode)) =20 (provide 'ett) =20 --=-=-=--