1

Is it possible to have only certain plugins run when first starting emacs?

Let's say I develop in Python and also in Ruby. So I want to have one emacs instance running with Python plugins and another running Ruby plugins.

What I'm imagining is I can call rb-emacs or py-emacs from the command line.

So I think part of my solution lies here

http://stackoverflow.com/questions/2112256/emacs-custom-command-line-argument

And then I can alias the emacs call with the custom switches to one of the above

But then, how can I associate a specific plugin with a specific switch? Am I on the right track with this? Or should I be doing something else entirely?

Edit: Since my problem does not seem to be clear, I'll try to reiterate here. I'm not worried about long loading times. I'm worried about potential conflicts between plugins. I've used emacs before but only on a basic scale. Now I'd like to go more in depth with plugins. Though I don't fully understand how the plugins work.

Say I have a plugin (or two or three, I don't know how many it might be) for each language I code in. Won't those conflict with each other? Also, I don't want views / windows that are unneeded for that particular language.

Merlin -they-them-
  • 2,731
  • 3
  • 22
  • 39
  • 2
    Anything's possible in Emacs, but in general (i.e. given sensibly-written libraries) there's no conflict between libraries intended to handle mutually-exclusive tasks (e.g. editing ruby code vs editing python code). I think you're imagining problems which don't exist. – phils Nov 06 '13 at 05:12
  • 1
    But even if you decide you wish to run separate instances of Emacs for each project (not an unreasonable thing to do), there's generally no need to maintain separate configurations. You can just start each Emacs instance with identical configs, and have each one do the appropriate things for the files you load. – phils Nov 06 '13 at 05:16

2 Answers2

2

You'll just need a different init file for each of your Emacs instances. Then you can create shell aliases for opening Emacs with those init files.

From the Emacs Wiki:

Start Emacs with a specific init file: emacs -q -l ~/my-init-file.el

Then you'll just set up a shell alias like:

alias rb-emacs=emacs -q -l ~/.rb-emacs-init.el

But why do this with separate Emacs processes? If you're concerned about the startup time, you can use lazy loading of packages or Emacs Server with Emacsclient.

Zach
  • 1,263
  • 11
  • 25
  • I'm not worried about startup time. I just don't want one plugin conflicting with another. Though now that I think of it, are plugins set to be called depending on file type? Or how does that work? – Merlin -they-them- Nov 06 '13 at 04:35
  • Yes, you can set which packages are loaded based on the file extension. I'd highly recommend using [el-get](https://github.com/dimitri/el-get) which will usually set things up in a sane way automatically. You can check out my Emacs setup with el-get on [Github](https://github.com/zwass/portable-emacs-config). – Zach Nov 06 '13 at 04:43
1

I'm voting for "doing something else entirely", but I'm not 100% sure what the problem you're trying to solve is.

In general you can use mode hooks, eval-after-load, and autoload to ensure that you only load a particular elisp library when it is required.

If your problem is that you're forcibly loading everything and it takes too long, then you need to change your code so that you only load things when necessary. See OptimizingEmacsStartup.

If your problem is that you are setting global values for variables that need to have different values for different projects, then you want to be using buffer-local values for them, either via mode hooks, or using directory local variables.

What is the problem you're trying to solve?

phils
  • 71,335
  • 11
  • 153
  • 198