emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Creating live elisp link
@ 2013-03-20  2:44 Lawrence Bottorff
  2013-03-20  3:15 ` Samuel Wales
  0 siblings, 1 reply; 2+ messages in thread
From: Lawrence Bottorff @ 2013-03-20  2:44 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 907 bytes --]

I'm trying to create a link that takes an elisp expression and evaluates it
in another buffer. Here's what I've come up with

1. C-c C-l
2. choose elisp:
3. In the mini buffer:
    Link: elisp:(with-output-to-temp-buffer "scratch" (print 20))
    Description: Print 20

Okay, this calls up the scratch buffer and prints out 20. But how would I
call up scratch and, say, change its mode to lisp with
(lisp-interaction-mode)? I can try:

 Link: elisp:(with-output-to-temp-buffer "scratch" (eval
'(lisp-interaction-mode)))

but this only seems to change my active org file's org-mode to
lisp-interaction-mode. Not a pretty sight. My Messages says:

Execute "(with-output-to-temp-buffer "scratch" (eval
'(lisp-interaction-mode)))" as elisp?  y
(with-output-to-temp-buffer "scratch" (eval '(lisp-interaction-mode))) =>
nil

But of course
 [[elisp:(zone)][zone]]

is kinda exciting...

What am I doing wrong?

LB

[-- Attachment #2: Type: text/html, Size: 1284 bytes --]

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

* Re: Creating live elisp link
  2013-03-20  2:44 Creating live elisp link Lawrence Bottorff
@ 2013-03-20  3:15 ` Samuel Wales
  0 siblings, 0 replies; 2+ messages in thread
From: Samuel Wales @ 2013-03-20  3:15 UTC (permalink / raw)
  To: Lawrence Bottorff; +Cc: emacs-orgmode

On 3/19/13, Lawrence Bottorff <galaxybeinglambda@gmail.com> wrote:
>  Link: elisp:(with-output-to-temp-buffer "scratch" (eval
> '(lisp-interaction-mode)))

C-h f:

===
This construct makes buffer BUFNAME empty before running BODY.
It does not make the buffer current for BODY.
Instead it binds `standard-output' to that buffer, so that output
generated with `prin1' and similar functions in BODY goes into
the buffer.
===

Try with-current-buffer.

> (with-output-to-temp-buffer "scratch" (eval '(lisp-interaction-mode))) =>

(eval '(x)) means (x).

Samuel

-- 
The Kafka Pandemic: http://thekafkapandemic.blogspot.com

The disease DOES progress.  MANY people have died from it.  ANYBODY
can get it.  There is NO hope without action.  This means YOU.

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

end of thread, other threads:[~2013-03-20  3:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-20  2:44 Creating live elisp link Lawrence Bottorff
2013-03-20  3:15 ` Samuel Wales

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

	https://git.savannah.gnu.org/cgit/emacs/org-mode.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).