cmhughes / latexindent.pl

Perl script to add indentation (leading horizontal space) to LaTeX files. It can modify line breaks before, during and after code blocks; it can perform text wrapping and paragraph line break removal. It can also perform string-based and regex-based substitutions/replacements. The script is customisable through its YAML interface.
GNU General Public License v3.0
884 stars 84 forks source link

Command-line option allowing no backups #333

Closed tdegeus closed 2 years ago

tdegeus commented 2 years ago

I would like a command-line option switching of the the feature of writing .bakX files.

To give an argument: I'm using git so this feature is not useful, rather just adding noise.

(I know it can be done in user settings, but I would like to be able to do it directly from the command-line)

cmhughes commented 2 years ago

Have you seen the - c switch?

tdegeus commented 2 years ago

I had not. But my wish remains unchanged ;)

cmhughes commented 2 years ago

Removing the backup files option feels too dangerous to me.

On Tue, 25 Jan 2022, 15:25 Tom de Geus, @.***> wrote:

I had not. But my wish remains unchanged ;)

— Reply to this email directly, view it on GitHub https://github.com/cmhughes/latexindent.pl/issues/333#issuecomment-1021303767, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAQ7CYC3V23EYBZOQORF6D3UX26GBANCNFSM5MYOQF4Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>

tdegeus commented 2 years ago

I'm not asking to remove the option, nor to change the default. I'm just asking to have the option not to write them, in the case that I have everything covered (e.g. with git).

cmhughes commented 2 years ago

Yes, I understand :)

But, having the option still seems dangerous to me.

If a user chooses this option without realising what they're doing, and doesn't have version control, and something goes wrong, I might ultimately end up responsible.

Safety first.

On Tue, 25 Jan 2022, 15:32 Tom de Geus, @.***> wrote:

I'm not asking to remove the option, nor to change the default. I'm just asking to have the option not to write them, in the case that I have everything covered (e.g. with git).

— Reply to this email directly, view it on GitHub https://github.com/cmhughes/latexindent.pl/issues/333#issuecomment-1021310622, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAQ7CYDRN6BVI4WPYMHMLLDUX267JANCNFSM5MYOQF4Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>

tdegeus commented 2 years ago

Allright. Thanks for the reply

tdegeus commented 2 years ago

Just a question out of curiosity : what happens if I have a main.tex and I happen to have made a back-up of something else main.bak0, and I set onlyOneBackUp: 1. Would latexindent.pl then overwrite the unrelated back-up?

cmhughes commented 2 years ago

It should aim for main.bak with this setting.

On Wed, 26 Jan 2022, 08:35 Tom de Geus, @.***> wrote:

Just a question out of curiosity : what happens if I have a main.tex and I happen to have made a back-up of something else main.bak0, and I set onlyOneBackUp:

  1. Would latexindent.pl then overwrite the unrelated back-up?

— Reply to this email directly, view it on GitHub https://github.com/cmhughes/latexindent.pl/issues/333#issuecomment-1021976872, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAQ7CYFMRJYQ7P4HD46KF63UX6W4ZANCNFSM5MYOQF4Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>

tdegeus commented 2 years ago

Ok, but actually my point was : how does onlyOneBackUp: 1 know that it its backup that it is overwriting?

So my point is the following: having latexindent.pl write files that I don't operate on, makes me more insecure than it makes me feel secure. That's why I suggested the command-line option.

I guess that with the current API I should do something like

latexindent.pl -c ~/.cache/latexindent

if I don't want to worry?

cmhughes commented 2 years ago

Thanks for these points.

You're right, there is a case in which users may have used main.bak from another command and then they set onlyOneBackUp to be 1, and then latexindent.pl could overwrite main.bak.

However, I would argue that by setting onlyOneBackUp to 1, the user is saying 'I take responsibility for my backup procedure, and I know what I'm doing'.

The default behaviour of latexindent is to create a new backup each and every time. Anything other than this requires the user to take action, at which point they are taking responsibility.

Your proposed use of the c switch sounds consistent with its intended use :)

On Wed, 26 Jan 2022, 09:14 Tom de Geus, @.***> wrote:

Ok, but actually my point was : how does onlyOneBackUp: 1 know that it its backup that it is overwriting?

So my point is the following: having latexindent.pl write files that I don't operate on, makes me more insecure than it makes me feel secure. That's why I suggested the command-line option.

I guess that with the current API I should do something like

latexindent.pl -c ~/.cache/latexindent

if I don't want to worry?

— Reply to this email directly, view it on GitHub https://github.com/cmhughes/latexindent.pl/issues/333#issuecomment-1022006070, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAQ7CYF5T7VL2YQIOXFXWVLUX63PJANCNFSM5MYOQF4Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>