[Dune] Improving compilation mode for template-heavy C++

Jö Fahlke jorrit at jorrit.de
Mon Nov 24 15:04:15 CET 2014


Hi!

This is for those of you who compile Dune code from Emacs.

Maybe you have noticed that in a graphical Emacs window you can double-click
on a parenthesis, brace, or square bracket, and Emacs will find the balanced
bracketed region delimited by this bracket and mark it for you.  In error
messages in compilation mode this can be used to manually ignore nested
bracketed regions.  Unfortunately most balanced bracketed regions in error
messages from dune code are delimited by angle brackets, which are not covered
by the default settings.  They can however be added by adjusting the syntax
table of compilation-mode buffers:

* Customize the variable compilation-mode-hook:

    M-x customize-variable<RET> compilation-mode-hook<RET>

  or

    <menu><Options><Customize Emacs><Specific Option...> compilation-mode-hook<RET>

* Add a new hook with the contents

  (lambda ()
   (set-syntax-table (make-syntax-table (syntax-table)))
   (modify-syntax-entry (elt "<" 0) "(>")
   (modify-syntax-entry (elt ">" 0) ")<"))

Note that the angle brackets are also used as operators, (i.e. "->") and if
they appear as operators in error messages emacs will no longer be able to
correctly identify balanced regions.  This does not happen for the majority of
error messages however, so overall I think this is a huge improvement.

In text mode double-clicking does not work the same way as in graphical mode,
but there are the key combinations

  C-M-f (bound to forward-sexp)
  C-M-b (bound to backward-sexp)

wich can be used to skip balanced bracketed groups.

Hope anyone finds this useful,
Jö.

-- 
Jorrit (Jö) Fahlke, Institute for Computational und Applied Mathematics,
University of Münster, Orleans-Ring 10, D-48149 Münster
Tel: +49 251 83 35146 Fax: +49 251 83 32729

[Zum Thema GNOME 3]
(15:11:22) marina: linus ist auf meiner seite
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 828 bytes
Desc: Digital signature
URL: <https://lists.dune-project.org/pipermail/dune/attachments/20141124/dc6c7200/attachment.sig>


More information about the Dune mailing list