~protesilaos/tmr

11 2

Adding a tabulated-list view

Details
Message ID
<875ymiq57z.fsf@cassou.me>
DKIM signature
missing
Download raw message
The tmr-view-echo-area-messages is a bit hard to read in my opinion. I
think a tabulated-list view (the one used for list-packages and proced
for example) would be much clearer.

I thought I would create a separate file tmr-tabulated-view.el file
containing the code. The columns could be:

1. The description
2. A checkmark to indicate if the timer is finished or still running
3. The start date
4. The duration

What do you think?

-- 
Damien Cassou

"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill
Details
Message ID
<87fslmzx7s.fsf@protesilaos.com>
In-Reply-To
<875ymiq57z.fsf@cassou.me> (view parent)
DKIM signature
pass
Download raw message
> From: Damien Cassou <damien@cassou.me>
> Date: Fri, 06 May 2022 13:18:40 +0200
>
> The tmr-view-echo-area-messages is a bit hard to read in my opinion.

I agree.  My plan was to add faces to it, but I first wanted to hear
another person's opinion on it before proceeding.  Your suggestion is
better.

> I think a tabulated-list view (the one used for list-packages and
> proced for example) would be much clearer.

Yes!  My plan was to use that for a future 'tmr-list-timers' command
(like 'list-timers').  Maybe these two goals can be combined.

> I thought I would create a separate file tmr-tabulated-view.el file
> containing the code. The columns could be:
>
> 1. The description
> 2. A checkmark to indicate if the timer is finished or still running
> 3. The start date
> 4. The duration
>
> What do you think?

I like it and thank you for considering it!  Can the columns be
formatted by the user differently?  I would need to try it, but right
now I feel this order would be better for me: start, duration,
checkmark, description.  This is because I don't always use a
description.  Though I don't mind how you proposed it.

-- 
Protesilaos Stavrou
https://protesilaos.com
Details
Message ID
<874k21t6l6.fsf@cassou.me>
In-Reply-To
<87fslmzx7s.fsf@protesilaos.com> (view parent)
DKIM signature
missing
Download raw message
Hi Protesilaos,

I've started a prototype: see attached patch if you want to give early
feedback. Just call `M-x tmr-tabulated-view' if you want to test.

The format of objects stored in tmr--timers wasn't good enough for a
nice table so I created a structure to represent a timer. I have hopes
it will simplify the code base when I'm done refactoring.

Looking forward to hearing what you think about that work.

Best

-- 
Damien Cassou

"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill
Details
Message ID
<8735hkwif2.fsf@protesilaos.com>
In-Reply-To
<874k21t6l6.fsf@cassou.me> (view parent)
DKIM signature
pass
Download raw message
> From: Damien Cassou <damien@cassou.me>
> Date: Sat, 07 May 2022 22:45:25 +0200
>
> Hi Protesilaos,

Good day Damien!

> I've started a prototype: see attached patch if you want to give early
> feedback. Just call `M-x tmr-tabulated-view' if you want to test.

I like it and seems to work well.  Maybe we can add a hook after the
timer elapses to revert the buffer?  That would update the "Finished?"
column.  But I have not thought this through: it might be a bad idea.

This part looks like a good candidate for a defcustom:

    (setq-local tabulated-list-format
                  [("Start" 10 t)
                   ("End" 10 t)
                   ("Finished?" 10 t)
                   ("Description" 0 t)])

But we can discuss this later.

> The format of objects stored in tmr--timers wasn't good enough for a
> nice table so I created a structure to represent a timer. I have hopes
> it will simplify the code base when I'm done refactoring.

I need to learn more about those.  In the meantime, the only regression
I have noticed is in 'tmr-cancel'.  It was designed with the assumption
of the old object.

> Looking forward to hearing what you think about that work.

I am very happy this direction and thank you once again for doing this!
You should add the "Author:" to tmr.el as well.

I am pushing your changes now, with a FIXME comment I added for
tmr-cancel.

-- 
Protesilaos Stavrou
https://protesilaos.com
Details
Message ID
<87ee10h3o4.fsf@cassou.me>
In-Reply-To
<8735hkwif2.fsf@protesilaos.com> (view parent)
DKIM signature
missing
Download raw message
Protesilaos Stavrou <info@protesilaos.com> writes:
> I like it and seems to work well.  Maybe we can add a hook after the
> timer elapses to revert the buffer?  That would update the "Finished?"
> column.  But I have not thought this through: it might be a bad idea.


I will create a new thread about that. There are indeed a few things we
can do.


