unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* lread.c's `values' variable
@ 2002-10-31 19:55 Stefan Monnier
  2002-11-02  3:31 ` Richard Stallman
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2002-10-31 19:55 UTC (permalink / raw)



  DEFVAR_LISP ("values", &Vvalues,
	       doc: /* List of values of all expressions which were read, evaluated and printed.
Order is reverse chronological.  */);

Does anybody know what is the `values' variable for (defined in lread.c) ?


	Stefan

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: lread.c's `values' variable
  2002-10-31 19:55 lread.c's `values' variable Stefan Monnier
@ 2002-11-02  3:31 ` Richard Stallman
  2002-11-03  1:19   ` Kim F. Storm
  0 siblings, 1 reply; 6+ messages in thread
From: Richard Stallman @ 2002-11-02  3:31 UTC (permalink / raw)
  Cc: emacs-devel

    Does anybody know what is the `values' variable for (defined in lread.c) ?

See lisp-mode.el.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: lread.c's `values' variable
  2002-11-02  3:31 ` Richard Stallman
@ 2002-11-03  1:19   ` Kim F. Storm
  2002-11-04 12:01     ` Richard Stallman
  0 siblings, 1 reply; 6+ messages in thread
From: Kim F. Storm @ 2002-11-03  1:19 UTC (permalink / raw)
  Cc: monnier+gnu/emacs, emacs-devel

Richard Stallman <rms@gnu.org> writes:

>     Does anybody know what is the `values' variable for (defined in lread.c) ?
> 
> See lisp-mode.el.

Yes, it uses (car values).

However, that doesn't explain why `values' needs to be a list of all
expressions "which were read, evaluated and printed".  Since it grows
without ever being truncated, it is a memory leak IMO.

AFAICS, a simple `last-value' variable would do just fine as a
replacement.

-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: lread.c's `values' variable
  2002-11-03  1:19   ` Kim F. Storm
@ 2002-11-04 12:01     ` Richard Stallman
  2002-11-05  0:08       ` Kim F. Storm
  0 siblings, 1 reply; 6+ messages in thread
From: Richard Stallman @ 2002-11-04 12:01 UTC (permalink / raw)
  Cc: monnier+gnu/emacs, emacs-devel

    Yes, it uses (car values).

values is supposed to provide a history that you can look at whenever
you wish.  It's not just meant for the functions that look at it.

    However, that doesn't explain why `values' needs to be a list of all
    expressions "which were read, evaluated and printed".  Since it grows
    without ever being truncated, it is a memory leak IMO.

It probably is not a significant leak, but if it is, we could make GC
truncate it to a certain length.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: lread.c's `values' variable
  2002-11-04 12:01     ` Richard Stallman
@ 2002-11-05  0:08       ` Kim F. Storm
  2002-11-06  4:50         ` Richard Stallman
  0 siblings, 1 reply; 6+ messages in thread
From: Kim F. Storm @ 2002-11-05  0:08 UTC (permalink / raw)
  Cc: monnier+gnu/emacs, emacs-devel

Richard Stallman <rms@gnu.org> writes:

>     Yes, it uses (car values).
> 
> values is supposed to provide a history that you can look at whenever
> you wish.

Has anyone ever needed to look at that list?

Isn't the information typically found in the *Messages* buffer, in the
command history, or in the buffer where you evalled the expression
(e.g. *scratch*).

>  It's not just meant for the functions that look at it.

It is quite obvious that functions can only really look at the car of
that list.  So it is really _never_ for functions to look at (as a list).

> 
>     However, that doesn't explain why `values' needs to be a list of all
>     expressions "which were read, evaluated and printed".  Since it grows
>     without ever being truncated, it is a memory leak IMO.
> 
> It probably is not a significant leak, but if it is, we could make GC
> truncate it to a certain length.

If we keep it as a list, I think that is a reasonable compromise.

-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: lread.c's `values' variable
  2002-11-05  0:08       ` Kim F. Storm
@ 2002-11-06  4:50         ` Richard Stallman
  0 siblings, 0 replies; 6+ messages in thread
From: Richard Stallman @ 2002-11-06  4:50 UTC (permalink / raw)
  Cc: monnier+gnu/emacs, emacs-devel

    Has anyone ever needed to look at that list?

    Isn't the information typically found in the *Messages* buffer, in the
    command history, or in the buffer where you evalled the expression
    (e.g. *scratch*).

The printed representation would be found there, but at least in theory
one could want to get at the actual Lisp object (to see if it is eq
to something else, for instance, or to modify it).

At present we don't have any convenient way to access it except to do
(nth N values).  And that has the inconvenience that the index of any
object changes by 1 each time you evaluate something.

    It is quite obvious that functions can only really look at the car of
    that list.

To make `values' conveniently useful, it would be nice to have an
interface that would show you the printed reps of the elements of the
list in a menu, let you select one of the values, and put it into some
other variable, without changing the value of `values'.  This is far
from the most important feature to add to Emacs, and I wouldn't spend
time on it myself.  But maybe someone would like to do it.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2002-11-06  4:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-31 19:55 lread.c's `values' variable Stefan Monnier
2002-11-02  3:31 ` Richard Stallman
2002-11-03  1:19   ` Kim F. Storm
2002-11-04 12:01     ` Richard Stallman
2002-11-05  0:08       ` Kim F. Storm
2002-11-06  4:50         ` Richard Stallman

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).