unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [NonGNU Elpa] New package: ETT
@ 2023-03-01 17:46 John Task
  2023-03-02  4:33 ` Richard Stallman
                   ` (2 more replies)
  0 siblings, 3 replies; 20+ messages in thread
From: John Task @ 2023-03-01 17:46 UTC (permalink / raw)
  To: emacs-devel

Emacs Time Tracker (or short ETT) is a simple yet powerful time tracker
for Emacs. It's based on a minimalist plain text format.

Here is the patch:

From 744f06be4a141e766a223e7c8532dd0e65a43e73 Mon Sep 17 00:00:00 2001
From: John Task <q01@disroot.org>
Date: Tue, 28 Feb 2023 17:18:16 -0300
Subject: [PATCH] New package

---
 elpa-packages | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/elpa-packages b/elpa-packages
index a7f13ed520..a06c667bb4 100644
--- a/elpa-packages
+++ b/elpa-packages
@@ -154,6 +154,10 @@
   :readme "README.md"
   :ignored-files ("doc/demo.gif"))
 
+ (ett                   :url "https://gitlab.com/q01_code/ett.git"
+  :readme "README.org"
+  :ignored-files ("COPYING" "ETT.png"))
+
  (evil			:url "https://github.com/emacs-evil/evil"
   :ignored-files ("COPYING" "lib" "scripts")
   :doc "doc/build/texinfo/evil.texi")
-- 
2.30.2

--
Best regards.



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [NonGNU Elpa] New package: ETT
@ 2023-03-01 18:17 John Task
  0 siblings, 0 replies; 20+ messages in thread
From: John Task @ 2023-03-01 18:17 UTC (permalink / raw)
  To: emacs-devel

Emacs Time Tracker (or short ETT) is a simple yet powerful time tracker
for Emacs. It's based on a minimalist plain text format.

Here is the patch:

From 744f06be4a141e766a223e7c8532dd0e65a43e73 Mon Sep 17 00:00:00 2001
From: John Task <q01@disroot.org>
Date: Tue, 28 Feb 2023 17:18:16 -0300
Subject: [PATCH] New package

---
 elpa-packages | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/elpa-packages b/elpa-packages
index a7f13ed520..a06c667bb4 100644
--- a/elpa-packages
+++ b/elpa-packages
@@ -154,6 +154,10 @@
   :readme "README.md"
   :ignored-files ("doc/demo.gif"))
 
+ (ett                   :url "https://gitlab.com/q01_code/ett.git"
+  :readme "README.org"
+  :ignored-files ("COPYING" "ETT.png"))
+
  (evil			:url "https://github.com/emacs-evil/evil"
   :ignored-files ("COPYING" "lib" "scripts")
   :doc "doc/build/texinfo/evil.texi")
-- 
2.30.2

--
Best regards.



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [NonGNU Elpa] New package: ETT
  2023-03-01 17:46 John Task
@ 2023-03-02  4:33 ` Richard Stallman
  2023-03-02 10:08   ` Holger Schurig
  2023-03-02 14:50 ` q01
  2023-03-02 15:55 ` John Task
  2 siblings, 1 reply; 20+ messages in thread
From: Richard Stallman @ 2023-03-02  4:33 UTC (permalink / raw)
  To: John Task; +Cc: emacs-devel

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

Adding a package to NonGNU ELPA is not just a matter of mechanics,
changing a file.  To do this, we need need to talk with its
maintainer and determine what relaionship we will have with per.

Did you do that?  If so, what did the maintainer tell you?

-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)





^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [NonGNU Elpa] New package: ETT
  2023-03-02  4:33 ` Richard Stallman
@ 2023-03-02 10:08   ` Holger Schurig
  0 siblings, 0 replies; 20+ messages in thread
From: Holger Schurig @ 2023-03-02 10:08 UTC (permalink / raw)
  To: rms, John Task; +Cc: emacs-devel

On Mar, 2023-03-01 23:16, Richard Stallman wrote ...
> Did you do that?  If so, what did the maintainer tell you?

He is the original author / maintainer. The listed gitlab repository
contains 10 commits, all from John Task.

https://gitlab.com/q01_code/ett/-/commits/master



