all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* how to exit "early" from eg .emacs?
@ 2005-01-15  5:06 David Combs
  2005-01-15 11:11 ` Eli Zaretskii
       [not found] ` <mailman.13285.1105788672.27204.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 8+ messages in thread
From: David Combs @ 2005-01-15  5:06 UTC (permalink / raw)




Suppose I'm having a problem with eg narrow-to-region,
but the problem occurs (if and) only if .emacs has been
read in.

I'd like to instrument my .emacs such that every so often
it asks "abort reading .emacs now?", and if I answer yes,
it does -- and leaves me in emacs, where I can try narrowing,
and see if it works or not.

... and eventually discover just where in .emacs my problem-code is.

(for efficiency, choosing where to say "no" a-la-bisection.)

   <some elisp code>

	(if (y-or-n-p "STOP processing this .emacs file -- NOW?")
	    (progn
	        (WHAT-DO-I-PUT-HERE?)))

   <some more elisp code>

	(if (y-or-n-p "STOP processing this .emacs file -- NOW?")
	    (progn
	        (WHAT-DO-I-PUT-HERE?)))

   <yet more elisp code>


	(if (y-or-n-p "STOP processing this .emacs file -- NOW?")
	    (progn
	        (WHAT-DO-I-PUT-HERE?)))

So, what *do* I put here   ^^^^^^  ?

