auctex
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [AUCTeX] out comment every line


From: Lars Madsen
Subject: Re: [AUCTeX] out comment every line
Date: Tue, 3 Mar 2015 14:57:21 +0000

Here is a sample of what happens

(defun mytest ()
  (interactive)
  (let (
        beg
        end
        (T 0.5)
        )
    (sit-for T)
    (re-search-forward "{" nil t)
    (sit-for T)
    (goto-char (match-beginning 0))
    (sit-for T)
    (setq beg (point))
    (sit-for T)
    (forward-sexp)
    (sit-for T)
    (setq end (point))
    (sit-for T)
    (TeX-comment-region beg end)
    (sit-for T)
    (goto-char end)
    )
)

Use it (in LaTeX-mode, and make sure the cursor is before the {)

{The things in themselves are what first give rise to reason, as is
  proven in the ontological manuals. By virtue of natural

  reason, let us suppose that the transcendental unity of apperception
  abstracts from all content of knowledge; in view of

  these considerations, the Ideal of human reason, on the contrary, is
  the key to understanding pure logic.

  Let us suppose that, irrespective of all empirical conditions, our
  understanding stands in need of our disjunctive

  judgements. As is shown in the writings of Aristotle, pure logic,

  in the case of the discipline of natural reason, abstracts from

  all content of knowledge. Our understanding is a representation of,
  in accordance with the principles of the employment of the

  paralogisms, time. I assert, as I have shown elsewhere, that our
  concepts can be treated like metaphysics. By means of the Ideal,

  it must not be supposed that the objects in space and time are what
  first give rise to the employment of pure reason.

  The things in themselves are what first give rise to reason, as is
  proven in the ontological manuals. By virtue of natural

  reason, let us suppose that the transcendental unity of apperception
  abstracts from all content of knowledge; in view of

  these considerations, the Ideal of human reason, on the contrary, is
  the key to understanding pure logic.

  Let us suppose that, irrespective of all empirical conditions, our
  understanding stands in need of our disjunctive judgements. As is

  shown in the writings of Aristotle, pure logic, in the case of the
  discipline of natural reason, abstracts from all content of
  knowledge. Our understanding is a representation of, in accordance

  with the principles of the employment of the paralogisms, time. I
  assert, as I have shown elsewhere, that our concepts can be treated

  like metaphysics. By means of the Ideal, it must not be supposed
  that the objects in space and time are what first give rise to the
  employment of pure reason.

  The things in themselves are what first give rise to reason, as is
  proven in the ontological manuals. By virtue of natural

  reason, let us suppose that the transcendental unity of apperception
  abstracts from all content of knowledge; in view of

  these considerations, the Ideal of human reason, on the contrary, is
  the key to understanding pure logic.

  Let us suppose that, irrespective of all empirical conditions, our
  understanding stands in need of our disjunctive

  judgements. As is shown in the writings of Aristotle, pure logic, in
  the case of the discipline of natural reason, abstracts from all

  content of knowledge. Our understanding is a representation of, in
  accordance with the principles of the employment of the paralogisms,

  time. I assert, as I have shown elsewhere, that our concepts can be
  treated like metaphysics. By means of the Ideal, it must not be
  these considerations, the Ideal of human reason, on the contrary, is
  the key to understanding pure logic.

  Let us suppose that, irrespective of all empirical conditions, our
  understanding stands in need of our disjunctive

  judgements. As is shown in the writings of Aristotle, pure logic, in
  the case of the discipline of natural reason, abstracts from all

  content of knowledge. Our understanding is a representation of, in
  accordance with the principles of the employment of the paralogisms,

  time. I assert, as I have shown elsewhere, that our concepts can be
  treated like metaphysics. By means of the Ideal, it must not be
  these considerations, the Ideal of human reason, on the contrary, is
  the key to understanding pure logic.

  Let us suppose that, irrespective of all empirical conditions, our
  understanding stands in need of our disjunctive

  judgements. As is shown in the writings of Aristotle, pure logic, in
  the case of the discipline of natural reason, abstracts from all

  content of knowledge. Our understanding is a representation of, in
  accordance with the principles of the employment of the paralogisms,

  time. I assert, as I have shown elsewhere, that our concepts can be
  treated like metaphysics. By means of the Ideal, it must not be

  supposed that the objects in space and time are what first give rise
  to the employment of pure reason.}






/Lars Madsen
Institut for Matematik / Department of Mathematics
Aarhus Universitet / Aarhus University
Mere info: http://au.dk/address@hidden / More information: 
http://au.dk/en/address@hidden


________________________________________
From: address@hidden address@hidden on behalf of Lars Madsen address@hidden
Sent: 03 March 2015 15:43


To: Nicolas Richard
Cc: address@hidden
Subject: Re: [AUCTeX] out comment every line

If I just to

(TeX-comment-region beg end)
(goto-char end)

I'm no longer at the end of the region. '% ' was added, so the region is now 
longer.

I'm surely also missing something a lot easier here.






/Lars Madsen
Institut for Matematik / Department of Mathematics
Aarhus Universitet / Aarhus University
Mere info: http://au.dk/address@hidden / More information: 
http://au.dk/en/address@hidden


________________________________________
From: Nicolas Richard address@hidden
Sent: 03 March 2015 13:46
To: Lars Madsen
Cc: address@hidden
Subject: Re: out comment every line

Lars Madsen <address@hidden> writes:
> If you run TeX-comment-region it will out comment the lines that are
> not blank. How can I tell it to comment everyline even if it is blank?

Since Tassilo answered this part already, let's look at the story :

> I'm using this in a macro that cleans up some 'strange' syntax into a
> more normal env based stuff. But I'd like to keep the original. So the
> macro detects the material, copies it, outcomments the region

At this point you know where the region ends, don't you ?

>  and has
> to insert the converted stuff after the commented area.
>
> but after TeX-comment-region, the cursor may still be inside the
> commented area, so I need to get out.

So you could use it here.

I know I missed something because this was too obvious, but what did I
miss ?

--
Nicolas Richard

_______________________________________________
auctex mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/auctex



reply via email to

[Prev in Thread] Current Thread [Next in Thread]