I have seen a few suggestions on making emacs portable (on Windows). I have this in my site-start.el:
(defvar program-dir (substring data-directory 0 -4))
(setq inhibit-startup-message t)
(setenv "HOME" program-dir)
I changed the HOME variable so that not only my .emacs init files (and other init files) are read, but everything generated by emacs will stay in the program directory, not needing me to specify the path for everything one by one.
Well this works well but the emacs server is not working; I get error message "no connection could be made because target machine actively refused it." If I don't change my HOME var then emacs server works. Is there way to fix this?
Quoth the Emacs manual:
When you start the Emacs server (by calling server-start), Emacs creates a file with information about TCP connection to the server: the host where Emacs is running, the port where it is listening, and an authentication string. emacsclient uses this information if it needs to connect to the server via TCP. By default, the file goes in the ~/.emacs.d/server/ directory. You can specify the file name to use with the `-f file' or `--server-file=file' options, or by setting EMACS_SERVER_FILE environment variable to the file name.
In other words: wherever you're calling emacsclient from, you'll have to tell it to use the file in ${program-dir}/.emacs.d/server/, either with -f or setting the EMACS_SERVER_FILE environment variable. (In the environment in which you're starting emacsclient, not within Emacs.)
[You could also tell Emacsclient to look in the right place with -s for "socket", but that doesn't work on Windows. And on Unixes (at least on Mac OS X with Aquamacs) the socket would be somewhere like /tmp/emacs501/server (501 is my UID).]
[Oh, BTW, take a look at this question: How can I have a portable Emacs? Maybe something will help you, or maybe you have something to add to it :-)]
There is an initial packaging of a Portable Apps version of emacs 23.2 here. Initial test works here.
Related
I am using TRAMP to work on a remote host that has a very weird PATH. I was wondering whether it was possible to customize the PATH used by TRAMP to find the binary files only for this host?
Now, I'm using:
(add-to-list 'tramp-remote-path "/some/weird/path/bin")
but it also applies to any other host without this funky PATH, thus messing up all the other hosts' PATHs.
I'm sorry, but this is not possible yet. There is an item on Tramp's todo list for supporting connection-local variables, but this is not implemented yet.
Alternatively, you might set this in the $PATH env variable in your remote .profile. Then you instruct Tramp to use this, by adding tramp-own-remote-path to tramp-remote-path.
The system bus works fine
(dbus-init-bus :system)
returns nil, as it should.
However, connection to the session bus
(dbus-init-bus :session)
raises
(dbus-error "No connection to bus" :session)
qdbus in the command line works just fine with both buses. It even
works from within eshell, if that is of any concern.
Neither emacs nor emacs --daemon connect.
Which version of Emacs are you using? One version (before 2012-05-25) only looks for the DBUS_SESSION_BUS_ADDRESS environment variable, while a more recent one uses a library function that also looks in ~/.dbus/session-bus I think.
Did you try this before running emacs:
eval $(dbus-launch)
export DBUS_SESSION_BUS_ADDRESS
I have a large repository of C++ code on a remote cluster (linux OS). When I need to work on this code from my home computer (Ubuntu OS), I try to access these codes through emacs on X windows. However the X window connection is very slow making the editing a painful process. So I sometimes move files manually between my local drive and remote cluster to edit the files. My question is: is there a way to configure my local emacs, such that when I edit the file in my local space, it would automatically be backed up in the cluster where it can then be compiled?
UPDATE:1
I installed TRAMP and it works well for servers that can be connected directly. However I also have servers which can be connected only when I activate VPN. How to provide the VPN information to TRAMP to connect to this server?
The other question I had was how to stop the TRAMP when it waits for prompts from remote shell without having to kill the whole emacs buffer.
This is typically a use case where TRAMP would be useful.
Instead of connecting to the server using SSH and opening Emacs there with X forwarding, run Emacs on your box and open your files remotely using TRAMP. For example:
C-xC-f/ssh:user#host:/remote/path/to/the/fileRET
This way, your Emacs process runs locally, but all file operations (e.g. save, revert, ...) are forwarded to the server, and all shell commands issued from TRAMP buffers also run on the remote server (this includes M-x compile)
UPDATE:1
When TRAMP hangs waiting for a remote shell prompt (which tends to happen frequently for reasons which are still obscure to me), I usually kill the underlying ssh process (htop with tree-like view is a good tool to do this) . TRAMP notices this and automatically respawns the killed process to resume operations.
Wouldn't it be easier to run Emacs in a console on the remote server? All Emacs functions can be access via the keyboard and once you get used to the key combinations it usually works out faster.
That way you will be running faster than forwarding an X session - running in a console is what Emacs was designed for.
As an added bonus - if you get used to using Gnu screen - http://www.gnu.org/software/screen/ you can pick up your sessions exactly as they were if the connection drops. In fact with screen you can shutdown your laptop at the end of the day - login over SSH the next day and pick up all your 'screens' exactly as they were the day before. This will include any open editors, debug sessions etc.
Gnu screen is available as a package on Debian and probably most Linux distributions.
I want to redirect my swank server output to an emacs buffer. I put this in ~/.swank.lisp, but this does not work-
(setf swank:*globally-redirect-io* t)
Im using Clojure box.
Thanks.
If you're using clojure-jack-in, the output of the swank server will appear in a buffer named *swank* (So you can see it with C-x b *swank*)
I you aren't using clojure-jack-in, you can still get the same effect by starting your swank server within emacs. Here's how I start mine:
(start-file-process "swank-process" "*swank*" "lein" "swank")
This starts up a swank server, and pushes all of the output into a buffer named *swank* (just like clojure-jack-in does.)
Have you looked at elein? It will allow you to start the swank server right within emacs. See the elein-swank emacs buffer to see the server output.
This page from the Emacs manual describes a function called make-frame-on-display that allows you to access a remote Emacs session. My interest in this function is to use it to share buffers for pair programming remotely with a colleague.
From the page:
It is even possible to use this feature to let two or more users type simultaneously on the two displays, within the same Emacs job. In practice, however, the different users can easily interfere with each others' edits if they are not careful.
How exactly do I set this up? What do I need? What does my partner need? The details are not stated, but I don't know enough about Emacs to know where to start.
Is there any other way to get a shared Emacs session? This page from the Emacs Wiki refers to something called multi-tty. The questions I asked above also apply to this.
Which is better: multi-tty or make-frame-on-display?
I haven't tried multi-tty, but make-frame-on-display is pretty simple. You type M-x make-frame-on-display, hit return, then type the display you want the frame to show up on. For example:
I have my local host (thor) running emacs and I want to make a frame pop up on a machine called zeus, on its only X display (0.0). So I would type M-x make-frame-on-display<ret>zeus:0.0<ret>
All set!
You may need to configure the remote machine's X server to accept incoming connections from your machine with "xhost +thor". You may also need to configure its firewall to allow incoming connections on the X11 port, which is 6000. Keep in mind that X forwarding is not encrypted, so if you aren't working with someone on your LAN you may want to go through a VPN in order to keep things private.
Edited to fix brackets.
You can also have the person at zeus type ssh -X thor emacsclient -c.
Did you ever consider using GNU screen on a shared account for pair programming? It's dead easy to get it to work and you get to pick any console based editor you and your partner like (emacs, vim, joe, nano, zile, ...). However, this does of course not work with editors that cannot run inside a terminal.
To set it up, create a shared account on a computer running ssh. Then both log in to that account. One of the partners starts screen with
screen
and the other connects to it with
screen -x
where -x means "attach to a not detached screen session". The users can detach from their sessions w/ "C-a d".
Old question, new solution for anyone landed on this page from year 2016.
I set this up in Ubuntu 14.04 and it works perfectly:
Suppose I want to co-edit or demo some cool stuffs on emacs with my colleague Joe on the other end of the world.
Make sure an ssh server with emacs installed at either end. That is, either MyPC or JoePC must be a SSH server and have Emacs installed. From now on, let's say I asked Joe to install SSH server and Emacs on his computer.
Make sure byobu is installed on JoePC. Byobu supports both tmux and screen as backends (I prefer tmux for a more mordern and feature-rich).
I connect to JoePC with ssh remoteuser#joepc. No need for X-forwarding.
Open emacs from byobu-ssh terminal: TERM=xterm-256color && emacsclient --alternate-editor="" -t. One can make an alias for this command. I recommend this long command because it enables both better color support in the terminal and running Emacs in daemon mode. The daemon mode make it fast to close and reopen frames.
Now the magic unfold: Ask Joe to login with the same remoteuser I am loggin in; open the terminal and start byobu if it hasn't for him.
Start hacking or fumbling :-)
Comment:
Because the way byobu work. This approach works for any other program inside the byobu terminal.
This setup performs much better than Teamviewer or any other GUI remote desktop solutions.
Because the connection is through ssh to the remote server directly, it is as secure as the ssh conenction can offer.