jed-users mailing list

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

Re: [jed-users] using _for [was: Dired fails on directory or file names with spaces?]


Hi Tom,

just briefly about using _for:

>    variable i;
>    for (i = 0; i < 8; i++) {
>        skip_chars ("^ \t");
>        skip_white ();
>    }

should translate to:

>    variable i;
>    _for i (0, 7, 1) {
>        skip_chars ("^ \t");
>        skip_white ();
>    }

or since S-Lang version pre2.3.0-75:

>    variable i;
>    _for i (0, 7) {
>        skip_chars ("^ \t");
>        skip_white ();
>    }

or even more concise using loop:

>    loop(8) {
>        skip_chars ("^ \t");
>        skip_white ();
>    }

Cheers,

Manfred


On 15.08.2016 03:34, Tom Culliton wrote:
> Darn, not sure how I missed your reply John, but I was just messing
> around with this again after quite a while and came up with this for the
> Unix verison of dired_point:
> 
>    bol ();
>    if (looking_at_char ('D') or looking_at_char ('%')) go_right_1 ();
>    skip_white ();
>    variable i;
>    for (i = 0; i < 8; i++) {
>        skip_chars ("^ \t");
>        skip_white ();
>    }
> 
> Along with adding quoting of the directory name in the ls command (media
> files that use apostrophe in the name, sweet merciless Cthulhu!):
> 
> shell_cmd (sprintf ("ls -al '%s' 2>/dev/null", str_replace_all(dir, "'",
> "'\\''")));
> 
> It's not the most elegant solution but it seems to be working. I tried
> using a _for but it seemed to leave trash on the stack in some cases.
> 
> 
> On Sun, Apr 26, 2015 at 10:29 PM, John E. Davis <jed@xxxxxxxxxxx
> <mailto:jed@xxxxxxxxxxx>> wrote:
> 
>     Tom Culliton <tom.culliton@xxxxxxxxx
>     <mailto:tom.culliton@xxxxxxxxx>> wrote:
>     > The problem with the code in dired.sl <http://dired.sl> comes down to the following two lines
>     > at the end of dired_point:
>     >
>     >    eol ();
>     >    bskip_chars ("^ \n");
> 
>     Yes, that is correct.  I just pushed an update to the git repository
>     that avoids the use of ls and dir.  It also encodes any filenames that
>     contain spaces, newlines, etc.
> 
>     I have not tested it thoroughly, but it does seem to work on the tests
>     that I have performed.  I have not tested it at all on VMS/Windows,
>     and it may require some tweaks on those systems.
> 
>     Please consider it to be experimental.
> 
>     Thanks,
>     --John
> 
> 

_______________________________________________
For list information, visit <http://jedsoft.org/jed/mailinglists.html>.


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