5

Is it possible to make AUCTeX recognize the asy and asydef environments to use the correct symbol for commenting out? In latex-mode the command comment-region does add % at the beginning of the line. However inside of a asymptote environment this should automatically change to //.

1 Answer 1

3

The trick is to use advising. Add the following to your .emacs

(defadvice comment-region (around comment-region-asymptote activate)
  "Use \"//\" as comment prefix in Asymptote environments."
  (let ((comment-start
     (if (and (equal major-mode 'latex-mode)
          (or (equal (LaTeX-current-environment) "asy")
              (equal (LaTeX-current-environment) "asydef")))
         "//"
       comment-start)))
    ad-do-it))
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .