2019-07-20 01:15:54 +08:00
|
|
|
<TeXmacs|1.99.10>
|
2011-08-28 15:59:50 +08:00
|
|
|
|
2019-07-20 01:15:54 +08:00
|
|
|
<style|<tuple|tmdoc|english|old-spacing>>
|
2011-08-28 15:59:50 +08:00
|
|
|
|
|
|
|
<\body>
|
2014-10-05 00:35:44 +08:00
|
|
|
<tmdoc-title|Writing your own initialization files>
|
2011-08-28 15:59:50 +08:00
|
|
|
|
2014-10-05 00:35:44 +08:00
|
|
|
When starting up, <TeXmacs> executes the file
|
2011-08-28 15:59:50 +08:00
|
|
|
|
|
|
|
<\verbatim>
|
|
|
|
\ \ \ \ $TEXMACS_PATH/progs/init-texmacs.scm
|
|
|
|
</verbatim>
|
|
|
|
|
|
|
|
as well as your personal initialization file
|
|
|
|
|
|
|
|
<\verbatim>
|
|
|
|
\ \ \ \ $TEXMACS_HOME_PATH/progs/my-init-texmacs.scm
|
|
|
|
</verbatim>
|
|
|
|
|
|
|
|
if it exists. By default, the path <verbatim|$TEXMACS_HOME_PATH> equals
|
2019-07-20 01:15:54 +08:00
|
|
|
<verbatim|%appdata%\\TeXmacs> on <name|Windows> or
|
|
|
|
<verbatim|$HOME/.TeXmacs> on <name|GNU>/<name|Linux> and <name|macOS>.
|
|
|
|
Similarly, each time you create a new buffer (either by creating a new file
|
|
|
|
or opening an already existing one), the file
|
2011-08-28 15:59:50 +08:00
|
|
|
|
|
|
|
<\verbatim>
|
|
|
|
\ \ \ \ $TEXMACS_PATH/progs/init-buffer.scm
|
|
|
|
</verbatim>
|
|
|
|
|
|
|
|
is executed, as well as
|
|
|
|
|
|
|
|
<\verbatim>
|
|
|
|
\ \ \ \ $TEXMACS_HOME_PATH/progs/my-init-buffer.scm
|
|
|
|
</verbatim>
|
|
|
|
|
|
|
|
if it exists.
|
|
|
|
|
2014-10-05 00:35:44 +08:00
|
|
|
<\example>
|
|
|
|
Suppose you want to add a style package <verbatim|CustomStyle.ts> of your
|
|
|
|
own to every new document you create. You can add the following lines to
|
|
|
|
<verbatim|$TEXMACS_HOME_PATH/progs/my-init-buffer.scm>:
|
2011-08-28 15:59:50 +08:00
|
|
|
|
2014-10-05 00:35:44 +08:00
|
|
|
<\scm-code>
|
2014-10-05 00:46:39 +08:00
|
|
|
(when (buffer-newly-created? (current-buffer))
|
2014-10-05 00:35:44 +08:00
|
|
|
|
|
|
|
\ \ (set-style-list (append (get-style-list) '("CustomStyle")))
|
|
|
|
|
|
|
|
\ \ (buffer-pretend-saved (current-buffer)))
|
|
|
|
</scm-code>
|
|
|
|
|
2014-10-05 00:46:39 +08:00
|
|
|
First we check whether the <scm|current-buffer> has been newly created in
|
|
|
|
order not to apply the style to existing files when we open them. Then we
|
|
|
|
add the new package (instead of changing it with <scm|init-style>) using
|
2014-10-05 00:35:44 +08:00
|
|
|
<scm|set-style-list> and finally we call <scm|buffer-pretend-saved> to
|
2014-10-05 00:46:39 +08:00
|
|
|
prevent <TeXmacs> from thinking the buffer has been modified by the
|
|
|
|
change of style, or it would always prompt asking for confirmation before
|
|
|
|
closing an empty buffer.
|
2014-10-05 00:35:44 +08:00
|
|
|
</example>
|
|
|
|
|
2019-07-20 01:15:54 +08:00
|
|
|
<tmdoc-copyright|1998--2019|Joris van der Hoeven|Darcy Shen>
|
2014-10-05 00:35:44 +08:00
|
|
|
|
|
|
|
<tmdoc-license|Permission is granted to copy, distribute and/or modify this
|
|
|
|
document under the terms of the GNU Free Documentation License, Version 1.1
|
|
|
|
or any later version published by the Free Software Foundation; with no
|
|
|
|
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
|
|
|
|
Texts. A copy of the license is included in the section entitled "GNU Free
|
|
|
|
Documentation License".>
|
2011-08-28 15:59:50 +08:00
|
|
|
</body>
|
|
|
|
|
2014-10-05 00:35:44 +08:00
|
|
|
<initial|<\collection>
|
|
|
|
</collection>>
|