^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [NonGNU Elpa] New package: ETT
  2023-03-01 17:46 John Task
  2023-03-02  4:33 ` Richard Stallman
@ 2023-03-02 14:50 ` q01
  2023-03-02 15:55 ` John Task
  2 siblings, 0 replies; 20+ messages in thread
From: q01 @ 2023-03-02 14:50 UTC (permalink / raw)
  To: rms; +Cc: emacs-devel

On Mar, 2023-03-01 23:16, Richard Stallman wrote
> 
> [[[ To any NSA and FBI agents reading my email: please consider ]]]
> [[[ whether defending the US Constitution against all enemies, ]]]
> [[[ foreign or domestic, requires you to follow Snowden's example. ]]]
> 
> Adding a package to NonGNU ELPA is not just a matter of mechanics,
> changing a file. To do this, we need need to talk with its
> maintainer and determine what relaionship we will have with per.
> 
> Did you do that? If so, what did the maintainer tell you?
> 
> -- 
> Dr Richard Stallman (https://stallman.org)
> Chief GNUisance of the GNU Project (https://gnu.org)
> Founder, Free Software Foundation (https://fsf.org)
> Internet Hall-of-Famer (https://internethalloffame.org)
>

Oh, I didn't expect a response from Richard Stallman himself... I really admire your work!

Now, back to the topic... As Holger pointed out, I'm the author of this package. I thought it would be a good addition to NonGNU Elpa as I haven't seen any similar software there. It has no external dependencies (it can use all-the-icons, but it's not a dependency) and is correctly licenced under GPLv3, so I think there aren't issues, but let me know if I have to do anything else to proceed with its inclusion.

Best regards.



^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [NonGNU Elpa] New package: ETT
  2023-03-01 17:46 John Task
  2023-03-02  4:33 ` Richard Stallman
  2023-03-02 14:50 ` q01
@ 2023-03-02 15:55 ` John Task
  2 siblings, 0 replies; 20+ messages in thread
From: John Task @ 2023-03-02 15:55 UTC (permalink / raw)
  To: q01; +Cc: emacs-devel

By the way, q01 and John Task are the same (me). Sorry I never used a mail list before, I'm still learning. (My first message got duplicated, for instance).

Best regards.



^ permalink raw reply	[flat|nested] 20+ messages in thread

* [NonGNU Elpa] New package: ETT
@ 2023-05-02 21:21 John Task
  2023-05-03  6:08 ` Philip Kaludercic
  2023-05-03 11:12 ` Eli Zaretskii
  0 siblings, 2 replies; 20+ messages in thread
From: John Task @ 2023-05-02 21:21 UTC (permalink / raw)
  To: emacs-devel

[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 <q01@disroot.org>
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")
-- 
2.30.2

---

Feel free to ask anything else if needed.

Best regards.



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [NonGNU Elpa] New package: ETT
  2023-05-02 21:21 John Task
@ 2023-05-03  6:08 ` Philip Kaludercic
  2023-05-03  6:11   ` Philip Kaludercic
  2023-05-03  7:12   ` Yuri Khan
  2023-05-03 11:12 ` Eli Zaretskii
  1 sibling, 2 replies; 20+ messages in thread
From: Philip Kaludercic @ 2023-05-03  6:08 UTC (permalink / raw)
  To: John Task; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 2418 bytes --]

John Task <q01@disroot.org> 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 <q01@disroot.org>
> 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:


