GNU bug report logs -
#8439
[PATCH] ffap.el -- detect paths with spaces
Previous Next
Reported by: Jari Aalto <jari.aalto <at> cante.net>
Date: Thu, 7 Apr 2011 15:25:02 UTC
Severity: minor
Tags: fixed, patch
Merged with 6695,
13087
Found in versions 23.2+1-7, 24.0.50, 24.3.50
Fixed in version 28.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
Message #13 received at 8439 <at> debbugs.gnu.org (full text, mbox):
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
This bug report was last modified 4 years and 285 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.