mailing-list for TeXmacs Users

Text archives Help


Re: [TeXmacs] A temporary way to fix problem with sage plugin


Chronological Thread 
  • From: Jiezhe Wang <address@hidden>
  • To: Peter Rapčan <address@hidden>, Karl Hegbloom <address@hidden>
  • Cc: texmacs-users <address@hidden>
  • Subject: Re: [TeXmacs] A temporary way to fix problem with sage plugin
  • Date: Sun, 31 Jul 2016 21:26:41 +0800
  • Authentication-results: smtp3p.mail.yandex.net; dkim=pass header.i=@yandex.com

Hi! I've updated my patch for sage plugin. Instead of using the absolute
path directly, I use another function to find the location of the
tm_sage file. This is inspired by the plugin for Scilab.

In my arch, all start file for plugins are installed in
"$TEXMACS_BIN_PATH/bin", but it seems to be different for mac...


On 07/29/2016 05:12 AM, Peter Rapčan wrote:
> Karl, I understand that. Let me explain better:
>
> On OS X, with TeXmacs installed in the standard Applications folder, in
> the
> file
> /Applications/TeXmacs.app/Contents/Resources/share/TeXmacs/plugins/sage/progs/init-sage.scm
>
> there is a line (:launch "sage -python `which tm_sage`") , which is
> passed to python with the “which tm_sage" command unevaluated. In the
> shell that OS X uses by defaut, the "which” command is working normally.
>
> Therefore, as a temporary fix, Jienzhe suggested (see below) to replace
> the `which tm_sage` part with the actual tm_sage file location. On my
> system, I have to put the following: (:launch "sage -python
> /Applications/TeXmacs.app/Contents/Resources/share/TeXmacs/plugins/sage/bin/tm_sage”).
> With that the plugin works. [Sorry for claiming there was no tm_sage on
> my system, it was in fact present at the above location].
>
> So, to have a proper fix, the question is how to make the `which
> tm_sage` part work, or, in general, how to make the sage plugin
> correctly recognize what it needs to recognize.
>
> In fact, I don’t understand how TeXmacs knows that sage is present on my
> system in the first place, since the sage executable is not in my PATH
> locations (nevertheless TeXmacs correctly added a Sage session entry to
> the sessions menu, once I installed sage).
>
> Cheers,
> Peter.
>
>
>> On 28 Jul 2016, at 03:05, Karl Hegbloom <address@hidden
>> <mailto:address@hidden>> wrote:
>>
>> The 'which' command may be specific to a particular command shell, as
>> a builtin, so unless it's a shell with that builtin or there's a
>> binary or executable shell script called 'which', it won't work.
>>
>>
>> On Wed, Jul 27, 2016, 15:25 Peter Rapčan <address@hidden
>> <mailto:address@hidden>> wrote:
>>
>> Hello everybody,
>>
>>
>> Tried to follow the fix by Jienzhe. However, on my machine there
>> is no tm_sage file in the place where ist’s supposed to be
>>
>> (/Applications/TeXmacs.app/Contents/Resources/share/TeXmacs/bin/tm_sage)
>> — see below. There is a tm_sage file in my fink installation of
>> the old TeXmacs 1.0.7 at /sw/lib/TeXmacs/bin/tm_sage, which I
>> never used to run sage -- hence I suppose the tm_sage file is not
>> buit on the fly when first running a sage session. Right?
>>
>> What I get is the following:
>>
>> sys:1: RuntimeWarning: not adding
>> '‘/Applications/TeXmacs.app/Contents/Resources/share/TeXmacs/bin'
>> to sys.path since its status cannot be determined
>> python: can't open file
>>
>> '‘/Applications/TeXmacs.app/Contents/Resources/share/TeXmacs/bin/tm_sage‘':
>> [Errno 2] No such file or directory.
>>
>> Any advice?
>>
>> Best,
>> Peter.
>>
>

--
My current OpenPGP key:
dsa3072/EEE00331 (expires: 2025-07-18)
02D0 27CE DC67 6FA7 EC5E 09B9 A498 B054 EEE0 0331
From 92264b5e868fb8b8399dfbb78b714ae5cf38c24e Mon Sep 17 00:00:00 2001
From: wangjiezhe <address@hidden>
Date: Wed, 8 Jun 2016 11:20:42 +0800
Subject: [PATCH 2/4] Sage plugin: fix `which` not found

---
 plugins/sage/progs/init-sage.scm | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/plugins/sage/progs/init-sage.scm b/plugins/sage/progs/init-sage.scm
index f3fb922..b18bf07 100644
--- a/plugins/sage/progs/init-sage.scm
+++ b/plugins/sage/progs/init-sage.scm
@@ -12,10 +12,16 @@
 ;;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
+(define (sage-launcher)
+  (with path "$TEXMACS_BIN_PATH/bin/tm_sage"
+    (string-append
+      "sage -python "
+      (url-concretize (unix->url path)))))
+
 (plugin-configure sage
   (:macpath "Sage*" "Contents/Resources/sage")
   (:require (url-exists-in-path? "sage"))
-  (:launch "sage -python `which tm_sage`")
+  (:launch ,(sage-launcher))
   (:tab-completion #t)
   (:session "Sage")
   (:scripts "Sage"))
-- 
2.8.3

Attachment: Selection_071.png
Description: PNG image

Attachment: signature.asc
Description: OpenPGP digital signature




Archive powered by MHonArc 2.6.19.

Top of page