Author Topic: Quoting filenames when calling the edit command  (Read 5752 times)

Graeme

  • Senior Community Member
  • Posts: 2796
  • Hero Points: 347
Quoting filenames when calling the edit command
« on: October 06, 2006, 10:23:38 PM »

Hi

What are the rules for when filenames should be quoted when calling the edit command?

I've found that when using '+B' buffer_name (look in memory only for buffer_name), that using maybe_quote_filename on buffer_name results in edit failing to find the buffer if buffer_name has embedded spaces in it, whereas it works if the call to maybe_quote_filename is left off.  Whereas in bookmark.e at line 285, this call is done.

edit('+q 'maybe_quote_filename(filename))

Are there any rules for when filenames should be maybe_quoted in the call to edit (or load_files)?

Since I've got what I want working, there's no need for Slick staff to spend more than a minute answering this, unless it's thought worthwhile improving the docs for this.

Graeme

Graeme

  • Senior Community Member
  • Posts: 2796
  • Hero Points: 347
Re: Quoting filenames when calling the edit command
« Reply #1 on: October 09, 2006, 03:10:27 PM »

BTW - in tags.e function tag_edit_symbol, line 8339, there is

   status=edit('+b 'maybe_quote_filename(cm.file_name));

which I believe won't work if there are embedded spaces in the filename.  This might be a benign bug though because it is followed by another call to edit without the +b.

Graeme


Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6866
  • Hero Points: 528
Re: Quoting filenames when calling the edit command
« Reply #2 on: October 09, 2006, 03:48:00 PM »
Ok, I wrote the argument parsing to the edit command.  Always use quotes (call maybe_quote_filename) when passing a filename argument to the edit command except for the buffer name following the +b option.  Looks like you found a bug. I'll make sure it gets fixed.  The +b option allows invalid filenames to be specified. For example, "e +b .process" finds the process buffer.  Note that the ".process" buffer is not in absolute form (i.e. c:\abc\.process) and is not a valid filename.  The +b option allows double quote characters in the filename.