1
votes

I often have several instances of Emacs open in different GNU screen windows. How can I give them separate histories for compilation, etc?

The problem is: When I do M-x compile in Emacs in one window and close it, then open another Emacs in another GNU screen window it will (naturally) have the same history, i.e., arrow-up gives me the compile command that I typed in the other window.

How can I set them to use separate command (etc.) histories in separate GNU screen windows?

1
I can't reproduce this behavior on my system (GNU Emacs 23.3.1, Debian flavor). Does it also happen when you disable your configuration file (e.g running emacs -q)?François Févotte
Are you sure these are separate Emacs instances? Multiple emacsclient instances are all connected to the same emacs server, so they will all share the same history, but multiple emacs instances will each have their own history.Tyler
I guess if these were emacsclient instances connected to the same server, they would not only share the command history, but also the *compilation* buffer, which the OP would surely have noticed as well...François Févotte
OK, I had simplified the description but it wasn't completely accurate that way. The question is really about GNU screen and Emacs, see updated question.Frank
Wether the two emacs instances are in GNU Screen windows or in xterm or whatever other terminal should not make any difference here. I do not understand why you say that these Emacs instances will naturally share the same history. Can you confirm that the two emacs instances are perfectly unrelated? (For example try to create a buffer named foo in one of them and see if it also exists in the other; it shouldn't). Also, can you run the same test with emacs -q?François Févotte

1 Answers

0
votes

compilation-mode's compile function uses the variable compile-history. Ordinarily this is not shared between different Emacs instances.

ie: if you:

  • go to one screen session and type emacs
  • and then type M-x compile
  • and then enter: "make nothing" as a compile command
  • and then go to another screen window and type emacs
  • and then type M-x compile
  • then "make nothing" will not be in the history.

If it IS then either:

  • history persistence has been enabled on that variable somehow, check the documentation of the variable to see
  • or the "emacs" command is really an emacsclient command

Having said all that you could STILL have different compile historys if you want by:

  • setting an env var in each screen session
  • passing the env var into the emacsclient session on the emacsclient command line, with -e say.
  • advising (defadvice) the compilation-read-command function to let bind a new compile-history list based on the passed in ENV VAR