* Is there a way to abort loading .el file on condition?
@ 2019-04-29 5:49 Jean Louis
2019-04-30 16:25 ` Tomas Nordin
0 siblings, 1 reply; 5+ messages in thread
From: Jean Louis @ 2019-04-29 5:49 UTC (permalink / raw)
To: help-gnu-emacs
Hello,
I would like to abort loading the .el file, the
~/.emacs file on the condition, in particular, I
have two versions of GNU Emacs, the standard one
25.3.1 which I would not like to read the .emacs
file and the one which I use for work, which
should read the ~/.emacs file.
Is there a way that a condition is inserted on top
of the ~/.emacs file so that based on the version
information the file loading gets aborted?
Such conditional statement should not enclose all
the statements in the file as for example
customization on the end would break or similar.
Jean
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Is there a way to abort loading .el file on condition?
2019-04-29 5:49 Is there a way to abort loading .el file on condition? Jean Louis
@ 2019-04-30 16:25 ` Tomas Nordin
2019-04-30 16:51 ` Noam Postavsky
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Tomas Nordin @ 2019-04-30 16:25 UTC (permalink / raw)
To: Jean Louis, help-gnu-emacs
Jean Louis <bugs@gnu.support> writes:
> Hello,
>
> I would like to abort loading the .el file, the
> ~/.emacs file on the condition, in particular, I
> have two versions of GNU Emacs, the standard one
> 25.3.1 which I would not like to read the .emacs
> file and the one which I use for work, which
> should read the ~/.emacs file.
>
> Is there a way that a condition is inserted on top
> of the ~/.emacs file so that based on the version
> information the file loading gets aborted?
There is "non-local exits", but it is supposed to be used in relation to
errors and wouldn't maybe feel right in this case.
What about having your .emacs basically empty with only a conditional
load of a .emacs-work.el or .emacs-gnu.el file based on the version of
Emacs reading the .emacs file?
Best regards
--
Tomas
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Is there a way to abort loading .el file on condition?
2019-04-30 16:25 ` Tomas Nordin
@ 2019-04-30 16:51 ` Noam Postavsky
2019-05-03 2:07 ` Emanuel Berg
2019-05-12 4:06 ` Jean Louis
2 siblings, 0 replies; 5+ messages in thread
From: Noam Postavsky @ 2019-04-30 16:51 UTC (permalink / raw)
To: Tomas Nordin; +Cc: Help Gnu Emacs mailing list, Jean Louis
On Tue, 30 Apr 2019 at 12:28, Tomas Nordin <tomasn@posteo.net> wrote:
>
> Jean Louis <bugs@gnu.support> writes:
> > I would like to abort loading the .el file, the
> > ~/.emacs file on the condition
> > Is there a way that a condition is inserted on top
> > of the ~/.emacs file so that based on the version
> > information the file loading gets aborted?
>
> There is "non-local exits", but it is supposed to be used in relation to
> errors and wouldn't maybe feel right in this case.
I call keyboard-quit for this of thing (I abort when the server is
already running, which usually indicates I forgot the '-Q' when trying
to run 'emacs -Q'), which signals `quit' (which is not a subtype of
error, so it doesn't trigger the "An error occurred while loading..."
thing).
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Is there a way to abort loading .el file on condition?
2019-04-30 16:25 ` Tomas Nordin
2019-04-30 16:51 ` Noam Postavsky
@ 2019-05-03 2:07 ` Emanuel Berg
2019-05-12 4:06 ` Jean Louis
2 siblings, 0 replies; 5+ messages in thread
From: Emanuel Berg @ 2019-05-03 2:07 UTC (permalink / raw)
To: help-gnu-emacs
Tomas Nordin wrote:
> What about having your .emacs basically empty
> with only a conditional load of
> a .emacs-work.el or .emacs-gnu.el file based
> on the version of Emacs reading the
> .emacs file?
Yes, have it all empty but for an `if' clause
to go to either file A or file B depending
on version.
Then put all other configuration/extensions in
neat files (a, b, c ... n)
In A, put A-specific stuff _only_ and then load
(a ... n) explicitly at your discretion.
In B, do the same, only have the B-specific
stuff there, as you understand of course.
Simple in theory and simple to setup in
practice! To deal with it in the long run when
you do changes to (a ... n) - perhaps not so
simple neither in theory nor practice... :(
--
underground experts united
http://user.it.uu.se/~embe8573
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Is there a way to abort loading .el file on condition?
2019-04-30 16:25 ` Tomas Nordin
2019-04-30 16:51 ` Noam Postavsky
2019-05-03 2:07 ` Emanuel Berg
@ 2019-05-12 4:06 ` Jean Louis
2 siblings, 0 replies; 5+ messages in thread
From: Jean Louis @ 2019-05-12 4:06 UTC (permalink / raw)
To: Tomas Nordin; +Cc: help-gnu-emacs
* Tomas Nordin <tomasn@posteo.net> [2019-04-30 18:25]:
> Jean Louis <bugs@gnu.support> writes:
>
> > Hello,
> >
> > I would like to abort loading the .el file, the
> > ~/.emacs file on the condition, in particular, I
> > have two versions of GNU Emacs, the standard one
> > 25.3.1 which I would not like to read the .emacs
> > file and the one which I use for work, which
> > should read the ~/.emacs file.
> >
> > Is there a way that a condition is inserted on top
> > of the ~/.emacs file so that based on the version
> > information the file loading gets aborted?
>
> There is "non-local exits", but it is supposed to be used in relation to
> errors and wouldn't maybe feel right in this case.
>
> What about having your .emacs basically empty with only a conditional
> load of a .emacs-work.el or .emacs-gnu.el file based on the version of
> Emacs reading the .emacs file?
That is good idea, thank you.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-05-12 4:06 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-29 5:49 Is there a way to abort loading .el file on condition? Jean Louis
2019-04-30 16:25 ` Tomas Nordin
2019-04-30 16:51 ` Noam Postavsky
2019-05-03 2:07 ` Emanuel Berg
2019-05-12 4:06 ` Jean Louis
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).