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

alectryon.el: editing in reST mode should handle tabs #89

Open
dunnl opened this issue Sep 27, 2022 · 5 comments
Open

alectryon.el: editing in reST mode should handle tabs #89

dunnl opened this issue Sep 27, 2022 · 5 comments

Comments

@dunnl
Copy link

dunnl commented Sep 27, 2022

In alectryon.el, going from reST mode to Coq mode (or saving a file while opened in reST mode) does not handle tab characters that appear in coq blocks. Instead Alectryon seems to begin a new prose block.

Sample input (in reST mode). Note that auto here is indented with a hard tab character.

.. coq::

   Goal True.
   Proof.
	auto.
   Qed.

Sample output from saving or switching to Coq mode:

Goal True.
Proof.

(*|
	auto.
   Qed.
|*)

Output obtained if the tab is replaced with spaces:

Goal True.
Proof.
     auto.
Qed.
@cpitclaudel
Copy link
Owner

Ah, indeed — I haven't thought about tabs at all.

The reST spec says:

Spaces are recommended for indentation, but tabs may also be used. Tabs will be converted to spaces. Tab stops are at every 8th column (processing systems may make this value configurable).

How bad would it be to convert all tabs to spaces as part of the conversion process? Not exactly in line with the whole "reversible conversion" aspect, but very simple to implement ^^

@cpitclaudel
Copy link
Owner

I imagine the alternative would be to adjust the way the code measures indentation, but it will require in-depth testing to make sure that all cases are properly handled.

@cpitclaudel
Copy link
Owner

Ah, but this isn't sufficient, because dedenting a line may require replacing a tab with spaces before removing leading spaces.
I will look into improving things, but given that tabs aren't used very commonly with reST, I'm curious to hear your thoughts on

How bad would it be to convert all tabs to spaces as part of the conversion process?

@dunnl
Copy link
Author

dunnl commented Sep 29, 2022

I think that is reasonable. I encountered this issue when some editing I was doing silently inserted tab characters I didn't want.

@cpitclaudel
Copy link
Owner

Excellent. I will try to implement this.

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

No branches or pull requests

2 participants