Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Update troubleshooting.md for editors without wait mode #3819

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

SjoerdV
Copy link

@SjoerdV SjoerdV commented Jun 17, 2024

Fixes #3815.

args = ["--opening-mode=window", "--encoding=UTF-8","--disable-server"]
```
or by setting the `EDITOR` environment variable, e.g. `export EDITOR="mousepad-wait --opening-mode=window --encoding=UTF-8 --disable-server"`.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer shell script or bash script over bash program. Given the use of -n, this is absolutely a bash script. It may be worth mentioning that wait -n will essentially wait for the next child job to complete, if I am understanding this correctly.

There should be blank lines between the code blocks and the paragraphs to which they are attached.

I think that --opening-mode=window… should be in the shell-script (which would probably be better named as chezmoi-mousepad).

Beyond this, something feels missing from this — it’s good text, but it still feels like "mousepad" instructions not "how to make this work with any editor" using "mousepad" as an example.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@halostatue, hope you like the changes

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that this is clearer and more easily generalized from this example. I’ll leave it to @twpayne to make the final decision on this one. The only issue I see remaining is the term "any editor" as the title, but I don't have a better suggestion. The Vim and VS Code examples are good examples for any editor with a "foreground" or "wait" command-line parameter, but this one is one for editors with a "we only work in the background" approach.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok great! Probably the desired length of the tab name restricts more elaborate naming options.

args = ["--opening-mode=window", "--encoding=UTF-8","--disable-server"]
```
or by setting the `EDITOR` environment variable, e.g. `export EDITOR="mousepad-wait --opening-mode=window --encoding=UTF-8 --disable-server"`.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that this is clearer and more easily generalized from this example. I’ll leave it to @twpayne to make the final decision on this one. The only issue I see remaining is the term "any editor" as the title, but I don't have a better suggestion. The Vim and VS Code examples are good examples for any editor with a "foreground" or "wait" command-line parameter, but this one is one for editors with a "we only work in the background" approach.

@halostatue
Copy link
Collaborator

One other thing: you will need to squash your commits and retitle them per the contribution guidelines, as we use conventional commits. This would be something like docs: Update troubleshooting guide for editors without wait modes (that’s probably longer than 50 characters, which is the typical max length for the message).

@SjoerdV SjoerdV changed the title #3815 updated documentation to enable the possibility of having any editor wait in the foreground when running 'chezmoi edit' docs: Update troubleshooting guide for editors without wait mode Jun 18, 2024
@SjoerdV SjoerdV changed the title docs: Update troubleshooting guide for editors without wait mode docs: Update troubleshooting.md for editors without wait mode Jun 18, 2024
@bradenhilton
Copy link
Collaborator

This is a valuable addition, but I personally have a few issues with it at the moment.

  1. You're intermingling the concept (using an intermediate script which invokes an $EDITOR in a manner that provides wait functionality) with the example. I think it would be better to explain the concept first, as generally as possible, and then provide an example.
  2. The section title is "Any editor", but the solution contained within uses a Bash-specific built-in. Obviously, this requires Bash, so it excludes all (non-WSL + Bash) Windows users at a minimum. Perhaps something like "Background-only editors" would be better? Note that I am terrible at naming things.
  3. The example mentions editing chezmoi.toml. I understand why this was done, but I feel it is unnecessarily specific, and could potentially leave a user with the impression that the solution would only work if their config file is in the TOML format, or lead them to create a chezmoi.toml file even if they already have an existing config in a different format. I would instead simply replace this with something like "Set the edit.command configuration variable to the new shell script", and then provide the example in TOML if needed.

Explaining the concept separately from the example would also allow us to add examples in the future (using different commands, using different shells/platforms etc.) if needed. I wouldn't be surprised if there was an equivalent cross-platform Go/Rust tool for this somewhere.

+1 to @halostatue's points regarding commits/message. We use the conventional commit categories to exclude all of the non-user-facing/miscellaneous changes from the changelog when a new release is cut.

@SjoerdV
Copy link
Author

SjoerdV commented Jun 18, 2024

This is a valuable addition, but I personally have a few issues with it at the moment.

1. You're intermingling the concept (using an intermediate script which invokes an `$EDITOR` in a manner that provides wait functionality) with the example. I think it would be better to explain the concept first, as generally as possible, and then provide an example.

2. The section title is "Any editor", but the solution contained within uses a Bash-specific built-in. Obviously, this requires Bash, so it excludes all (non-WSL + Bash) Windows users at a minimum. Perhaps something like "Background-only editors" would be better? Note that I am terrible at naming things.

3. The example mentions editing `chezmoi.toml`. I understand why this was done, but I feel it is unnecessarily specific, and _could potentially_ leave a user with the impression that the solution would only work if their config file is in the TOML format, or lead them to create a `chezmoi.toml` file even if they already have an existing config in a different format. I would instead simply replace this with something like "Set the `edit.command` configuration variable to the new shell script", and then provide the example in TOML if needed.

Explaining the concept separately from the example would also allow us to add examples in the future (using different commands, using different shells/platforms etc.) if needed. I wouldn't be surprised if there was an equivalent cross-platform Go/Rust tool for this somewhere.

+1 to @halostatue's points regarding commits/message. We use the conventional commit categories to exclude all of the non-user-facing/miscellaneous changes from the changelog when a new release is cut.

@bradenhilton All valid points, but... I only saw your update after it was already approved and I made the squash and stuff... So maybe a follow-up docu update (through separate PR) would be more convenient at the moment? So perhaps the addition currently has a grade of 7 out of 10 and everyone is, of course, free to make it a 9 out of 10.

Anyway, my main objective with this PR was to get an 'I build my own workflow'-vibe going with the intended reader, so to never limit oneself to a single tool but combine software and make it work for you. I also always prefer actual working examples to an abstraction any time of the week, so I think the aim for at least this piece of documentation should be to help people along and not try to please everyone (it is behind a 'tab', right 😅).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Documentation update "Why do I get a blank buffer or empty file when running chezmoi edit"
3 participants