#132 The rst-adjust function in rst.el misinterprets comments

closed-fixed
emacs mode (12)
2
2010-12-22
2010-03-18
No

The rst-adjust function in rst.el misinterprets comments as section
headings. The attached patch file, diffed against the
/trunk/docutils/tools/editors/emacs/rst directory of the repository,
provides a test case illustrating the issue and a solution.

Basically, the current emacs script interprets comments following text or
directives as a section mark-up when this is actually a comment. Any line
consisting of 2 dots followed by 0 or more white-space should be considered
a comment and not a form of mark-up. The quintessential example is the use
of a parameterized contents directive with the rst-toc-update command to
populate the TOC in the document as a comment, which is the example given
in the test case:

==============
Document Title
==============

Subtitle

.. contents::
:depth: 2
..
1 Section 1
2 Section 2

Section 1@
---------

Section 2
---------

One would expect a rst-adjust command executed at the specified cursor
position to promote Section 1 to the same level as Subtitle. Instead, in
the current code, it promotes it to ..... underscore, which is not in this
document. Again, the given patch corrects this by excluding lines of the
form \\.\\.[ \t]*$ from the search for section headings in
rst-line-homogeneous-p.

I am assuming this will not affect existing documents because I believe the
case of comment following text or directive to be rare but that this patch
should bring the emacs mode more in line with what how the docutils
actually interprets the given text.

Discussion

  • Günter Milde

    Günter Milde - 2010-03-31
    • priority: 5 --> 2
     
  • Jeffrey C. Jacobs

    Since some of the rst.el issues have recently been fixed, would anyone be ready to review this issue, the proposed solution and its test cases?

     
  • Stefan Merten

    Stefan Merten - 2010-08-18

    I'll care about most about issues in rst.el. However, I'll start with fontification stuff (since this is my code).

    The topic you are raising might be fixed like you proposed. However, the deeper issue is that the whole code should be refactored to integrate stuff from font-locking with the stuff from Martin Blais. Well, a quick fix is more probable ;-) .

     
  • Stefan Merten

    Stefan Merten - 2010-08-18
    • assigned_to: nobody --> smerten
    • status: open --> open-accepted
     
  • Stefan Merten

    Stefan Merten - 2010-12-22

    Fixed in r6506.

     
  • Stefan Merten

    Stefan Merten - 2010-12-22
    • status: open-accepted --> closed-fixed
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks