bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Jari Aalto
Subject: bug#8439: [PATCH] ffap.el -- detect paths with spaces (v2)
Date: Fri, 19 Oct 2012 10:39:36 +0300
User-agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.1 (gnu/linux)

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.

  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

  3. In Cygwin Emacs the paths are expected to be in "/cygdrive/<letter>/"
     format. This is handled as a last step.

Test by placing cursor anywhere of these path names and evaluating with
"M-:" the lisp code "(ffap-string-at-point)" over them:

  ;; c:/Program Files/Open Text Evaluation Media/Open Text Exceed 14 
x86/Program here.txt
  ;; c:/Program Files/Open Text Evaluation Media/Open Text Exceed 14 
x86/Program Files/Hummingbird/
  ;; c:\Program Files\Freescale\CW for MPC55xx and MPC56xx 
2.10\PowerPC_EABI_Tools\Command_Line_Tools\CLT_Usage_Notes.txt

It is not possible to test the above paths with "M-x ffap" as the code by
design starts to chop path components if the path does not exist in current
environment. See:

  (defun ffap-file-at-point ()

  ...near the end....

  ;; Try all parent directories by deleting the trailing directory
  ;; name until existing directory is found or name stops changing

I'm sure the patch is not perfect as it's hard to come by a strategy to
deal with spaces but it appears to give good results. I think users' would
benefit from the space detection support.

Thanks for Yigal Hochberg for testing the functionality in Windows,
Jari





reply via email to

[Prev in Thread] Current Thread [Next in Thread]