1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
|
Description: upstream: enhance: plugins: maple: HOME init-maple.mpl
This patch allows the `tm_maple` interface to read a `init-maple.mpl`
that is under the `TEXMACS_HOME_PATH` hierarchy. That is, if the file
`$TEXMACS_HOME_PATH/plugins/maple/maple/init-maple.mpl` exists and is
readable then it is `read` just after that
`$TEXMACS_PATH/plugins/maple/maple/init-maple.mpl` is `read`.
This allows end-users to customize their maple interface.
Origin: vendor, Debian
Forwarded: https://github.com/texmacs/texmacs/pull/93
Author: Jerome Benoit <calculus@rezozer.net>
Last-Update: 2024-08-09
--- a/plugins/maple/src.9/tm_maple_9.c
+++ b/plugins/maple/src.9/tm_maple_9.c
@@ -109,9 +109,12 @@
* Launching maple
******************************************************************************/
+#define TMMPL_PI_MAPLEINIT_RELPATH "plugins/maple/maple/init-maple.mpl"
+
int
main (int argc, char *argv[]) {
const char* tm_path=getenv("TEXMACS_PATH");
+ const char* tm_home_path=getenv("TEXMACS_HOME_PATH");
char in [2148];
char err[2048];
char tmmplinit [2048];
@@ -131,7 +134,7 @@
(void) r; /* silence unused-but-set-variable warning */
(void) l; /* silence unused-variable warning */
- snprintf(tmmplinit,sizeof(tmmplinit),"%s/plugins/maple/maple/init-maple.mpl",tm_path);
+ snprintf(tmmplinit,sizeof(tmmplinit), "%s/" TMMPL_PI_MAPLEINIT_RELPATH ,tm_path);
if (access(tmmplinit,R_OK)) {
printf("Fatal error, unable to read `%s`\n",tmmplinit);
return( 1 );
@@ -156,6 +159,12 @@
snprintf(in,sizeof(in),"read(`%s`);",tmmplinit);
r= EvalMapleStatement (kv, in);
+ snprintf(tmmplinit,sizeof(tmmplinit), "%s/" TMMPL_PI_MAPLEINIT_RELPATH ,tm_home_path);
+ if (!(access(tmmplinit,R_OK))) {
+ snprintf(in,sizeof(in),"read(`%s`);",tmmplinit);
+ r= EvalMapleStatement (kv, in);
+ }
+
while (1) {
next_input ();
printf("\5");
@@ -174,7 +183,7 @@
MapleHelp (kv, in+1, NULL, writeHelpChar, NULL, 80, NULL);
else {
if (in[strlen(in)-1] != ':')
- strcat (in, ":tmresult:=\%:tmprint(tmresult):tmresult:");
+ strcat (in, ":tmresult:=\%:tmprint(tmresult):tmresult:");
r = EvalMapleStatement (kv, in);
}
}
@@ -183,3 +192,5 @@
return (0);
}
+
+#undef TMMPL_PI_MAPLEINIT_RELPATH
|