|
From: | Knut Olav Bøhmer |
Subject: | FFAP does not suggest non-exsistant files |
Date: | Fri, 14 Sep 2007 10:47:09 +0200 |
User-agent: | Thunderbird 1.5.0.12 (X11/20070604) |
Hi, When doing M-x ffap, a file is not suggested (but highlighted) if the file does not exist. So I have a little suggestion on how to fix it. Maybe there exists a better solution, but it worked for me. The difference here is that I added changed ret to (or ret file) at the bottom of the function. (defun ffap-file-exists-string (file &optional nomodify) ;; Early jka-compr versions modified file-exists-p to return the ;; filename, maybe modified by adding a suffix like ".gz". That ;; broke the interface of file-exists-p, so it was later dropped. ;; Here we document and simulate the old behavior. "Return FILE (maybe modified) if the file exists, else nil. When using jka-compr (a.k.a. `auto-compression-mode'), the returned name may have a suffix added from `ffap-compression-suffixes'. The optional NOMODIFY argument suppresses the extra search." (cond ((not file) nil) ; quietly reject nil ((file-exists-p file) file) ; try unmodified first ;; three reasons to suppress search: (nomodify nil) ((not (rassq 'jka-compr-handler file-name-handler-alist)) nil) ((member (ffap-file-suffix file) ffap-compression-suffixes) nil) (t ; ok, do the search (let ((list ffap-compression-suffixes) try ret) (while list (if (file-exists-p (setq try (concat file (car list)))) (setq ret try list nil) (setq list (cdr list)))) (or ret file))))) |
[Prev in Thread] | Current Thread | [Next in Thread] |