Subject: how to stop the annotation of lists by filenames?
From: Oliver Kullmann
Date: Sat, 31 May 2008 21:12:27 +0100
hm, yet it seems here the copy-and-paste
approach is the lesser evil:
With new versions of Maxima I need to check
these definitions. But hopefully this is
only a bit of work once in a while,
and otherwise it works now.
The solution below makes me feel a bit at unease:
Mainly because I don't understand it properly.
So I better leave this additional level of indirection
alone, since I cannot properly estimate the
consequences.
If I later get into trouble, I will come back to this.
Thanks
Oliver
On Sat, May 31, 2008 at 01:34:20PM -0600, Robert Dodier wrote:
> On 5/31/08, Stavros Macrakis <macrakis at alum.mit.edu> wrote:
> > (defun add-lineinfo (lis)
> > (if $dontaddloadinfo lis ;;; <<< the main change
> > (if (or (atom lis) (and (eq *parse-window* *standard-input*)
> > (not (find-stream *parse-stream*))))
> > lis
> > (let* ((st (get-instream *parse-stream*))
> > (n (instream-line st))
> > (nam (instream-name st)))
> > (or nam (return-from add-lineinfo lis))
> > (setq *current-line-info*
> > (cond ((eq (cadr *current-line-info*) nam)
> > (cond ((eql (car *current-line-info*) n)
> > *current-line-info*)
> > (t (cons n (cdr *current-line-info*)))))
> > (t (list n nam 'src))))
> > (cond ((null (cdr lis))
> > (list (car lis) *current-line-info*))
> > (t (append lis (list *current-line-info*)))))))
> > ) ; one extra parenthesis to match
>
> Cloning and modifying the original function causes trouble
> if ever the original is modified (those changes are not
> automatically inherited by this version).
> Let's preserve the original function.
>
> (let ((add-lineinfo-original (symbol-function 'add-lineinfo)))
> (defun add-lineinfo (foo)
> (if $dontaddloadinfo foo (funcall add-lineinfo-original foo))))
>
> I guess that has its own problem; if you load it twice,
> the original isn't called anymore. Well, maybe it's useful anyway.
>
> FWIW
>
> Robert Dodier