unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* loading specific .emacs file on command line?
@ 2003-02-13 21:20 john doe
  0 siblings, 0 replies; 5+ messages in thread
From: john doe @ 2003-02-13 21:20 UTC (permalink / raw)


Hopefully, someone can answer a couple of questions I
have--thanks in advance for anyone who responds.

Looking at the emacs man page I see there is a line
switch that allows you to use someone elses dotfile
when loading emacs:

emacs -u jdoe

Is there a line switch to load a specific .emacs
file... if you have more than one for the same user?
My problem is I have large sections of my .emacs file
that I want to use sometimes and not other times. Can
I have large sections of the .emacs file load only for
some files and not others?

Thanks.

__________________________________________________
Do you Yahoo!?
Yahoo! Shopping - Send Flowers for Valentine's Day
http://shopping.yahoo.com

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

* Re: loading specific .emacs file on command line?
       [not found] <mailman.1955.1045171264.21513.help-gnu-emacs@gnu.org>
@ 2003-02-13 21:36 ` Edward O'Connor
  2003-02-13 22:56 ` Kevin Rodgers
  1 sibling, 0 replies; 5+ messages in thread
From: Edward O'Connor @ 2003-02-13 21:36 UTC (permalink / raw)


> My problem is I have large sections of my .emacs file that I
> want to use sometimes and not other times. Can I have large
> sections of the .emacs file load only for some files and not
> others?

You could do something like this: say you want to be able to run
emase with a --foo switch, and you want certain things to happen
only when --foo is given on the command line. Something like this
in your .emacs file would do:

(when (member "--foo" command-line-args)
  ;; do
  ;; stuff
  ;; here
  (setq command-line-args (delete "--foo") command-line-args))


Ted

-- 
Edward O'Connor
oconnor@soe.ucsd.edu

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

* Re: loading specific .emacs file on command line?
       [not found] <mailman.1955.1045171264.21513.help-gnu-emacs@gnu.org>
  2003-02-13 21:36 ` loading specific .emacs file on command line? Edward O'Connor
@ 2003-02-13 22:56 ` Kevin Rodgers
  2003-02-14  6:59   ` Robert Marshall
  1 sibling, 1 reply; 5+ messages in thread
From: Kevin Rodgers @ 2003-02-13 22:56 UTC (permalink / raw)


john doe wrote:

> Is there a line switch to load a specific .emacs
> file... if you have more than one for the same user?
> My problem is I have large sections of my .emacs file
> that I want to use sometimes and not other times. Can
> I have large sections of the .emacs file load only for
> some files and not others?

You could break your .emacs file into multiple *.el files, byte-compile them
if you want, and either load them from your .emacs file:

(if foo
   (load-file "~/foo"))
(if bar
   (load-file "~/bar"))

or load them explicitly on the command line:

emacs
emacs -l ~/foo
emacs -l ~/bar
emacs -l ~/foo -l ~/bar

-- 
<a href="mailto:&lt;kevin.rodgers&#64;ihs.com&gt;">Kevin Rodgers</a>

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

* Re: loading specific .emacs file on command line?
  2003-02-13 22:56 ` Kevin Rodgers
@ 2003-02-14  6:59   ` Robert Marshall
  2003-02-14 18:05     ` Kevin Rodgers
  0 siblings, 1 reply; 5+ messages in thread
From: Robert Marshall @ 2003-02-14  6:59 UTC (permalink / raw)


On Thu, 13 Feb 2003, kevin.rodgers@ihs.com wrote:

> You could break your .emacs file into multiple *.el files,
> byte-compile them if you want, and either load them from your .emacs
> file:
> 
> (if foo
>    (load-file "~/foo"))
> (if bar
>    (load-file "~/bar"))
> 
> or load them explicitly on the command line:
> 
> emacs
> emacs -l ~/foo

Or for another approach - having broken up the emacs file I use the
name parameter on the command line and use the following defun

(defun rajm-get-emacs-class ()
  (let ((emacs-class
	 (cdr (assoc 'name initial-frame-alist))))
    (cond
     ((not emacs-class) 'full-class)
     ((string-equal "VM" emacs-class) 'vm-class)
     ((string-equal "rajm" emacs-class) 'full-class)
     ((string-equal "Root" emacs-class) 'root-class)
     ((string-equal "Gnus" emacs-class) 'fs-agent-class)
     ((string-equal "default" emacs-class) 'nil)
     (t 'remote-class))))
(defvar rajm-emacs-class (rajm-get-emacs-class))

And then load files in .emacs based upon rajm-emacs-class

Robert
-- 
Take me to the world
A world that smiles
With streets instead of aisles

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

* Re: loading specific .emacs file on command line?
  2003-02-14  6:59   ` Robert Marshall
@ 2003-02-14 18:05     ` Kevin Rodgers
  0 siblings, 0 replies; 5+ messages in thread
From: Kevin Rodgers @ 2003-02-14 18:05 UTC (permalink / raw)


Robert Marshall wrote:

> Or for another approach - having broken up the emacs file I use the
> name parameter on the command line and use the following defun
> 
> (defun rajm-get-emacs-class ()
>   (let ((emacs-class
> 	 (cdr (assoc 'name initial-frame-alist))))
>     (cond
>      ((not emacs-class) 'full-class)
>      ((string-equal "VM" emacs-class) 'vm-class)
>      ((string-equal "rajm" emacs-class) 'full-class)
>      ((string-equal "Root" emacs-class) 'root-class)
>      ((string-equal "Gnus" emacs-class) 'fs-agent-class)
>      ((string-equal "default" emacs-class) 'nil)
>      (t 'remote-class))))
> (defvar rajm-emacs-class (rajm-get-emacs-class))
> 
> And then load files in .emacs based upon rajm-emacs-class

Cool.  I use the -name vm option to differentiate an instance of
Emacs running VM from my normal editing session, via .Xdefaults:

Emacs*cursorColor:      blue
Emacs*pointerColor:     blue
vm*cursorColor: red
vm*pointerColor:        red

-- 
<a href="mailto:&lt;kevin.rodgers&#64;ihs.com&gt;">Kevin Rodgers</a>

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

end of thread, other threads:[~2003-02-14 18:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.1955.1045171264.21513.help-gnu-emacs@gnu.org>
2003-02-13 21:36 ` loading specific .emacs file on command line? Edward O'Connor
2003-02-13 22:56 ` Kevin Rodgers
2003-02-14  6:59   ` Robert Marshall
2003-02-14 18:05     ` Kevin Rodgers
2003-02-13 21:20 john doe

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).