jed-users mailing list

[2004 Date Index] [2004 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

Re: Hi + Questions


first last <prelude_2_murder@xxxxxxxxxxx> wrote:
>I use Emacs mode all the time.
>
>-Is it any way of mapping ^X-^D to "change working directory", just 
>like emacs?

According to a local emacs (21.2.1) installation here, ^X^D is bound
to the function list-directory, which displays a list of files for a
specified directory.  If it is this function that you want, then I
believe that the following function should work:

define list_directory ()
{
   variable pat = read_file_from_mini ("list directory");
   !if (strlen (pat))
     return;
   variable dir = path_dirname (pat);
   pat = path_basename (pat);
   !if (strlen(pat))
     pat = "*";

   if (file_status (dir) != 2)
     verror ("%s is not a directory", dir);

   variable files = listdir (dir);
   if (files == NULL) files = String_Type[0];

   pat = glob_to_regexp (pat);
   files = files[where(array_map (Int_Type, &string_match, files, pat, 1))];
   files = files[array_sort(files)];

   variable cbuf = whatbuf ();
   pop2buf ("*directory*");
   variable file, buf, flags;
   (file,,buf,flags) = getbuf_info ();
   setbuf_info (file, dir, buf, flags);

   erase_buffer ();
   if (length (files))
     {
	array_map (Void_Type, &vinsert, "%s\n", files);
	buffer_format_in_columns ();
     }
   bob ();
   vinsert ("Directory %s\n", dir);
   bob ();
   set_buffer_modified_flag (0);
   pop2buf (cbuf);
}

Note that this function uses glob_to_regexp, which is private to
jed/lib/misc.sl.  In the next jed release, glob_to_regexp will be
publically available.  For now, either change its "linkage" from
static to public, or copy it out of misc.sl.

Thanks,
--John

--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.


[2004 date index] [2004 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]