> This part looks like a good candidate for a defcustom:
>     (setq-local tabulated-list-format [("Start" 10 t)…])


Maybe but I think it is a bit premature. Moreover, this isn't that easy
because not only the column headers must be configured, but the line
cell's as well: i.e., `tmr-tabulated--timer-to-entry` should be changed
accordingly.


> I need to learn more about those.


structs are really powerful when you have structured data: I suggest
reading:

(info "(cl) Structures")


> In the meantime, the only regression I have noticed is in
> 'tmr-cancel'.


I knew about that regression and that's why I said my patch was a WIP
prototype. I wasn't expecting you to merge it, only to give feedback πŸ˜ƒ.

You will find 4 more patches attached.

I'm happy to collaborate on this project. Thank you for doing it in the
first place.

-- 
Damien Cassou

"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill
Details
Message ID
<878rr830f8.fsf@protesilaos.com>
In-Reply-To
<87ee10h3o4.fsf@cassou.me> (view parent)
DKIM signature
pass
Download raw message
> From: Damien Cassou <damien@cassou.me>
> Date: Wed, 11 May 2022 10:30:35 +0200
>
> Protesilaos Stavrou <info@protesilaos.com> writes:
>> I like it and seems to work well.  Maybe we can add a hook after the
>> timer elapses to revert the buffer?  That would update the "Finished?"
>> column.  But I have not thought this through: it might be a bad idea.
>
> I will create a new thread about that. There are indeed a few things we
> can do.

Thank you!

>> This part looks like a good candidate for a defcustom:
>>     (setq-local tabulated-list-format [("Start" 10 t)…])
>
> Maybe but I think it is a bit premature. Moreover, this isn't that easy
> because not only the column headers must be configured, but the line
> cell's as well: i.e., `tmr-tabulated--timer-to-entry` should be changed
> accordingly.

Okay, I follow your lead.

>> I need to learn more about those.
>
> structs are really powerful when you have structured data: I suggest
> reading:
>
> (info "(cl) Structures")

Very well!  I already read about them.  Now I am studying your code to
see them in action.

>> In the meantime, the only regression I have noticed is in
>> 'tmr-cancel'.
>
> I knew about that regression and that's why I said my patch was a WIP
> prototype. I wasn't expecting you to merge it, only to give feedback πŸ˜ƒ.

Oh my... I did not realise I pushed to the main branch!

> You will find 4 more patches attached.

Applied them all.  I made some further tweaks as well:

7be6aa9  Make tabulated hook local
d8071f7  Use let bound variable in tmr--read-timer
81aa6ce  Use forward-line instead of {next,previous}-line
90526a0  Fix placement of comma for Authors

> I'm happy to collaborate on this project. Thank you for doing it in the
> first place.

Maybe you have more experience with this: do we need to include a
"Maintainer" header?  I am fine with whatever you prefer.

* * *

Now I will update the manual.

-- 
Protesilaos Stavrou
https://protesilaos.com
Details
Message ID
<87tu9wf5kx.fsf@cassou.me>
In-Reply-To
<878rr830f8.fsf@protesilaos.com> (view parent)
DKIM signature
missing
Download raw message
Protesilaos Stavrou <info@protesilaos.com> writes:
> Applied them all.  I made some further tweaks as well:
>
> 7be6aa9  Make tabulated hook local
> d8071f7  Use let bound variable in tmr--read-timer
> 81aa6ce  Use forward-line instead of {next,previous}-line
> 90526a0  Fix placement of comma for Authors


Thank you very much. I realize I've been a bit sloppy here with the
global change to tabulated-list-revert-hook and the comma.

Regarding {next,previous}-line commands I think I remember Emacs telling
me about these mistakes. I also think I read about them in the docstring
of these commands. I can't seem to find the information anymore. Weird.

I saw you put my name in many places. I appreciate but that's not
required, even more on first position in the README:
> + Authors :: Damien Cassou, Protesilaos Stavrou.

Please put your name back in front at least πŸ˜ƒ.

> Maybe you have more experience with this: do we need to include a
> "Maintainer" header?  I am fine with whatever you prefer.

I have absolutely no idea, I'm sorry.

-- 
Damien Cassou

"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill
Details
Message ID
<87h75w13c5.fsf@protesilaos.com>
In-Reply-To
<87tu9wf5kx.fsf@cassou.me> (view parent)
DKIM signature
pass
Download raw message
> From: Damien Cassou <damien@cassou.me>
> Date: Wed, 11 May 2022 17:32:14 +0200
>
> Protesilaos Stavrou <info@protesilaos.com> writes:
>> Applied them all.  I made some further tweaks as well:
>>
>> 7be6aa9  Make tabulated hook local
>> d8071f7  Use let bound variable in tmr--read-timer
>> 81aa6ce  Use forward-line instead of {next,previous}-line
>> 90526a0  Fix placement of comma for Authors
>
> Thank you very much. I realize I've been a bit sloppy here with the
> global change to tabulated-list-revert-hook and the comma.