[-- Attachment #2: Type: text/plain, Size: 7282 bytes --]

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 '====>' would be acceptable."
 Unlike `ett-separator', you can safely change this to anything you want."
   :type '(string))
 
-(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))
 
@@ -125,10 +125,10 @@ size to be displayed.
 Only even numbers are allowed.  Indeed, it's a weird bug."
   :type '(natnum))
 
-(defcustom ett-graph-icon "│"
+(defcustom ett-graph-icon ?│
   "Icon used for building ETT graphs.
 It must be a single char string."
-  :type '(string))
+  :type 'character)
 
 (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.")
 
 (defvar ett-items-internal nil)
@@ -269,41 +269,36 @@ Here are some translations (*starred* values are current 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" date)
-                     (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))))))
 
 (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 and DATE2."
         (ett-finalize-scope "00:00")))))
 
 (defun ett-do-division (num1 num2)
-  "Divide NUM1 between NUM2."
+  "Divide NUM1 between NUM2."		;can you explain why this is needed?
   (if (/= (% 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 (>= time 60)
+    (while (>= 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)))
 
+(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 start with a ^
   ;; show-paren-mode can be somehow annoying here
   (show-paren-local-mode -1))
 
+(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 "<up>") #'scroll-down-command)
+    (define-key map (kbd "<down>") #'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 variable.")
   (setq-local view-read-only nil)
   (setq cursor-type nil))
 
-(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 "<up>") #'scroll-down-command)
-(define-key ett-view-mode-map (kbd "<down>") #'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))
 
 (provide 'ett)
 

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [NonGNU Elpa] New package: ETT
  2023-05-03  6:08 ` Philip Kaludercic
@ 2023-05-03  6:11   ` Philip Kaludercic
  2023-05-03  7:12   ` Yuri Khan
  1 sibling, 0 replies; 20+ messages in thread
From: Philip Kaludercic @ 2023-05-03  6:11 UTC (permalink / raw)
  To: John Task; +Cc: emacs-devel

Philip Kaludercic <philipk@posteo.net> writes:

> John Task <q01@disroot.org> writes:
> and I have prepared a few comments here:

Oh an by the way, it seems possible to reduce the minimum version of
Emacs to at least 26 using Compat
(https://elpa.gnu.org/packages/compat.html).  Would you be interested in
that?



^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [NonGNU Elpa] New package: ETT
  2023-05-03  6:08 ` Philip Kaludercic
  2023-05-03  6:11   ` Philip Kaludercic
@ 2023-05-03  7:12   ` Yuri Khan
  1 sibling, 0 replies; 20+ messages in thread
From: Yuri Khan @ 2023-05-03  7:12 UTC (permalink / raw)
  To: Philip Kaludercic; +Cc: John Task, emacs-devel

On Wed, 3 May 2023 at 13:09, Philip Kaludercic <philipk@posteo.net> wrote:

> +  (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")))
> […]

It looks here this part of code tries to normalize a partial date to
the DD-MM-YY format. Didn’t Y2K teach us anything, also, shouldn’t
YYYY-MM-DD be used instead?



^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [NonGNU Elpa] New package: ETT
  2023-05-02 21:21 John Task
  2023-05-03  6:08 ` Philip Kaludercic
@ 2023-05-03 11:12 ` Eli Zaretskii
  1 sibling, 0 replies; 20+ messages in thread
From: Eli Zaretskii @ 2023-05-03 11:12 UTC (permalink / raw)
  To: John Task; +Cc: emacs-devel

> From: John Task <q01@disroot.org>
> Date: Tue, 02 May 2023 18:21:14 -0300
> 
> 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.
> ----------------------------------------------------------------------

Since Emacs has Org and todo-mode, which both seem to fit the above
description, it would be good to know what makes this particular
package stand out.

Thanks.



^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [NonGNU Elpa] New package: ETT
@ 2023-05-03 14:07 John Task
  2023-05-03 15:55 ` Eli Zaretskii
  0 siblings, 1 reply; 20+ messages in thread
From: John Task @ 2023-05-03 14:07 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

Thanks for the reply.

> Since Emacs has Org and todo-mode, which both seem to fit the above
> description, it would be good to know what makes this particular
> package stand out.

This is (partially) answered by the manual, specially in the
"Alternatives" section, but I'll try to give a better overview here.

Basically, ETT is largely modeled after "modern" time trackers, which
not only track time but also gather statistics, display graphs,
support setting goals, and (the most important thing) are easy to use.
ETT is indeed designed to be easy to use; knowing three or four
commands allows anyone to use it.  Given the set of features it
offers, this fact alone makes it stand out.

However, this is not even the relevant thing.  ETT is designed to be
extensible and to extend other programs as well.  That's why the user
doesn't have to choose between Org and ETT; they can use both, and it
would be a great choice too, as each one shines in its area.  An
example of such integration is detailed in the "Org integration"
section from the manual.

Best regards.



^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [NonGNU Elpa] New package: ETT
@ 2023-05-03 15:02 John Task
  2023-05-03 16:41 ` Philip Kaludercic
  0 siblings, 1 reply; 20+ messages in thread
From: John Task @ 2023-05-03 15:02 UTC (permalink / raw)
  To: Philip Kaludercic; +Cc: emacs-devel

Thank you very much for the comments.

> I would track the ignored files in a .elpaignore file that would look
> something like this

OK.

> -(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))

OK.
 
> -(defcustom ett-graph-icon "│"
> +(defcustom ett-graph-icon ?│
>    "Icon used for building ETT graphs.
>  It must be a single char string."
> -  :type '(string))
> +  :type 'character)
>  
>  (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.")

I should have thought about that myself, I forgot the string function
:)
 
>  (defvar ett-items-internal nil)
> @@ -269,41 +269,36 @@ Here are some translations (*starred* values are current 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" date)
> -                     (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))))))

This is indeed better, thanks.

>  (defun ett-do-division (num1 num2)
> -  "Divide NUM1 between NUM2."
> +  "Divide NUM1 between NUM2."		;can you explain why this is needed?
>    (if (/= (% num1 num2) 0)
>        (/ (float num1) num2)
>      (/ num1 num2)))

I need the extra precision for various functions.  (/ 12 7) gives me
1, while (ett-do-division 12 7) gives me 1.7142857142857142.

>            (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)

OK.

>  (defun ett-prettify-time (time)
>    "Return a prettified string for TIME."
>    (let ((hr 0))
> -    (while (>= time 60)
> +    (while (>= 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)))

I'll look into that.  Is there any reason why I would need to avoid
that loop?  The code just works for now.

>      (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

I have considered it, but while my regexps are weird, they are
still readable for now.  Maybe I'll reconsider it.

> +(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))

I think you mean just ett-mode-map.  In that case, OK.

> (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 start with a ^
>    ;; show-paren-mode can be somehow annoying here
>    (show-paren-local-mode -1))

Documentation of the variable says it isn't necessary, and it worked
as is on my tests, but I'm not an expert.

> +(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 "<up>") #'scroll-down-command)
> +    (define-key map (kbd "<down>") #'scroll-up-command)
> +    map))

OK.

> -(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 "<up>") #'scroll-down-command)
> -(define-key ett-view-mode-map (kbd "<down>") #'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))

OK.

> Oh an by the way, it seems possible to reduce the minimum version of
> Emacs to at least 26 using Compat
> (https://elpa.gnu.org/packages/compat.html).  Would you be interested in
> that?

Yes, I plan to work on backward compatibility once the code is well
tested.  You know, better to see if it works on a version before
porting it to other ones :)

Thanks again.  Best regards.



^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [NonGNU Elpa] New package: ETT
@ 2023-05-03 15:29 John Task
  2023-05-03 16:57 ` Sam Steingold
  0 siblings, 1 reply; 20+ messages in thread
From: John Task @ 2023-05-03 15:29 UTC (permalink / raw)
  To: Yuri Khan; +Cc: emacs-devel

Yuri Khan <yuri.v.khan@gmail.com> writes:

> It looks here this part of code tries to normalize a partial date to
> the DD-MM-YY format.

Indeed, that's what it does.

> Didn’t Y2K teach us anything, also, shouldn’t
> YYYY-MM-DD be used instead?

I don't plan to live that much :)

As for the format, I think what goes first and what goes last is a
personal preference.  I'd like to offer an option to change that, but
so many parts of the code are tied to this format right now that a
major refactor would be needed.  It sounds fun though, so maybe I'll
do it some day.

Best regards.



^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [NonGNU Elpa] New package: ETT
  2023-05-03 14:07 John Task
@ 2023-05-03 15:55 ` Eli Zaretskii
  0 siblings, 0 replies; 20+ messages in thread
From: Eli Zaretskii @ 2023-05-03 15:55 UTC (permalink / raw)
  To: John Task; +Cc: emacs-devel

> From: John Task <q01@disroot.org>
> Cc: emacs-devel@gnu.org
> Date: Wed, 03 May 2023 11:07:24 -0300
> 
> Thanks for the reply.
> 
> > Since Emacs has Org and todo-mode, which both seem to fit the above
> > description, it would be good to know what makes this particular
> > package stand out.

(Sorry, I said "todo-mode", but I really meant the timeclock package
instead.)

> Basically, ETT is largely modeled after "modern" time trackers, which
> not only track time but also gather statistics, display graphs,
> support setting goals, and (the most important thing) are easy to use.
> ETT is indeed designed to be easy to use; knowing three or four
> commands allows anyone to use it.  Given the set of features it
> offers, this fact alone makes it stand out.

timeclock has just 2 main commands: clock in and clock out.

Anyway, did you consider extending existing packages with those modern
features, instead of making a completely new separate package?



^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [NonGNU Elpa] New package: ETT
  2023-05-03 15:02 John Task
@ 2023-05-03 16:41 ` Philip Kaludercic
  0 siblings, 0 replies; 20+ messages in thread
From: Philip Kaludercic @ 2023-05-03 16:41 UTC (permalink / raw)
  To: John Task; +Cc: emacs-devel

John Task <q01@disroot.org> writes:

>>  (defun ett-do-division (num1 num2)
>> -  "Divide NUM1 between NUM2."
>> +  "Divide NUM1 between NUM2."		;can you explain why this is needed?
>>    (if (/= (% num1 num2) 0)
>>        (/ (float num1) num2)
>>      (/ num1 num2)))
>
> I need the extra precision for various functions.  (/ 12 7) gives me
> 1, while (ett-do-division 12 7) gives me 1.7142857142857142.

If that is so, I would explain that in the documentation string, but
what I wonder is why if condition is needed.  All you basically do is
avoid converting num1 to a float, and the result remains a integer, in
some cases.

>>  (defun ett-prettify-time (time)
>>    "Return a prettified string for TIME."
>>    (let ((hr 0))
>> -    (while (>= time 60)
>> +    (while (>= 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)))
>
> I'll look into that.  Is there any reason why I would need to avoid
> that loop?  The code just works for now.

While this will calculate the values in constant time,

  (list (floor time 60) (% time 60))

a loop will always take more iterations depending on the value of the input:

  (let ((hr 0))
    (while (>= time 60)
      (setq hr (1+ hr)
             time (- time 60)))
    (list hr time))

>>      (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
>
> I have considered it, but while my regexps are weird, they are
> still readable for now.  Maybe I'll reconsider it.

FWIW i even hesitated in bringing this up, because as you say the
regular expressions are currently modest in complexity.

>> +(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))
>
> I think you mean just ett-mode-map.  In that case, OK.

Right, that was a typo.  All I provide is faulty static analysis ^^

>> (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 start with a ^
>>    ;; show-paren-mode can be somehow annoying here
>>    (show-paren-local-mode -1))
>
> Documentation of the variable says it isn't necessary, and it worked
> as is on my tests, but I'm not an expert.

OK, I didn't know about that, then this is fine.



^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [NonGNU Elpa] New package: ETT
  2023-05-03 15:29 John Task
@ 2023-05-03 16:57 ` Sam Steingold
  0 siblings, 0 replies; 20+ messages in thread
From: Sam Steingold @ 2023-05-03 16:57 UTC (permalink / raw)
  To: emacs-devel, John Task

> * John Task <d01@qvfebbg.bet> [2023-05-03 12:29:05 -0300]:
>
>> Didn’t Y2K teach us anything, also, shouldn’t
>> YYYY-MM-DD be used instead?
>
> I think what goes first and what goes last is a personal preference.

Not really. iso8601 specifies YYYY-MM-DD (or YYYYMMDD) for many very
good reasons (e.g., universal recognition and sorting).

-- 
Sam Steingold (https://aphar.dreamwidth.org/) on Pop 22.04 (jammy) X 11.0.12101004
https://lastingimpactpsychology.com https://steingoldpsychology.com
https://camera.org https://www.dhimmitude.org https://thereligionofpeace.com
The software said it requires Windows 3.1 or better, so I installed Linux.



^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [NonGNU Elpa] New package: ETT
@ 2023-05-03 17:14 John Task
  2023-05-03 18:05 ` Eli Zaretskii
  0 siblings, 1 reply; 20+ messages in thread
From: John Task @ 2023-05-03 17:14 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

> Anyway, did you consider extending existing packages with those modern
> features, instead of making a completely new separate package?

Honestly, I didn't consider it.  However, I'm seeing what timeclock.el
currently does, as it is the most similar to my package, and I think I
would gain very little by using it as a starter point.  I'll explain
why.

1. Design principles

timeclock has not the same design principles.  It tries to address the
problem of tracking work time; that's why it has "projects", as well
as functions such as timeclock-when-to-leave-string,
timeclock-workday-remaining-string, et cetera.  ETT tries to track
time in general; it can be used in order to track what do you do on a
workday, but it's also designed to track what do you read on
vacations, when do you eat, and so on.

2. Conflicts

Following point 1, a lot of features from timeclock and ETT conflict
with each other at a basic level because of how they are designed.  On
ETT, there's no "clock-out", because the idea is to track everything,
or everything possible at least.  On timeclock, you have to leave a
message when you clock-out, which doesn't make sense on ETT, not only
because there's no clock-out at all but also because if you just
finished eating, leaving a message is pointless.

3. Features

Again, ETT has a different goal, and tries to approach it in its own
way.  ETT has tags; tags are not needed in timeclock and I don't really
want to change that in order to support something timeclock was not
designed for.  ETT has goals.  ETT has a parser that takes into account
all the oddities of its very own .ett file.  Implementing all of this
for timeclock would be less efficient and would definitely break most
(if not all) existent workflows.

I get your intentions, but all things considered, I think everything
is better as is.

Best regards.



^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [NonGNU Elpa] New package: ETT
  2023-05-03 17:14 John Task
@ 2023-05-03 18:05 ` Eli Zaretskii
  0 siblings, 0 replies; 20+ messages in thread
From: Eli Zaretskii @ 2023-05-03 18:05 UTC (permalink / raw)
  To: John Task; +Cc: emacs-devel

> From: John Task <q01@disroot.org>
> Cc: emacs-devel@gnu.org
> Date: Wed, 03 May 2023 14:14:50 -0300
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > Anyway, did you consider extending existing packages with those modern
> > features, instead of making a completely new separate package?
> 
> [...]
> I get your intentions, but all things considered, I think everything
> is better as is.

From your POV, no doubt.  I'm well familiar with the joy of designing
my own package or feature from the ground up, unburdened by history,
backward compatibility, and all that ballast.  If nothing else, it's a
lot of fun.

But from the project management POV (which is the hat I'm wearing
now), it is a problem if, instead of developing and extending existing
packages, we keep introducing new and different ones.  It makes Emacs
as a whole harder for users to learn and follow for years to come:
they can never be sure the packages they use and are familiar with
will not be abandoned and replaced by others which they will need to
learn from scratch.  It also presents hard maintenance dilemmas for
which there are no good answers: should we have multiple packages with
partially overlapping functionalities, or should we abandon the old
one and embrace the new one(s)?

This is why extending an existing package, although it is harder and
requires more efforts from the developers, is always preferred here to
additions of new and incompatible ones.  E.g., timeclock could have a
"time-tracking" feature or mode added to it, where it would target the
usage patterns you had in mind, rather than the original purpose of
timeclock (which still has its merit, btw, and many smartphone apps
which do just that are a living proof of that).  And, of course,
statistics and graphs can be added to any existing feature, it doesn't
IMO justify a new package written from the ground up.

Of course, I'm too old to naïvely believe that any of the above will
convince anyone to scratch a different itch.



^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [NonGNU Elpa] New package: ETT
@ 2023-05-03 18:06 John Task
  0 siblings, 0 replies; 20+ messages in thread
From: John Task @ 2023-05-03 18:06 UTC (permalink / raw)
  To: Philip Kaludercic; +Cc: emacs-devel

Philip Kaludercic <philipk@posteo.net> writes:

> If that is so, I would explain that in the documentation string, but
> what I wonder is why if condition is needed.  All you basically do is
> avoid converting num1 to a float, and the result remains a integer, in
> some cases.

Oh, I get what you mean now.  Well, back when I coded this I prefered
the result being an integer when the result was exact.  It simplified
some maths for me.  However, nowadays this function is used only four
times in the code, so I probably don't need that fallback anymore.

> While this will calculate the values in constant time,
> 
>   (list (floor time 60) (% time 60))
> 
> a loop will always take more iterations depending on the value of the input:
> 
>   (let ((hr 0))
>     (while (>= time 60)
>       (setq hr (1+ hr)
>              time (- time 60)))
>     (list hr time))

Amazing.  Thanks!

Best regards.



^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2023-05-03 18:06 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-01 18:17 [NonGNU Elpa] New package: ETT John Task
  -- strict thread matches above, loose matches on Subject: below --
2023-05-03 18:06 John Task
2023-05-03 17:14 John Task
2023-05-03 18:05 ` Eli Zaretskii
2023-05-03 15:29 John Task
2023-05-03 16:57 ` Sam Steingold
2023-05-03 15:02 John Task
2023-05-03 16:41 ` Philip Kaludercic
2023-05-03 14:07 John Task
2023-05-03 15:55 ` Eli Zaretskii
2023-05-02 21:21 John Task
2023-05-03  6:08 ` Philip Kaludercic
2023-05-03  6:11   ` Philip Kaludercic
2023-05-03  7:12   ` Yuri Khan
2023-05-03 11:12 ` Eli Zaretskii
2023-03-01 17:46 John Task
2023-03-02  4:33 ` Richard Stallman
2023-03-02 10:08   ` Holger Schurig
2023-03-02 14:50 ` q01
2023-03-02 15:55 ` John Task

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).