Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#127 rst.el: rst-compile "multifile" support

open-postponed
Stefan Merten
emacs mode (11)
2
2010-12-24
2009-12-30
Jakub Wilk
No

I am forwarding feature request reported in the Debian BTS:
http://bugs.debian.org/438664

The rst-compile function assumes the current buffer is the "master"
source file for a reST document. When using the ..include::
directive, this is not necessarily the case.

In AuCTeX, a similar problem is solved by supporting a file-local
variable TeX-Master, which contains a string referring to the master
file. I suggest the rst-compile function be similar extended to use
the reST-master file-local variable (if set), falling back on the
current behaviour (if not set).

An advantageous side effect is that files with a generic .txt
extension (or no extension) could be made to automatically use
rst-mode instead of the generic text-mode with the following elisp
(adapted from scheme48):

(put 'reST-master 'safe-local-variable t)
(add-hook 'hack-local-variables-hook
(λ ()
(when (and (boundp 'reST-master) reST-master)
(rst-mode)
(hack-local-variables-prop-line))))

References:

http://www.gnu.org/software/auctex/manual/auctex/Multifile.html
http://emacswiki.org/wiki/download/scheme48.el

Discussion

  • Günter Milde
    Günter Milde
    2010-01-05

    There is currently noone working on emacs support. Help or a complete, tested patch welcome.

     
  • Günter Milde
    Günter Milde
    2010-01-05

    • priority: 5 --> 3
     
  • Günter Milde
    Günter Milde
    2010-01-05

    • priority: 3 --> 2
     
  • Günter Milde
    Günter Milde
    2010-01-05

    • status: open --> open-postponed
     
  • First off, I don't think your last comment about giving Emacs a hint about rst-mode is really necessary, as the following already works for both emacs AND vim when placed at the end of a file:

    -----------------

    ..
    Local Variables:
    mode: rst
    coding: utf-8
    End:

    .. vim: set syntax=rest encoding=utf-8 lbr:

    -----------------

    Setting rst-mode at the top of a file in the emacs one-line header also works.

    As for your main point, I don't quite follow. Perhaps its the programmer in me but if I have a .rst file I use as a template for inclusion, I generally intend it to act more as a library rather than as a helper for a specific file. So I don't see why you'd want an include file to back-reference the file that would include it. What am I missing, as I'm sure this isn't what you mean here.

    Other than that, I might look into your issue at an idle moment though I'd really like to finish getting the rst-toc-update function to recognize the :depth: (and :local:) parameter so that the comment block doesn't get too long first.

     
  • Stefan Merten
    Stefan Merten
    2010-12-24

    • assigned_to: nobody --> smerten