octave-maintainers
[Top][All Lists]
Advanced

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

Re: strange echo


From: Rik
Subject: Re: strange echo
Date: Tue, 22 Mar 2016 14:17:28 -0700

On 03/22/2016 12:16 PM, address@hidden wrote:
> Subject: > octave-4.0.1 strange echo > From: > Marco Atzeri <address@hidden> > Date: > 03/22/2016 09:58 AM > To: > Octave Maintainers List <address@hidden> > List-Post: > <mailto:address@hidden> > Content-Transfer-Encoding: > 7bit > Precedence: > list > MIME-Version: > 1.0 > Message-ID: > <address@hidden> > Content-Type: > text/plain; charset=utf-8; format=flowed > Message: > 2 > > I just built from > ftp://ftp.gnu.org/gnu/octave/octave-4.0.1.tar.xz > > plus adapted two 2 patches > http://hg.savannah.gnu.org/hgweb/octave/rev/8e5eca2c5a64 > http://hg.savannah.gnu.org/hgweb/octave/rev/2ee20a290d61 > > and now i see a copy of > /usr/share/octave/4.0.1/m/startup/__finish__.m > any time I require a "echo on" and exit. > > > $ octave-cli --eval "echo on" > + ## Copyright (C) 2008-2015 Ben Abbott > + ## > + ## This file is part of Octave. > + ## > + ## Octave is free software; you can redistribute it and/or modify it > + ## under the terms of the GNU General Public License as published by > + ## the Free Software Foundation; either version 3 of the License, or (at > .... > + ## No test needed for internal helper m-file. > + ##!assert (1) > + endscript; > > > I doubt it is a an effect of the two patches, but could anyone > check on a clean octave-4.0.1 build ?

This is expected.  'echo on' turns on echo for scripts, but not functions.  The __finish__.m *script* is set to be executed at the end of every Octave session so that any commands the user has in finish.m will be executed (e.g., saving the workspace, etc.).

The explanation for why __finish__.m is a script, rather than a function, is in the code itself.

-- __finish__.m --
## No function declaration, this is is an Octave script.  This means we are
## still in the base workspace with access to all user variables.

if (exist ("finish", "file"))
  finish;  # No arg list here since finish might be a script.
endif
-- End Code --

This seems like a corner case, but if it is really a problem then we could switch to evalin.

-- New Code --
function __finish__ ()

  if (exist ("finish", "file"))
    ## No arg list for finish because it might be a script.
    evalin ("base", "finish;");
  endif

endfunction
-- End Code --

I checked and this seems to do the right thing.

--Rik



reply via email to

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