Subject: bug#8439: [PATCH] ffap.el -- detect paths with spaces (v2)

From: "Andrew W. Nosenko" <[email-masked]>
Date: Sat, 20 Oct 2012 00:47:55 +0300

On Fri, Oct 19, 2012 at 12:49 PM, Eli Zaretskii <[email-masked]> wrote:
>> From: Jari Aalto <[email-masked]>
>> Date: Fri, 19 Oct 2012 10:39:36 +0300
>> Cc: Yigal Hochberg <[email-masked]>
>>
>>
>> With some more field testing, the following patch works better.
>>
>>   1. New variable ffap-paths-with-spaces controls if the behavior is in use.
>>      By default it is set to "t" in Windows/Cygwin where spaces in paths
>>      are encountered.
>
> GNU Coding Standards frown upon using "path" for anything except
> PATH-style lists of directories.  Use "file name" or "leading
> directories" instead.
>
>>   2. The "path skipping" is based on finding longest distance:
>>
>>      - from first "drive letter", "/" or "\"
>>      - until last "/", "\" followed by last non-matching-char-not-usually-found-in-file-names
>
> What will this do to text such as the one below?
>
>  C:\emacs\bin\prog1.exe on Windows or /usr/bin/prog1 on Unix.

Eli, excuse me very much, but you cheating.  Even under Unix (where
spaces inside filenames are very unusual) people instinctively trying
heavy to distinguish/decorate them from outside/descriptive text.  The
only one problem that there no consensus about how to do it.  What
characters pair to use? <>? ""? ''?  But anyway just separate filename
with possible spaces just by spaces...  It's out of my ability to
imagine.  Therefore, I would to discard this example as rare.  After
all, any heuristic have his own false positives (and it is the reason,
why I said "cheating": for every heuristic it's always possible to
imagine a situation/input data when heuristic will fail).

But, if there no way to make false positives amount small enough, I
would to propose an idea for extension: find-file-at-region().  You
just select a region of text, and Emacs tries to interprets it as
default value for find-file().

>
>>   3. In Cygwin Emacs the paths are expected to be in "/cygdrive/<letter>/"
>>      format.
>
> What about Posix-standard /foo/bar/baz, which is the usual case on
> Cygwin?
>
>
>

-- 
Andrew W. Nosenko <[email-masked]>