No worries.  It happens to me as well: remember that WIP patch I pushed
to the main branch?  Haha!  The good thing is that we can double-check.

> Regarding {next,previous}-line commands I think I remember Emacs telling
> me about these mistakes. I also think I read about them in the docstring
> of these commands. I can't seem to find the information anymore. Weird.

I use the package-lint extension for flymake/flycheck.  That way I catch
all warnings/errors that the compiler emits.

> I saw you put my name in many places. I appreciate but that's not
> required, even more on first position in the README:

Okay.  I will remove it from those places.  Will keep it limited to the
"Acknowledgements" section.

>> + Authors :: Damien Cassou, Protesilaos Stavrou.
>
> Please put your name back in front at least πŸ˜ƒ.

Oh, this is the product of the A-Z sort.  I will do as you will.

>> Maybe you have more experience with this: do we need to include a
>> "Maintainer" header?  I am fine with whatever you prefer.
>
> I have absolutely no idea, I'm sorry.

That's fine.  I will check the docs.

-- 
Protesilaos Stavrou
https://protesilaos.com
Details
Message ID
<87h75vgabp.fsf@cassou.me>
In-Reply-To
<87h75w13c5.fsf@protesilaos.com> (view parent)
DKIM signature
missing
Download raw message
> I use the package-lint extension for flymake/flycheck.  That way I catch
> all warnings/errors that the compiler emits.


I have the same setup and I even presented this at EmacsConf 3 years
ago: https://emacsconf.org/2019/talks/16/. Still, my linting tools
don't tell me about next-line anymore.

-- 
Damien Cassou

"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill
Details
Message ID
<87pmkj6xwi.fsf@protesilaos.com>
In-Reply-To
<87h75vgabp.fsf@cassou.me> (view parent)
DKIM signature
pass
Download raw message
> From: Damien Cassou <damien@cassou.me>
> Date: Wed, 11 May 2022 21:04:26 +0200
>
>> I use the package-lint extension for flymake/flycheck.  That way I catch
>> all warnings/errors that the compiler emits.
>
> I have the same setup and I even presented this at EmacsConf 3 years
> ago: https://emacsconf.org/2019/talks/16/. Still, my linting tools
> don't tell me about next-line anymore.

Strange...

1. Maybe something lingers in the Custom snippet that gets appended to
   the init file by default?  I personally do not like it, as it is the
   source of misconfigurations:

      (setq custom-file (make-temp-file "emacs-custom-"))

   Making a temporary file works fine.  Don't try to use 'null-device'
   though: it causes problems.

2. Maybe Flymake or Flycheck is not automatically updated?  I have these
   for Flymake:

       (setq flymake-start-on-flymake-mode t
             flymake-start-on-save-buffer t
             flymake-no-changes-timeout nil)

* * *

I watched your presentation in 2019.  Most of it was too technical for
me back then: I had barely written my first package.  Re-watched it now.
I still haven't used ERT and friends, though I want to eventually learn
how to do so.

-- 
Protesilaos Stavrou
https://protesilaos.com
Details
Message ID
<875ym8bjh1.fsf@cassou.me>
In-Reply-To
<87pmkj6xwi.fsf@protesilaos.com> (view parent)
DKIM signature
missing
Download raw message
Protesilaos Stavrou <info@protesilaos.com> writes:
>> my linting tools don't tell me about next-line anymore.
>
> Strange...

It seems to work now for some reason… Anyway, we now have `make check`
πŸ˜ƒ.

-- 
Damien Cassou

"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill
Details
Message ID
<87zgjkh5h6.fsf@protesilaos.com>
In-Reply-To
<875ym8bjh1.fsf@cassou.me> (view parent)
DKIM signature
pass
Download raw message
> From: Damien Cassou <damien@cassou.me>
> Date: Sat, 14 May 2022 10:34:50 +0200
>
> Protesilaos Stavrou <info@protesilaos.com> writes:
>>> my linting tools don't tell me about next-line anymore.
>>
>> Strange...
>
> It seems to work now for some reason… Anyway, we now have `make check`
> πŸ˜ƒ.

'make check' is nice to have!

-- 
Protesilaos Stavrou
https://protesilaos.com
Reply to thread Export thread (mbox)