* Running .emacs style commands within emacs
@ 2008-05-19 23:51 Ben Forbes
0 siblings, 0 replies; 9+ messages in thread
From: Ben Forbes @ 2008-05-19 23:51 UTC (permalink / raw)
To: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 197 bytes --]
In my .emacs init file I have commands like
(fset 'delete-whole-line "\C-a\C-k\C-k")
How can I run a command like this from within emacs? It doesn't seem to be
recognized when I try "M-x fset".
[-- Attachment #2: Type: text/html, Size: 245 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Running .emacs style commands within emacs
[not found] <mailman.11862.1211250760.18990.help-gnu-emacs@gnu.org>
@ 2008-05-20 4:32 ` B. T. Raven
2008-05-20 7:19 ` Ben Forbes
[not found] ` <mailman.11880.1211284612.18990.help-gnu-emacs@gnu.org>
2008-05-20 18:05 ` james
1 sibling, 2 replies; 9+ messages in thread
From: B. T. Raven @ 2008-05-20 4:32 UTC (permalink / raw)
To: help-gnu-emacs
Ben Forbes wrote:
> In my .emacs init file I have commands like
>
> (fset 'delete-whole-line "\C-a\C-k\C-k")
>
>
> How can I run a command like this from within emacs? It doesn't seem to be
> recognized when I try "M-x fset".
>
This is just the expression generated when you save a macro. Try C-h f
'delete-whole-line and a *Help buffer will show this. You could shorten
the macro name to 'dln and it would work the same. Try this and then
invoke with M-x dln. So it's just go to beginning of line, kill line,
kill newline. You can define keyboard macros and not save them if you
need them for only one session.
Ed
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Running .emacs style commands within emacs
2008-05-20 4:32 ` Running .emacs style commands within emacs B. T. Raven
@ 2008-05-20 7:19 ` Ben Forbes
2008-05-20 13:41 ` Drew Adams
[not found] ` <mailman.11880.1211284612.18990.help-gnu-emacs@gnu.org>
1 sibling, 1 reply; 9+ messages in thread
From: Ben Forbes @ 2008-05-20 7:19 UTC (permalink / raw)
To: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 1249 bytes --]
Actually what I meant was, I want to run lisp forms from within emacs. Eg,
(global-set-key "\C-\M-z" 'delete-whole-line). There must be a Lisp engine
running within Emacs that interprets this form when it is in the .emacs init
file. Can I send lisp forms to this engine at any given time during an Emacs
session? I know global-set-key can be run from M-x but it's interactive, I'd
like to be able to enter the above form manually.
---------- Forwarded message ----------
From: B. T. Raven <nihil@nihilo.net>
Date: Tue, May 20, 2008 at 2:32 PM
Subject: Re: Running .emacs style commands within emacs
To: help-gnu-emacs@gnu.org
Ben Forbes wrote:
> In my .emacs init file I have commands like
>
> (fset 'delete-whole-line "\C-a\C-k\C-k")
>
>
> How can I run a command like this from within emacs? It doesn't seem to be
> recognized when I try "M-x fset".
>
>
This is just the expression generated when you save a macro. Try C-h f
'delete-whole-line and a *Help buffer will show this. You could shorten the
macro name to 'dln and it would work the same. Try this and then invoke with
M-x dln. So it's just go to beginning of line, kill line, kill newline. You
can define keyboard macros and not save them if you need them for only one
session.
Ed
[-- Attachment #2: Type: text/html, Size: 1731 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Running .emacs style commands within emacs
[not found] ` <mailman.11880.1211284612.18990.help-gnu-emacs@gnu.org>
@ 2008-05-20 12:26 ` B. T. Raven
2008-05-21 8:58 ` Tim X
1 sibling, 0 replies; 9+ messages in thread
From: B. T. Raven @ 2008-05-20 12:26 UTC (permalink / raw)
To: help-gnu-emacs
I don't understand. It seems to me that in this context "interactive"
and "manual" are about the same thing. You can evaluate any lisp
expression at any time (even in non lisp buffers) by putting the cursor
after the last parenthesis and issuing C-x C-e. So make
'delete-whole-line a function rather than a macro.
Ben Forbes wrote:
> Actually what I meant was, I want to run lisp forms from within emacs. Eg,
> (global-set-key "\C-\M-z" 'delete-whole-line). There must be a Lisp engine
> running within Emacs that interprets this form when it is in the .emacs init
> file. Can I send lisp forms to this engine at any given time during an Emacs
> session? I know global-set-key can be run from M-x but it's interactive, I'd
> like to be able to enter the above form manually.
>
> ---------- Forwarded message ----------
> From: B. T. Raven <nihil@nihilo.net>
> Date: Tue, May 20, 2008 at 2:32 PM
> Subject: Re: Running .emacs style commands within emacs
> To: help-gnu-emacs@gnu.org
>
>
> Ben Forbes wrote:
>
>> In my .emacs init file I have commands like
>>
>> (fset 'delete-whole-line "\C-a\C-k\C-k")
>>
>>
>> How can I run a command like this from within emacs? It doesn't seem to be
>> recognized when I try "M-x fset".
>>
>>
>
> This is just the expression generated when you save a macro. Try C-h f
> 'delete-whole-line and a *Help buffer will show this. You could shorten the
> macro name to 'dln and it would work the same. Try this and then invoke with
> M-x dln. So it's just go to beginning of line, kill line, kill newline. You
> can define keyboard macros and not save them if you need them for only one
> session.
>
> Ed
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: Running .emacs style commands within emacs
2008-05-20 7:19 ` Ben Forbes
@ 2008-05-20 13:41 ` Drew Adams
2008-05-20 22:55 ` Ben Forbes
0 siblings, 1 reply; 9+ messages in thread
From: Drew Adams @ 2008-05-20 13:41 UTC (permalink / raw)
To: 'Ben Forbes', help-gnu-emacs
> Actually what I meant was, I want to run lisp forms from
> within emacs. Eg, (global-set-key "\C-\M-z" 'delete-whole-line).
> There must be a Lisp engine running within Emacs that interprets
> this form when it is in the .emacs init file. Can I send lisp
> forms to this engine at any given time during an Emacs session?
> I know global-set-key can be run from M-x but it's interactive,
> I'd like to be able to enter the above form manually.
C-M-x, with the cursor on the sexp somewhere, assuming you are in
emacs-lisp-mode. See node Lisp Eval of the Emacs manual.
P.S., use plain text, not HTML, for mail to this mailing list.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Running .emacs style commands within emacs
[not found] <mailman.11862.1211250760.18990.help-gnu-emacs@gnu.org>
2008-05-20 4:32 ` Running .emacs style commands within emacs B. T. Raven
@ 2008-05-20 18:05 ` james
1 sibling, 0 replies; 9+ messages in thread
From: james @ 2008-05-20 18:05 UTC (permalink / raw)
To: help-gnu-emacs
On May 19, 6:51 pm, "Ben Forbes" <bdfor...@gmail.com> wrote:
> In my .emacs init file I have commands like
>
> (fset 'delete-whole-line "\C-a\C-k\C-k")
>
> How can I run a command like this from within emacs? It doesn't seem to be
> recognized when I try "M-x fset".
M-x only allows you to run interactive commands, which fset is not.
If you want to run an arbitrary lisp expression (very useful for
giving variables buffer-local values), you can use M-x eval-expression
(bound to M-: on my emacs), then you can type in your s-expression in
the minibuffer:
(setq c-basic-offset 3)
(or you could just type it in the buffer and C-x-e, as others have
mentioned)
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Running .emacs style commands within emacs
2008-05-20 13:41 ` Drew Adams
@ 2008-05-20 22:55 ` Ben Forbes
0 siblings, 0 replies; 9+ messages in thread
From: Ben Forbes @ 2008-05-20 22:55 UTC (permalink / raw)
To: help-gnu-emacs
>C-M-x, with the cursor on the sexp somewhere, assuming you are in
>emacs-lisp-mode. See node Lisp Eval of the Emacs manual.
> You can evaluate any lisp expression at any time (even in non lisp buffers) by putting the cursor after the last parenthesis and issuing C-x C-e
Thanks, both of those were what I was looking for.
> P.S., use plain text, not HTML, for mail to this mailing list.
Will do.
Thanks,
Ben Forbes
--
On Tue, May 20, 2008 at 10:26 PM, B. T. Raven <nihil@nihilo.net> wrote:
>
> I don't understand. It seems to me that in this context "interactive" and "manual" are about the same thing. You can evaluate any lisp expression at any time (even in non lisp buffers) by putting the cursor after the last parenthesis and issuing C-x C-e. So make 'delete-whole-line a function rather than a macro.
>
>
> Ben Forbes wrote:
>>
>> Actually what I meant was, I want to run lisp forms from within emacs. Eg,
>> (global-set-key "\C-\M-z" 'delete-whole-line). There must be a Lisp engine
>> running within Emacs that interprets this form when it is in the .emacs init
>> file. Can I send lisp forms to this engine at any given time during an Emacs
>> session? I know global-set-key can be run from M-x but it's interactive, I'd
>> like to be able to enter the above form manually.
>>
>> ---------- Forwarded message ----------
>> From: B. T. Raven <nihil@nihilo.net>
>> Date: Tue, May 20, 2008 at 2:32 PM
>> Subject: Re: Running .emacs style commands within emacs
>> To: help-gnu-emacs@gnu.org
>>
>>
>> Ben Forbes wrote:
>>
>>> In my .emacs init file I have commands like
>>>
>>> (fset 'delete-whole-line "\C-a\C-k\C-k")
>>>
>>>
>>> How can I run a command like this from within emacs? It doesn't seem to be
>>> recognized when I try "M-x fset".
>>>
>>>
>>
>> This is just the expression generated when you save a macro. Try C-h f
>> 'delete-whole-line and a *Help buffer will show this. You could shorten the
>> macro name to 'dln and it would work the same. Try this and then invoke with
>> M-x dln. So it's just go to beginning of line, kill line, kill newline. You
>> can define keyboard macros and not save them if you need them for only one
>> session.
>>
>> Ed
>>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Running .emacs style commands within emacs
[not found] ` <mailman.11880.1211284612.18990.help-gnu-emacs@gnu.org>
2008-05-20 12:26 ` B. T. Raven
@ 2008-05-21 8:58 ` Tim X
2008-05-21 13:28 ` Joel J. Adamson
1 sibling, 1 reply; 9+ messages in thread
From: Tim X @ 2008-05-21 8:58 UTC (permalink / raw)
To: help-gnu-emacs
"Ben Forbes" <bdforbes@gmail.com> writes:
> Actually what I meant was, I want to run lisp forms from within emacs. Eg,
> (global-set-key "\C-\M-z" 'delete-whole-line). There must be a Lisp engine
> running within Emacs that interprets this form when it is in the .emacs init
> file. Can I send lisp forms to this engine at any given time during an Emacs
> session? I know global-set-key can be run from M-x but it's interactive, I'd
> like to be able to enter the above form manually.
This is what I use the scratch buffer for.
enter the elisp form you want to evaluate. Put the cursor at the end
and hit C-x C-e. There are many other commands that will do similar
things, but that will get you started.
>
--
tcross (at) rapttech dot com dot au
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Running .emacs style commands within emacs
2008-05-21 8:58 ` Tim X
@ 2008-05-21 13:28 ` Joel J. Adamson
0 siblings, 0 replies; 9+ messages in thread
From: Joel J. Adamson @ 2008-05-21 13:28 UTC (permalink / raw)
To: Tim X; +Cc: help-gnu-emacs
Tim X <timx@nospam.dev.null> writes:
> "Ben Forbes" <bdforbes@gmail.com> writes:
>
>> Actually what I meant was, I want to run lisp forms from within emacs. Eg,
>> (global-set-key "\C-\M-z" 'delete-whole-line). There must be a Lisp engine
>> running within Emacs that interprets this form when it is in the .emacs init
>> file. Can I send lisp forms to this engine at any given time during an Emacs
>> session? I know global-set-key can be run from M-x but it's interactive, I'd
>> like to be able to enter the above form manually.
>
> This is what I use the scratch buffer for.
>
There's also an interactive Emacs Lisp REPL called ielm in Emacs 23
(from CVS).
M-x ielm
Joel
--
Joel J. Adamson
Biostatistician
Pediatric Psychopharmacology Research Unit
Massachusetts General Hospital
Boston, MA 02114
(617) 643-1432
(303) 880-3109
Public key: http://pgp.mit.edu
http://www.unc.edu/~adamsonj
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2008-05-21 13:28 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <mailman.11862.1211250760.18990.help-gnu-emacs@gnu.org>
2008-05-20 4:32 ` Running .emacs style commands within emacs B. T. Raven
2008-05-20 7:19 ` Ben Forbes
2008-05-20 13:41 ` Drew Adams
2008-05-20 22:55 ` Ben Forbes
[not found] ` <mailman.11880.1211284612.18990.help-gnu-emacs@gnu.org>
2008-05-20 12:26 ` B. T. Raven
2008-05-21 8:58 ` Tim X
2008-05-21 13:28 ` Joel J. Adamson
2008-05-20 18:05 ` james
2008-05-19 23:51 Ben Forbes
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.