emacs-devel
[Top][All Lists]
Advanced

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

FFAP does not suggest non-exsistant files


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)))))




--
Free Software Consultant
Cell: +47 - 47 34 40 08
Phone: +47 - 21 53 69 00, Fax: +47 - 21 53 69 09
Addr: Slemdalsveien 70, PB 1 Vinderen, 0319 Oslo



reply via email to

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