[Remind-Fans] New Remind helper script: remint - a Text UI for Remind

Justin Alcorn justin at jalcorn.net
Fri Sep 16 10:38:15 EDT 2022


Mathieu -

Do you want pull requests sent to your git for issues we see?  That way
people can help with the coding and you can review changes and decide
whether to accept them in the main branch.
-- 
Justin B. Alcorn
The views expressed are not necessarily my own, much less anyone else's
PGP Fingerprint CCEB F776 C3FD 1050 C8DB  532E B8B9 BED7 7764 406C


On Fri, Sep 16, 2022 at 9:46 AM Mathieu via Remind-fans <
remind-fans at lists.skoll.ca> wrote:

> Hi Gary,
>
> Thanks a lot for your very helpful comments, and also for detailing this
> well your solutions to the issues you've raised. It's greatly appreciated.
>
> I have updated the script using your input, see details below and in the
> diff. I only tested it quickly and I have to go in a meeting, hopefully I
> didn't introduce new bugs.
>
> That is very nice. No more piping rem to less and not asking for
> enough weeks or months. Thank you.
>
> I had a problem when I first tried to add a reminder, though: vim
> opened the current directory instead of the argument to remint.sh.
> I took a look at the script and found a few issues.
> This should now be fixed in master. remint will take any file or folder
> given as argument, and in the latter case it will read any *.rem file it
> contains and create a 100-remint.rem into that folder which will be used
> as default file for adding new events. If no argument is supplied, then it
> will look into ~/.config/remind/reminders and ~/.reminders, which both
> can be files or directories (using the same logic as above).
>
>
>    - EDITOR is an environment variable set by users to tell programs
>    what their preferred editor is. It should not be altered as it is
>    at line 36.
>    I agree, I needed some way to detect whether it is set at all, but I
>    have modified the corresponding line so that the scripts sets it if and
>    only if not already set in environment.
>
>
>    - On the help screen, the word "week" is missing its k. (Line 75)
>    Fixed.
>
>
>    - When executing $EDITOR, vim and vi, the script has the editor jump
>    to line 2 of $FILE. That interferes with automatically jumping to
>    the last cursor position, which I prefer for my reminders.
>    Good point; everyone's habits with their text editors are so diverse
>    it's not easy to set any opinionated default behavior. I've chosen to keep
>    that line jump only for a (add) since this option is meant to autofill
>    the currently selected date in the reminders file. e (edit) now just
>    opens the file without any preset cursor coordinates.
>
>
>    - When testing for the existence of a program, the script uses
>    tests like this one for 'kak':
>
> if type "$(which kak)" > /dev/null; then
>
> Using 'which' here is redundant--'type' alone will do what you
> want. Also, 'type' sends error messages to stderr, so that should
> be directed to /dev/null as well. The test then becomes this:
>
> if type kak &> /dev/null; then
> You're absolutely right, thanks!
>
>
>    - Some comments state that you'd like to insert $REF
>    programmatically. For vim, you can do this (at line 257):
>
> vim -c "put ='$REF '" -c "startinsert!" "$FILE"
> Thanks, I added it. Now hopefully I or someone else will find how to do
> something similar in emacs and most cases will be covered (I have set vi
> and nano as additional fallback editors, but I assume most users will be
> covered with emacs and vim).
>
>
>    - Remind can use the environment variable DOTREMINDERS to find the
>    reminders file if it not in the default place. It would be nice
>    if remint.sh used that as well. I changed the code at line 435
>    to this:
>
> if [[ -n "$DOTREMINDERS" ]] && [[ -e "$DOTREMINDERS" ]]; then
> INPUT="$DOTREMINDERS"
> elif [[ -e "$HOME/.config/remind/reminders" ]]; then
> I didn't know about that, implemented your change.
>
>
>    - I'm not sure what the difference is between INPUT and FILE, but
>    FILE was not defined the first time I tried using the 'a' (add)
>    command, so I added
>
> FILE=${1}"
>
> below line 466 (now line 468 in my modified copy).
> $FILE is the target file for e and a, *i.e.*, the file to edit and add
> new events to. $INPUT is what remint/remind read from, *i.e.*, the same
> as $FILE if using only a single file, or a directory. There was a hole in
> this logic (now fixed, hopefully) which was causing the issue you had
> initially with vim opening the folder instead of a file.
>
>
>    - Every time the ui function finishes some command other than 'q',
>    it calls itself again. This puts another piece of information on
>    bash's call stack. For such a small script that is used briefly,
>    then quit, this is probably not a problem, but it could be if
>    someone just left it running. I didn't change anything related to
>    this.
>    I am not sure I understand what would be the issue if the script is
>    left running, since the function executes itself but is paused every so
>    often by all those read lines to wait for user input. Maybe I missed
>    something though.
>
> I hope that's helpful. I look forward to using remint.sh often.
> Very. Many thanks!
>
> Cheers,
>
> M
> _______________________________________________
> Remind-fans mailing list
> Remind-fans at lists.skoll.ca
> https://dianne.skoll.ca/mailman/listinfo/remind-fans
> Remind is at https://dianne.skoll.ca/projects/remind/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://dianne.skoll.ca/pipermail/remind-fans/attachments/20220916/d1c8208c/attachment.htm>


More information about the Remind-fans mailing list