(Again, I don;'t want to exit emacs; I merely want to
  make emacs think it's come to the eof of .emacs.)

-------

I suppose one thing I can do is wrap the whole insides of .emacs
 (after the final defun -- aren't they required to be top-level?)
 and use some kind of elisp "return from defun", or something?

(But I'd *much* rather simply fool emacs into thinking it's seen the eof.)



Thanks,

David

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

* Re: how to exit "early" from eg .emacs?
  2005-01-15  5:06 how to exit "early" from eg .emacs? David Combs
@ 2005-01-15 11:11 ` Eli Zaretskii
       [not found] ` <mailman.13285.1105788672.27204.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 8+ messages in thread
From: Eli Zaretskii @ 2005-01-15 11:11 UTC (permalink / raw)


> From: dkcombs@panix.com (David Combs)
> Date: 15 Jan 2005 00:06:13 -0500
> 
> Suppose I'm having a problem with eg narrow-to-region,
> but the problem occurs (if and) only if .emacs has been
> read in.
> 
> I'd like to instrument my .emacs such that every so often
> it asks "abort reading .emacs now?", and if I answer yes,
> it does -- and leaves me in emacs, where I can try narrowing,
> and see if it works or not.
> 
> ... and eventually discover just where in .emacs my problem-code is.

Not exactly what you wanted, but perhaps a solution after all: Invoke
Emacs with the -q switch, then visit your .emacs, and manually
evaluate its contents, either with eval-region or with "C-x C-e" (for
a single expression).  After each evaluation, see whether the
offending problem appears, and draw the conclusions as appropriate.

Does this work?

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

* Re: how to exit "early" from eg .emacs?
       [not found] ` <mailman.13285.1105788672.27204.help-gnu-emacs@gnu.org>
@ 2005-01-15 15:15   ` drkm
  2005-01-15 22:46     ` David Combs
  0 siblings, 1 reply; 8+ messages in thread
From: drkm @ 2005-01-15 15:15 UTC (permalink / raw)


"Eli Zaretskii" <eliz@gnu.org> writes:

>> ... and eventually discover just where in .emacs my problem-code is.

> Not exactly what you wanted, but perhaps a solution after all: Invoke
> Emacs with the -q switch, then visit your .emacs, and manually
> evaluate its contents, either with eval-region or with "C-x C-e" (for
> a single expression).  After each evaluation, see whether the
> offending problem appears, and draw the conclusions as appropriate.

  And with `C-x (', `C-M-f', `C-x )' and `C-x e', you just have to
press `e e e e e e ...' to discover the sexp where is the problem.

--drkm

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

* Re: how to exit "early" from eg .emacs?
  2005-01-15 15:15   ` drkm
@ 2005-01-15 22:46     ` David Combs
  2005-01-16  0:19       ` Johan Bockgård
  2005-01-16  0:49       ` drkm
  0 siblings, 2 replies; 8+ messages in thread
From: David Combs @ 2005-01-15 22:46 UTC (permalink / raw)


In article <wk3bx27mft.fsf@fgeorges.org>, drkm  <usenet@fgeorges.org> wrote:
>"Eli Zaretskii" <eliz@gnu.org> writes:
>
>>> ... and eventually discover just where in .emacs my problem-code is.
>
>> Not exactly what you wanted, but perhaps a solution after all: Invoke
>> Emacs with the -q switch, then visit your .emacs, and manually
>> evaluate its contents, either with eval-region or with "C-x C-e" (for
>> a single expression).  After each evaluation, see whether the
>> offending problem appears, and draw the conclusions as appropriate.
>
>  And with `C-x (', `C-M-f', `C-x )' and `C-x e', you just have to
>press `e e e e e e ...' to discover the sexp where is the problem.
>
>--drkm


>> ... and eventually discover just where in .emacs my problem-code is.

|   Not exactly what you wanted, but perhaps a solution after all: Invoke
|   Emacs with the -q switch, then visit your .emacs, and manually
|   evaluate its contents, either with eval-region or with "C-x C-e" (for
|   a single expression).  After each evaluation, see whether the
|   offending problem appears, and draw the conclusions as appropriate.
|   
|   Does this work?



Looks like it should -- I'll sure give it a try!

And that e e e e thing -- what, he's assigning that macro
to the e-key?  (Otherwise you'd have to hit C-x e each time?
Or am I simply confused?)

|   ESC C-f runs the command forward-sexp
|      which is an interactive compiled Lisp function in `emacs-lisp/lisp'.
|   (forward-sexp &optional ARG)
|   
|   Move forward across one balanced expression (sexp).
|   With ARG, do it that many times.  Negative arg -N means
|   move backward across N balanced expressions.

Oh, that's cool!



Thanks to both,

David

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

* Re: how to exit "early" from eg .emacs?
  2005-01-15 22:46     ` David Combs
@ 2005-01-16  0:19       ` Johan Bockgård
  2005-01-16 10:57         ` Romain Francoise
  2005-01-16  0:49       ` drkm
  1 sibling, 1 reply; 8+ messages in thread
From: Johan Bockgård @ 2005-01-16  0:19 UTC (permalink / raw)


dkcombs@panix.com (David Combs) writes:

> And that e e e e thing -- what, he's assigning that macro
> to the e-key?  (Otherwise you'd have to hit C-x e each time?
> Or am I simply confused?)

In the CVS version of Emacs you can repeat a macro with a single `e'
after the initial `C-x e'.

-- 
Johan Bockgård

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

* Re: how to exit "early" from eg .emacs?
  2005-01-15 22:46     ` David Combs
  2005-01-16  0:19       ` Johan Bockgård
@ 2005-01-16  0:49       ` drkm
  1 sibling, 0 replies; 8+ messages in thread
From: drkm @ 2005-01-16  0:49 UTC (permalink / raw)


dkcombs@panix.com (David Combs) writes:

> And that e e e e thing -- what, he's assigning that macro
> to the e-key?  (Otherwise you'd have to hit C-x e each time?
> Or am I simply confused?)

  Hum, maybe it's a feature introduced since the last release?  When
you call the macro with `C-x e', Emacs give you the chance, after the
call, to type just `e' to repeat the macro.  Fine, it isn't?

  So the idea, here, is to start Emacs with the -q flag, and open
.emacs.  Go at the and of the first sexp, and then, something like
this:

    C-x (
    C-x C-e                                         ; eval last sexp
    M-x the-thing-I-want-to-see-if-it-fail          ; test
    M-x the-thing-maybe-I-have-to-do-to-go-to-.emacs-buffer
    C-M-f                                           ; go to next sexp
    C-x )

  After that, you press once `C-x e', and then, you leave your finger
on the `e' key until the thing you want to test fails.

--drkm

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

* Re: how to exit "early" from eg .emacs?
  2005-01-16  0:19       ` Johan Bockgård
@ 2005-01-16 10:57         ` Romain Francoise
  2005-01-16 15:03           ` drkm
  0 siblings, 1 reply; 8+ messages in thread
From: Romain Francoise @ 2005-01-16 10:57 UTC (permalink / raw)


bojohan+news@dd.chalmers.se (Johan Bockgård) writes:

> In the CVS version of Emacs you can repeat a macro with a single `e'
> after the initial `C-x e'.

The `apply-macro-to-region-lines' function is often much more efficient
(provided the macro is line-oriented), and exists in earlier Emacs
releases.

-- 
Romain Francoise <romain@orebokech.com> | I'm going out for a little
it's a miracle -- http://orebokech.com/ | drive, and it may be the last
                                        | time you see me alive.

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

* Re: how to exit "early" from eg .emacs?
  2005-01-16 10:57         ` Romain Francoise
@ 2005-01-16 15:03           ` drkm
  0 siblings, 0 replies; 8+ messages in thread
From: drkm @ 2005-01-16 15:03 UTC (permalink / raw)


Romain Francoise <romain@orebokech.com> writes:

> bojohan+news@dd.chalmers.se (Johan Bockgård) writes:

>> In the CVS version of Emacs you can repeat a macro with a single `e'
>> after the initial `C-x e'.

> The `apply-macro-to-region-lines' function is often much more efficient
> (provided the macro is line-oriented), and exists in earlier Emacs
> releases.

  But the goal, here, is to execute a test after evaluating each
top-level sexp (each "defun") of the .emacs file, until the test
fails.  I don't think `apply-macro-to-region-lines' is of help, in
this case.

--drkm

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

end of thread, other threads:[~2005-01-16 15:03 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-15  5:06 how to exit "early" from eg .emacs? David Combs
2005-01-15 11:11 ` Eli Zaretskii
     [not found] ` <mailman.13285.1105788672.27204.help-gnu-emacs@gnu.org>
2005-01-15 15:15   ` drkm
2005-01-15 22:46     ` David Combs
2005-01-16  0:19       ` Johan Bockgård
2005-01-16 10:57         ` Romain Francoise
2005-01-16 15:03           ` drkm
2005-01-16  0:49       ` drkm

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.