2

I am working with a simple major mode. The format has one single line comment delimiter, i.e., %. However, I get strange results when running fill-paragraph on a comment. Specifically, the result I see when running fill-paragraph on the first line of the following comment

% 1 2 3 4 5 6 7 8 9 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
% 1 2 3 4 5 6 7 8 9 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27

is

% 1 2 3 4 5 6 7 8 9 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
%  1 2 3 4 5 6 7 8 9 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
%  27

Observe how the next line is indented by one more space. I expect fill-paragraph to not change the comment at all. If I were to run fill-paragraph again on the second line of this resultant comment the third line is preceded, following the %, by yet another space.

I am looking for a way to change the major mode such that this "cascading" behavior no longer occurs when fill-paragraph is called on a comment.

UPDATE 1

I have verified that the issue is related to the particular major mode I am using. Specifically, I started emacs using emacs -Q, loaded the major mode manually, and then enabled the major mode. After doing this, the "cascading" behavior was exhibited again.

The major mode I am using can be found here: https://github.com/abella-prover/abella/blob/master/emacs/abella.el

UPDATE 2

Following @JeanPierre's comment regarding emacs 25. I have confirmed that this behavior does not occur in emacs 25 but DOES occur in emacs 26.

  • Is your major mode derived from prog-mode? – DoMiNeLa10 Oct 30 '18 at 21:44
  • Please provide more info: what major mode, for example? And do you see the same problem if you start Emacs with emacs -Q (no init file)? If not then bisect your init file to find the culprit. – Drew Oct 30 '18 at 23:59
  • I can't reproduce this with the linked file (emacs 25.1.1). It does behave as it should. – JeanPierre Oct 31 '18 at 15:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.