all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Simple question on loading programs in emacs
@ 2012-11-30 17:44 Haines Brown
  2012-11-30 17:53 ` Bastien
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Haines Brown @ 2012-11-30 17:44 UTC (permalink / raw)
  To: help-gnu-emacs

A simple question, but I'm lost in the manual. I want to start a session
of emacs that automatically loads an emacs program automatically instead
of having to do M-x program during the emacs session. I want to do this
because I have a custom emacs init file just for that emacs program.

I tried (autoload 'program "ProgramName" t), but this only sets it in
the environment. 

A related question: When I close that program within emacs, I want
it to close the emacs session as well. 

Haines Brown


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

* Re: Simple question on loading programs in emacs
  2012-11-30 17:44 Simple question on loading programs in emacs Haines Brown
@ 2012-11-30 17:53 ` Bastien
  2012-11-30 18:54 ` Pascal J. Bourguignon
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Bastien @ 2012-11-30 17:53 UTC (permalink / raw)
  To: Haines Brown; +Cc: help-gnu-emacs

Hi Haines,

perhaps you can tell what program you want to load?

It will help us getting a more precise idea on how 
to help.

Best,

-- 
 Bastien



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

* Re: Simple question on loading programs in emacs
  2012-11-30 17:44 Simple question on loading programs in emacs Haines Brown
  2012-11-30 17:53 ` Bastien
@ 2012-11-30 18:54 ` Pascal J. Bourguignon
  2012-11-30 19:34 ` Jambunathan K
  2012-12-01  0:55 ` Barry Margolin
  3 siblings, 0 replies; 6+ messages in thread
From: Pascal J. Bourguignon @ 2012-11-30 18:54 UTC (permalink / raw)
  To: help-gnu-emacs

Haines Brown <haines@histomat.net> writes:

> A simple question, but I'm lost in the manual. I want to start a session
> of emacs that automatically loads an emacs program automatically instead
> of having to do M-x program during the emacs session. I want to do this
> because I have a custom emacs init file just for that emacs program.
>
> I tried (autoload 'program "ProgramName" t), but this only sets it in
> the environment. 

You can just call that program frmo your custom emacs init file:

----(program-init.el)-----
(program)
--------------------------

and run it with:

emacs -q -l program-init.el


> A related question: When I close that program within emacs, I want
> it to close the emacs session as well. 

What do you mean by "closing that program"?

You can call the (kill-emacs) function, but the question is where/when
to call it?


-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
A bad day in () is better than a good day in {}.


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

* Re: Simple question on loading programs in emacs
  2012-11-30 17:44 Simple question on loading programs in emacs Haines Brown
  2012-11-30 17:53 ` Bastien
  2012-11-30 18:54 ` Pascal J. Bourguignon
@ 2012-11-30 19:34 ` Jambunathan K
  2012-12-01  0:55 ` Barry Margolin
  3 siblings, 0 replies; 6+ messages in thread
From: Jambunathan K @ 2012-11-30 19:34 UTC (permalink / raw)
  To: Haines Brown; +Cc: help-gnu-emacs


Most of the emacs programs don't have a `main' function (as in C
programs).  First you load a file, then you run a command.

For a fun example, consider tetris.

,----
| First you load the file with
|    M-x load-library RET tetris RET
| 
| Then you run the tetris program with
|    M-x tetris TAB TAB (there are two tabs)
| 
| So now you know what all you could do.  If you click on tetris with a
| mouse the game will start.
| 
| Now you find that you are losing fast and you want to stop the game.  So
| again you do
|    M-x tetris TAB TAB 
| 
| You click on tetris-end-game and you are done.
`----

,----
| For another fun example, you can do
|     M-x butterfly RET
`----

,----
| Now you do 
|     M-x list-command-history RET
| 
| You will see what all you did.  You will see lines like 
| 
|     (tetris)
|     (tetris-end-game)
`----

,----
| For automatically running tetris, create a file with name .emacs in your
| home directory and copy paste the first line.
| 
|     (tetris)
| 
| and then start emacs normally.
`----

You are done.

Now you have to do
    C-h t

and read the manual.  

Haines Brown <haines@histomat.net> writes:

> A simple question, but I'm lost in the manual. I want to start a session
> of emacs that automatically loads an emacs program automatically instead
> of having to do M-x program during the emacs session. I want to do this
> because I have a custom emacs init file just for that emacs program.
>
> I tried (autoload 'program "ProgramName" t), but this only sets it in
> the environment. 
>
> A related question: When I close that program within emacs, I want
> it to close the emacs session as well. 
>
> Haines Brown
>

-- 



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

* Re: Simple question on loading programs in emacs
  2012-11-30 17:44 Simple question on loading programs in emacs Haines Brown
                   ` (2 preceding siblings ...)
  2012-11-30 19:34 ` Jambunathan K
@ 2012-12-01  0:55 ` Barry Margolin
  2012-12-01  9:44   ` Pascal J. Bourguignon
  3 siblings, 1 reply; 6+ messages in thread
From: Barry Margolin @ 2012-12-01  0:55 UTC (permalink / raw)
  To: help-gnu-emacs

In article <87lidjgf3v.fsf@engels.HistoricalMaterialism.info>,
 Haines Brown <haines@histomat.net> wrote:

> A simple question, but I'm lost in the manual. I want to start a session
> of emacs that automatically loads an emacs program automatically instead
> of having to do M-x program during the emacs session. I want to do this
> because I have a custom emacs init file just for that emacs program.
> 
> I tried (autoload 'program "ProgramName" t), but this only sets it in
> the environment. 
> 
> A related question: When I close that program within emacs, I want
> it to close the emacs session as well. 

Maybe Emacs Batch Mode is what you're looking for.  See

http://www.emacswiki.org/BatchMode

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***


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

* Re: Simple question on loading programs in emacs
  2012-12-01  0:55 ` Barry Margolin
@ 2012-12-01  9:44   ` Pascal J. Bourguignon
  0 siblings, 0 replies; 6+ messages in thread
From: Pascal J. Bourguignon @ 2012-12-01  9:44 UTC (permalink / raw)
  To: help-gnu-emacs

Barry Margolin <barmar@alum.mit.edu> writes:

> In article <87lidjgf3v.fsf@engels.HistoricalMaterialism.info>,
>  Haines Brown <haines@histomat.net> wrote:
>
>> A simple question, but I'm lost in the manual. I want to start a session
>> of emacs that automatically loads an emacs program automatically instead
>> of having to do M-x program during the emacs session. I want to do this
>> because I have a custom emacs init file just for that emacs program.
>> 
>> I tried (autoload 'program "ProgramName" t), but this only sets it in
>> the environment. 
>> 
>> A related question: When I close that program within emacs, I want
>> it to close the emacs session as well. 
>
> Maybe Emacs Batch Mode is what you're looking for.  See
>
> http://www.emacswiki.org/BatchMode

In batch mode you don't have a user interface.  Probably, the OP program
will have some user interface and interactivity, since "*I*" will close
it.

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
A bad day in () is better than a good day in {}.


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

end of thread, other threads:[~2012-12-01  9:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-30 17:44 Simple question on loading programs in emacs Haines Brown
2012-11-30 17:53 ` Bastien
2012-11-30 18:54 ` Pascal J. Bourguignon
2012-11-30 19:34 ` Jambunathan K
2012-12-01  0:55 ` Barry Margolin
2012-12-01  9:44   ` Pascal J. Bourguignon

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.