New to Nedit/HPUX

Tony Balinski ajbj at free.fr
Wed Nov 15 14:54:23 CET 2006


Quoting Joachim Lous <joachim at lous.org>:

> On 11/14/06, Maynard, David P <david.p.maynard at boeing.com> wrote:
> > I can not figure out how
> > to make the HP-UX File Manager use Nedit as its default editor (so that
> > double-clicking on a file name with the appropriate extension in a File
> > manager window launches Nedit).  Hopefully this is possible but, if so,
> > how is it done ?
>
> It's been too many years since I played with CDE (on HP-UX, even) for
> me to remember how to do this, but if it helps at all, I can confirm
> that it is definitely possible.  IIRC there are a very few settings
> like this you can be configure interactively in the desktop app, but
> for most things, especially mapping to apps that don't come with CDE
> you need to dig into the config subdir in your home dir, and edit or
> even create small text configuration files. Once you find the right
> place you can even add several actions to appear on the context menu,
> one of them being the default.
>
> I'd google for CDE file association or something.

CDE's configuration is a bit tricky, but worth getting to know. It's
been some time since I've used it too,but I held on to a number of files
I used in the past.

There are a number of things to set up, mainly involved with your
$HOME/.dt subdirectory. The most important is to create an action for
nedit. I created one called "ned" which tries to find, then invoke a
script called .ned. If no .ned is found, a relevant invocation of the
nedit client nc command is made.

The action file is ned.dt, and it should live in $HOME/.dt/types/ -
you also need a dummy file in $HOME/.dt/types/ActionTools/ with the
action's name, which must be executable:

    touch $HOME/.dt/types/ActionTools/ned;     : to create it
    chmod 700 $HOME/.dt/types/ActionTools/ned; : to set executable etc

If you've created other actions interactively (from the desktop front
panel), use the permissions that the other files in the ActionTools
directory have.

You can pick up my ned.dt file here:
  http://ajbj.free.fr/nedit/nedit-scripts/INTERESTING/,dt/types/ned.dt
Copy it to $HOME/.dt/types/

My .ned script is here:
  http://ajbj.free.fr/nedit/nedit-scripts/INTERESTING/,ned
Copy it to $HOME/.ned (note the comma should be replaced with a period)
and make sure it's executable.

The action has associated icons, all with the root name nedit. These
should be placed in your $HOME/.dt/icons/ directory (create it if
necessary), with names
  nedit.l.pm (large)
  nedit.m.pm (medium)
  nedit.t.pm (tiny)
  nedit.s.pm (small - a copy of tiny will do; not sure if it's needed)

I created such icon files: you can find them referenced here (thanks
for keeping these, Joor):
  http://www.geo.uu.nl/~loohuis/prog/nedit.html
The actual URLs are
  http://www.geo.uu.nl/~loohuis/prog/nedit_l_pm.xpm
  http://www.geo.uu.nl/~loohuis/prog/nedit_m_pm.xpm
  http://www.geo.uu.nl/~loohuis/prog/nedit_t_pm.xpm

Right: now you have an action and perhaps a script it can call, and
all the icons. Restart your CDE (from the root window/background
context menu you should see something to do this; or log out and in
again). On your front panel, you should be able to open a ActionTools
window, showing your actions. Use the ned action (it might be called
"Run NEdit (server mode)") to create a front panel drop-zone. (I think
you just drag the action icon to the front panel, IIRC - check the
help information on setting up your front panel.)

You now need to associate this action with the File Open or Edit
action for files in the dtfile file manager application. To do this,
copy the system's user-prefs.dt file (this can be found somewhere in
the /usr/dt directory tree) to $HOME/.dt/types/, then edit it. Look
for blocks starting "ACTION TextEditor" or "ACTION EditText". If you
find them, change them to:

    ACTION EditText
    {
        TYPE        MAP
        MAP_ACTION  TextEditor
    }
    ACTION TextEditor
    {
        TYPE        MAP
        MAP_ACTION  NEdit
    }

And add:
    ACTION NEdit
    {
        TYPE        MAP
        MAP_ACTION  ned
    }

This will make your file manager use the ned action when it wants to
use a text editor to open or edit a file (the default editor is
dtpad).

A few extra notes:-

The .ned script sets up a nedit server whose name is a mangled version
of the current directory name, so that you get a separate nedit
session for each directory from which you opened files with CDE, but
if you open more files using the action in that directory, they'll be
opened in the same session.

It searches the current directory and its parents until a .nedit
(or .nedit-dark - see below) directory is found, and uses that as the
NEDIT_HOME directory for NEdit's configuration; if not found, it'll
use \HOME/.nedit.

It also uses an env-var NEDIT_COLORS to see what sort of colors to use
for text backgrounds and backlighting; if you have a .nedit-dark
directory and NEDIT_COLORS contains the string "dark", it will use
that instead of the usual NEDIT_HOME, allowing separate configuration
of light text on dark backgrounds.

The ned action searches for a .ned script in the same way it searches
for .nedit/ (in current directory of the file(s), the parent
directories, then the home directory). This allows customisation of
the NEdit command on a per-directory(-tree) basis. If none is found,
nc is used.

The ned action can be invoked without arguments, starting a nedit
session (using .ned, or failing that, nc) in the home directory. If it has
arguments (you've dragged
files to the action button, or you've invoked the action for a file),
it will behave as follows:
  - a single directory argument sets the current directory to that
    directory before invoking .ned or nc there
  - two directory arguments cause the current directory to be set
    to their common root, and .ned or nc is invoked there with
    arguments to execute a recursive diff in a new nedit window
  - otherwise, if the first argument seen is a file, its directory
    is used as the current directory, and the file path all other
    arguments (files or directories typically) added to the command
    line as file arguments

Good luck!

Tony



More information about the Discuss mailing list