Netsight Blog

Cool stuff Netsight are up to in Zope and Plone

Blog > Archive for March 2008

If you want to search for something and replace it with a newline (or some text containing a newline), to enter a newline character into the "replace" box, use:

C-q C-j

I.e. Ctrl-q then Ctrl-j.

This is similar to the old favourites system in Plone, but using KSS to do it nicely on the client side:

http://kssproject.org/documentation/development-process-with-kss/development-process-with-kss

It creates link objects in the users home folder and sets the remote url of the link to be the page you are on. This might be improved by:

  1. Maybe not using link objects but storing in a registry somewhere... do we really want favourites to be content items?
  2. Maybe using UIDs rather than URLs so that things don't break when moved.

We should wrap this up and release as a Plone product

Emacs 'tramp' (remote file loading) is great, but what if you are in an ssh session and want to open a file without having to work out the full remote path you're in and type it into your local emacs?

Here's my magical solution:

location="/`whoami`@`hostname`:`pwd`/$2"
ssh $1 emacsclient $location --no-wait

Put the above two lines into a script (called emacs-remote or something) and save it on the remote server you want to work on (make sure its in the PATH or your home dir or somewhere easy to reference). Also make sure your local copy of emacs is in server mode (type Meta-x server-start, or put (server-start) in your .emacs file and reload)

Then you can do the following:

  1. Load up ssh to a remote server (ssh username@host)
  2. Navigate to a directory
  3. Type "/emacs-remote localusername@localmachine filetoopen.txt"

Where localusername@localmachine are your login to the machine which is running the emacs you want to use

Et voila - the remote file should load up in your chosen copy of emacs!! This works best if you have SSH ControlMaster setup to re-use your ssh connections, otherwise you'll need to type your remote password again into emacs before it can load the file.