Re: [AUCTeX] Forcing indentation in math environments

2015-02-20 Thread Julien Cubizolles
Julien Cubizolles  writes:


> The thing is I'm not sure why it's working :-) since strange things also
> happen:
>
> * If yas-minor-mode is on, the point is at the beginning of the text
>   after using TAB, which is what I want; it's at the beginning of the
>   line if yas is not on. I could choose something else than TAB for
>   yas-expansion but this side-effect is actually what I prefer
>
> * I don't see why the (cond ...) is needed but it is: C-u TAB behaves
>   the same as TAB otherwise, as if I used indent-relative instead of my
>   custom function.
>
> * If I try to add (delete-horizontal-space) (commented out for now), TAB
>   acts as C-u TAB.

I just noticed that I get a "Marker does not point anywhere" when I tun
TAB or C-u TAB.


___
auctex mailing list
auctex@gnu.org
https://lists.gnu.org/mailman/listinfo/auctex


[AUCTeX] Forcing indentation in math environments

2015-02-20 Thread Julien Cubizolles
I want to control indentation in math environments. I've defined the
following function

--8<---cut here---start->8---
(defun jc-math-mode-indent ()
  "Force indentation in math mode. "
  (interactive "p")
;; (delete-horizontal-space)
  (cond
   ((equal current-prefix-arg nil)
(indent-relative))
   )

  )
--8<---cut here---end--->8---

used in LaTeX-environment-list:

--8<---cut here---start->8---
(("verbatim" current-indentation)
 ("verbatim*" current-indentation)
 ("array" jc-math-mode-indent)
 ("displaymath" jc-math-mode-indent)
 ("eqnarray" jc-math-mode-indent)
 ("eqnarray*" jc-math-mode-indent)
 ("equation" jc-math-mode-indent)
 ("equation*" jc-math-mode-indent)
 ("picture")
 ("tabbing")
 ("table")
 ("table*")
 ("tabular")
 ("tabular*")
 ("code")
 ("tikzpicture")
 ("pspicture")
 ("align" jc-math-mode-indent)
 ("align*" jc-math-mode-indent)
 ("table")
 ("tabular")
 ("pspicture")
 ("tikzpicture")
 ("axis")
 ("psgraph")
 ("maple")
 ("figure")
 ("scope"))
--8<---cut here---end--->8---

It behaves the way I want:
TAB indents relative to the previous line
C-u TAB aligns with the previous line.

The thing is I'm not sure why it's working :-) since strange things also
happen:

* If yas-minor-mode is on, the point is at the beginning of the text
  after using TAB, which is what I want; it's at the beginning of the
  line if yas is not on. I could choose something else than TAB for
  yas-expansion but this side-effect is actually what I prefer

* I don't see why the (cond ...) is needed but it is: C-u TAB behaves
  the same as TAB otherwise, as if I used indent-relative instead of my
  custom function.

* If I try to add (delete-horizontal-space) (commented out for now), TAB
  acts as C-u TAB.

Any idea how to properly achieve:
* TAB does indent-relative
* C-u TAB aligns with the previous line
* C-u n TAB does indent-relative n times

with point remaining at the same position in the text, regardless of yas
being on or off ?

Thanks.


___
auctex mailing list
auctex@gnu.org
https://lists.gnu.org/mailman/listinfo/auctex


Re: [AUCTeX] Parsing first line

2015-02-20 Thread Tassilo Horn
Mosè Giordano  writes:

>> If that's the case, I'd suggest that we change that and alway call
>> them from the master file buffer.  Otherwise, we need to make many
>> buffer-local variables (TeX-engine, extra-options, ...)
>> document-local by stuffing them into the auto file.  Or do you see a
>> use-case where one wants to use different values for one of such
>> variables when invoking a command from, e.g., chapter01.tex, as
>> opposed to main.tex?
>
> I personally don't have such a use-case, but you know Emacs users tend
> to have very strange workflows which updates often break [1] ;-)

Well, I guess we should simply try it out and see if LongtimeUser4
complains. :-)

Bye,
Tassilo

___
auctex mailing list
auctex@gnu.org
https://lists.gnu.org/mailman/listinfo/auctex


Re: [AUCTeX] Parsing first line

2015-02-20 Thread Mosè Giordano
2015-02-20 11:50 GMT+01:00 Tassilo Horn :
> Mosè Giordano  writes:
>> but I think those variables are evaluated in the buffer calling the
>> commands, not in the master file.
>
> If that's the case, I'd suggest that we change that and alway call them
> from the master file buffer.  Otherwise, we need to make many
> buffer-local variables (TeX-engine, extra-options, ...) document-local
> by stuffing them into the auto file.  Or do you see a use-case where one
> wants to use different values for one of such variables when invoking a
> command from, e.g., chapter01.tex, as opposed to main.tex?

I personally don't have such a use-case, but you know Emacs users tend
to have very strange workflows which updates often break [1] ;-)

Bye,
Mosè


[1] https://xkcd.com/1172/

___
auctex mailing list
auctex@gnu.org
https://lists.gnu.org/mailman/listinfo/auctex


Re: [AUCTeX] Parsing first line

2015-02-20 Thread Tassilo Horn
Mosè Giordano  writes:

