help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: identity function with an echo side effect


From: bolega
Subject: Re: identity function with an echo side effect
Date: Wed, 08 Dec 2010 15:24:06 -0000
User-agent: G2/1.0

On Aug 10, 4:03 pm, p...@informatimago.com (Pascal J. Bourguignon)
wrote:
> bolega <gnuist...@gmail.com> writes:
> > After searching google groups and emacs apropos extensively, I could
> > not find a function, perhaps I am missing one that can return
> > identically return its argument and has a small side effect of echoing
> > the argument in some place such as for example
>
> > the mini buffer or the point at which C-x C-e is typed.
>
> > For example, calling this function "echo" , usage would look like
> > this :
>
> > (cdr ( echo (cdr (echo (cdr (echo '(a b c d)))))))
>
> > echo:
> > '(a b c d) or (a b c d)  (I am not sure which would be appropriate)
> > (b c d)
> > (c d)
>
> > result:
> > (d)
>
> > Is there a need for quotes to prevent evaluation of alphabets at any
> > phase ?
>
> In Common Lisp, you can use PRINT for this.
>
> CL-USER> (cdr (print (cdr (print (cdr (print '(a b c d)))))))
>
> (A B C D)
> (B C D)
> (C D)
> (D)
> CL-USER>
>
> In emacs lisp too, but the output of print goes to the *Message* buffer.
>
> M-x ielm RET
> ELISP> (cdr (print (cdr (print (cdr (print '(a b c d)))))))
> (d)
>
> and you get:
>
> (a b c d)
>
> (b c d)
>
> (c d)
>
> in the minibuffer and in *Message*.
>
> Or, in an emacs lisp buffer:
>
> (cdr (print (cdr (print (cdr (print '(a b c d))))))) C-u C-x C-e
>
> inserts:
>
> (a b c d)
>
> (b c d)
>
> (c d)
> (d)
>
> --
> __Pascal Bourguignon__                    http://www.informatimago.com/

THANKS A LOT !!!

If you dont mind, how many years have you spent on learning emacs/
lisp ?

Can you kindly give a reading syllabus, books list and possibly time
for completion from your perspective and what to get out of each book
since they have some common repetition.

Are there any implicit quotations taking place in the above sequence
of cdr, print ... ?

Bolega



reply via email to

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