Re: [PATCH] dired mg patch

2011-08-29 Thread Henri Kemppainen
It fixes the issue that if a filename has a space at the start of it, the point will stay in the first character column and not jump to the first non ' ' character in the filename. Yup, this looks good to me. However, it does seem to expose a bug in dired, that if a filename has a space at

Re: [PATCH] dired mg patch

2011-08-29 Thread Henri Kemppainen
However, it does seem to expose a bug in dired, that if a filename has a space at the start of it, mg doesn't find it if you try and open it. mg gives a message of (New File) and creates and empty buffer. But in the mean time, I think this change does make this diff more correct.

Re: [PATCH} dired mg patch

2011-08-29 Thread Loganaden Velvindron
This fixes Nima's PR and mark's issue with filenames that start with a space. Index: src/usr.bin/mg/dired.c === RCS file: /cvs/src/usr.bin/mg/dired.c,v retrieving revision 1.48 diff -u -p -r1.48 dired.c --- src/usr.bin/mg/dired.c

Re: [PATCH] dired mg patch

2011-08-29 Thread Loganaden Velvindron
This diff works fine. Not using metacharacters and passing it as argv is the proper fix. Escaping shell metacharacters isn't the proper way. Warpdot() is also a little bit safer now. It addresses some of the issues I was a bit worried about. This should go in !

Re: [PATCH] dired mg patch

2011-08-29 Thread Henri Kemppainen
And here's that diff. [..] It never hurts to re-read a diff before going to bed. Indeed, I forgot to free argv (execlp uses alloca). The number of things to clean up after one thing fails is almost getting out of hand, and at least the fork() case wasn't handled properly. In this new

Re: [PATCH] dired mg patch

2011-08-29 Thread Loganaden Velvindron
The latest diff has no issues so far. I just added the error message in case execvp() fails. Index: src/usr.bin/mg/dired.c === RCS file: /cvs/src/usr.bin/mg/dired.c,v retrieving revision 1.49 diff -u -p -r1.49 dired.c ---

Re: [PATCH] dired mg patch

2011-08-28 Thread Loganaden Velvindron
On Sat, Aug 27, 2011 at 08:51:08PM +0300, Henri Kemppainen wrote: The warpdot() has at least one issue. It leads to segfaults if you try to open a directory like (BCD). [.. diff ..] ed mg doesn't segfault. Your fix is wrong, and only works by chance. If you craft a directory

Re: [PATCH] dired mg patch

2011-08-28 Thread Henri Kemppainen
The warpdot() has at least one issue. It leads to segfaults if you try to open a directory like (BCD). [.. diff ..] ed mg doesn't segfault. Your fix is wrong, and only works by chance. If you craft a directory with enough spaces in its name, it'll segfault again.

Re: [PATCH] dired mg patch

2011-08-28 Thread Mark Lumsden
This is a slightly modified diff from Henri's latest one. It fixes the issue that if a filename has a space at the start of it, the point will stay in the first character column and not jump to the first non ' ' character in the filename. However, it does seem to expose a bug in dired, that if

Re: [PATCH] dired mg patch

2011-08-27 Thread Mark Lumsden
Here is a modified diff, the changes revolve around the d_warpdot function. Logan has already tested this. Any other test's/oks? -lum Index: dired.c === RCS file: /cvs/src/usr.bin/mg/dired.c,v retrieving revision 1.48 diff -u -p

Re: [PATCH] dired mg patch

2011-08-27 Thread Henri Kemppainen
Logan has already tested this. Any other test's/oks? Is there a good reason to all those if/else blocks which call d_warpdot twice if it succeeds? I don't see one. At the very least, I'd remove the redundant call. But we can do better: just be sane and default to zero on error. In the long

Re: [PATCH] dired mg patch

2011-08-27 Thread Henri Kemppainen
In the long run, the error could be removed entirely by making dired behave like the rest of mg -- that is, abort somewhere up the stream if lalloc fails. This way the rest of the functions will never have to worry about a NULL ltext. Actually, this seems to be the case already. dired calls

Re: [PATCH] dired mg patch

2011-08-27 Thread Loganaden Velvindron
Both diffs you submitted work. However, there are some changes that I don't quite agree on. Assigning the value of a function directly to w_doto without checking the return value don't seem right to me. The idea of removing the error to behave like the rest of mg would lead to a brittle design.

Re: [PATCH] dired mg patch

2011-08-27 Thread Loganaden Velvindron
The warpdot() has at least one issue. It leads to segfaults if you try to open a directory like (BCD). Try mkdir \(BCD\) and then reading the contents of it. Here's what I get: drwxr-xr-x 2 root wheel 512 Aug 25 01:09 sh: syntax error: `(' unexpected-rw-r--r-- 1 root wheel 0

Re: [PATCH] dired mg patch

2011-08-27 Thread Henri Kemppainen
The idea of removing the error to behave like the rest of mg would lead to a brittle design. It's like assuming errors can only happen once. It makes code faster, but later changes could cause subtle bugs that could be hard to track IMHO. Quite the opposite, in

Re: [PATCH] dired mg patch

2011-08-27 Thread Henri Kemppainen
The warpdot() has at least one issue. It leads to segfaults if you try to open a directory like (BCD). New diff below. I wanted to make d_warpdot behave exactly like the rest of mg functions in that it'd take the two standard int (f, n) arguments, and dereference curwp-* to do its job. This

Re: [PATCH] dired mg patch

2011-08-26 Thread Loganaden Velvindron
Mark Lumsden contributed code that makes it faster. I use his suggestions as well for other sections of the diff. Index: dired.c === RCS file: /cvs/src/usr.bin/mg/dired.c,v retrieving revision 1.48 diff -u -p -r1.48 dired.c ---

Re: [PATCH] dired mg patch

2011-08-23 Thread Loganaden Velvindron
Hi, Jasper@ noticed warnings when compiling on -current. This should fix it. Index: dired.c === RCS file: /cvs/src/usr.bin/mg/dired.c,v retrieving revision 1.48 diff -u -p -r1.48 dired.c --- dired.c 23 Jan 2011 00:45:03 -

Re: [PATCH] dired mg patch

2011-08-19 Thread Jasper Lievisse Adriaanse
On Thu, Aug 18, 2011 at 08:30:02AM -0400, Loganaden Velvindron wrote: I used a function for warping the dot. This makes the diff simpler. Since kjell@ has slacked out; any objections to committing this revision of the diff? Index: dired.c

Re: [PATCH] dired mg patch

2011-08-19 Thread Loganaden Velvindron
The 2nd diff which was posted was tested by Nima Hoda. The 3rd diff is mostly a cosmetic change to make the diff less redundant. I contacted other mg users. Hopefull, they'll reply soon.