>>> (One of) The main problem was how to share such variable across
>>> multiple files of the same document (store it in the auto file?),
>>> but there is the same problem for other variables like
>>> `TeX-engine'.4
>>
>> Is that necessary?  I mean, tex commands are either invoked on the
>> master file or the region file, where in both cases the local vars of
>> the master file's buffer are in effect, no?
>
> Well, I should check it again,

Please do that.  I don't really know because I tend to use only single
file documents (maybe with the preamble in a separate file).

> but I think those variables are evaluated in the buffer calling the
> commands, not in the master file.

If that's the case, I'd suggest that we change that and alway call them
from the master file buffer.  Otherwise, we need to make many
buffer-local variables (TeX-engine, extra-options, ...) document-local
by stuffing them into the auto file.  Or do you see a use-case where one
wants to use different values for one of such variables when invoking a
command from, e.g., chapter01.tex, as opposed to main.tex?

Bye,
Tassilo

___
auctex mailing list
auctex@gnu.org
https://lists.gnu.org/mailman/listinfo/auctex


Re: [AUCTeX] Parsing first line

2015-02-20 Thread Mosè Giordano
2015-02-20 10:19 GMT+01:00 Tassilo Horn :
>> Last year I tried to work on implementing a local variable to specify
>> the output directory, and so indirectly fix Alistair's problem, but
>> I've never finished it.
>
> Couldn't you simply put the -output-directory option into
> `TeX-command-extra-options'?  Ah, no, then the View commands won't work
> of course...

Indeed the goal was to cater for view and clean commands as well.

>> (One of) The main problem was how to share such variable across
>> multiple files of the same document (store it in the auto file?), but
>> there is the same problem for other variables like `TeX-engine'.4
>
> Is that necessary?  I mean, tex commands are either invoked on the
> master file or the region file, where in both cases the local vars of
> the master file's buffer are in effect, no?

Well, I should check it again, but I think those variables are
evaluated in the buffer calling the commands, not in the master file.

Bye,
Mosè

___
auctex mailing list
auctex@gnu.org
https://lists.gnu.org/mailman/listinfo/auctex


Re: [AUCTeX] Parsing first line

2015-02-20 Thread Tassilo Horn
Mosè Giordano  writes:

>> I'm not exactly sure why the default is to compile a document with
>>
>>   latex  "\input yourfile.tex"
>>
>> instead of just
>>
>>   latex  yourfile.tex
>>
>> when using latex/pdflatex but I guess there's a reason, so that
>> suggestion might have some caveat I'm not aware of.
>
> David explained why AUCTeX compiles with "\input file.tex" here:
> https://lists.gnu.org/archive/html/auctex-devel/2008-05/msg00055.html

Ah, I see.

> Last year I tried to work on implementing a local variable to specify
> the output directory, and so indirectly fix Alistair's problem, but
> I've never finished it.

Couldn't you simply put the -output-directory option into
`TeX-command-extra-options'?  Ah, no, then the View commands won't work
of course...

> (One of) The main problem was how to share such variable across
> multiple files of the same document (store it in the auto file?), but
> there is the same problem for other variables like `TeX-engine'.

Is that necessary?  I mean, tex commands are either invoked on the
master file or the region file, where in both cases the local vars of
the master file's buffer are in effect, no?

Bye,
Tassilo

___
auctex mailing list
auctex@gnu.org
https://lists.gnu.org/mailman/listinfo/auctex


Re: [AUCTeX] Parsing first line

2015-02-20 Thread Mosè Giordano
Hi Tassilo,

2015-02-17 9:31 GMT+01:00 Tassilo Horn :
> Alistair Windsor  writes:
>
> Hi Alistair,
>
>> I would like to use the first line of my tex file to specify an
>> alternative destination for the output file using %&
>> -output-directory.  This works fine when I do pdflatex myfile.tex but
>> when I execute latex from with auc-tex I get pdflatex
>> "\input{myfile.tex}}" which thus bypasses the pre-compiler.  Is there
>> a way to alter this behavior?
>
> The \input master-file.tex is the result of expanding the %` format
> specifier in of the LaTeX entry in `TeX-command-list'.  You can use the
> %' specifier instead which expands to just the master file by placing
> something like this in your ~/.emacs.
>
> --8<---cut here---start->8---
> (with-eval-after-load 'tex
>   (add-to-list 'TeX-command-list
>'("LaTeX" "%'%l%(mode)%' %t" TeX-run-TeX nil
>  (latex-mode doctex-mode)
>  :help "Run LaTeX")))
> --8<---cut here---end--->8---
>
> I'm not exactly sure why the default is to compile a document with
>
>   latex  "\input yourfile.tex"
>
> instead of just
>
>   latex  yourfile.tex
>
> when using latex/pdflatex but I guess there's a reason, so that
> suggestion might have some caveat I'm not aware of.

David explained why AUCTeX compiles with "\input file.tex" here:
https://lists.gnu.org/archive/html/auctex-devel/2008-05/msg00055.html

Last year I tried to work on implementing a local variable to specify
the output directory, and so indirectly fix Alistair's problem, but
I've never finished it.  (One of) The main problem was how to share
such variable across multiple files of the same document (store it in
the auto file?), but there is the same problem for other variables
like `TeX-engine'.

Bye,
Mosè

___
auctex mailing list
auctex@gnu.org
https://lists.gnu.org/mailman/listinfo/auctex