Re: [PATCH] Option to clear the screen on quit

2021-10-17 Thread Kevin J. McCarthy

On Sun, Oct 17, 2021 at 12:25:24AM -0500, Oskari Pirhonen wrote:

Add the option to clear the screen when quitting mutt. This is
controlled by the clear_on_quit config option. Defaults to "no".


I think most terminals nowadays have alternative screen support enabled 
by default, don't they?  Unless this is a common option in other 
applications, I don't feel like this belongs inside Mutt.


--
Kevin J. McCarthy
GPG Fingerprint: 8975 A9B3 3AA3 7910 385C  5308 ADEF 7684 8031 6BDA


signature.asc
Description: PGP signature


Re: [PATCH] Option to clear the screen on quit

2021-10-17 Thread Oskari Pirhonen
On Sun, Oct 17, 2021 at 09:35:26AM -0700, Kevin J. McCarthy wrote:
> I think most terminals nowadays have alternative screen support enabled 
> by default, don't they?

I'm not sure what you mean by that? All I know is that when I run mutt
in a TTY (my main interface) it doesn't clear the screen, but instead
just scrolls it up enough to fit the bash prompt at the bottom. Being
able to clear the screen automatically is a potential privacy
enhancement since that way a user's inbox isn't visible unless they're
actively viewing it.

I see that there's a 3p patches page on the Wiki. Is that still actively
maintained? If so, is that a more appropriate place to add the patch if
you don't think it belongs in mutt proper?

- Oskari


Re: [PATCH] Option to clear the screen on quit

2021-10-17 Thread Claus Assmann
Why don't you use a wrapper which invokes
clear
after mutt finished? No extra code needed in mutt.


Re: [PATCH] Option to clear the screen on quit

2021-10-17 Thread Oskari Pirhonen
On Sun, Oct 17, 2021 at 08:31:41PM +0100, Claus Assmann wrote:
> Why don't you use a wrapper which invokes
> clear
> after mutt finished? No extra code needed in mutt.

Wow, I can't believe I didn't think of that *facepalms*.

Thanks for the tip. It was much faster to write than adding the config
option. Here's the script I used in case anyone else sees this and wants
to do the same:

```
#! /bin/bash

eval $(which mutt) "$@" && clear
```

- Oskari


Re: [PATCH] Option to clear the screen on quit

2021-10-17 Thread Matthias Andree
Am 17.10.21 um 22:04 schrieb Oskari Pirhonen:
> On Sun, Oct 17, 2021 at 08:31:41PM +0100, Claus Assmann wrote:
>> Why don't you use a wrapper which invokes
>> clear
>> after mutt finished? No extra code needed in mutt.
> Wow, I can't believe I didn't think of that *facepalms*.
>
> Thanks for the tip. It was much faster to write than adding the config
> option. Here's the script I used in case anyone else sees this and wants
> to do the same:
>
> ```
> #! /bin/bash
>
> eval $(which mutt) "$@" && clear
> ```

Oskari,

Speaking of simplifications:

1. Is the "clear only if mutt exits with status 0" intentional? If not,
";" would be preferable to "&&".

2. Why do you 'eval $(which mutt)' rather than just running plain 'mutt'?
which(1) isn't portable, it's not a POSIX utility nor a POSIX sh built-in,
and its output may consequently be unsuitable for shell evaluation.



Re: [PATCH] Option to clear the screen on quit

2021-10-17 Thread Oskari Pirhonen
On Mon, Oct 18, 2021 at 12:33:33AM +0200, Matthias Andree wrote:
> 1. Is the "clear only if mutt exits with status 0" intentional? If not,
> ";" would be preferable to "&&".

It is intentional, yes. I don't want it to clear the screen if there's
an error so that any messages that may be printed aren't lost.

> 2. Why do you 'eval $(which mutt)' rather than just running plain 'mutt'?
> which(1) isn't portable, it's not a POSIX utility nor a POSIX sh built-in,
> and its output may consequently be unsuitable for shell evaluation.

I had mistakenly assumed which(1) was in coreutils, which would be fine
for reasonably portable scripts. Thanks for pointing that out, I'm sure
to remember it now. Come to think of it, not entirely sure why I used
eval there; it works fine when I remove it too.

Thanks for the tips. Updated script, just for the record:

```
#! /bin/bash

mutt "$@" && clear
```

- Oskari