* FFAP does not suggest non-exsistant files
@ 2007-09-14 8:47 Knut Olav Bøhmer
0 siblings, 0 replies; only message in thread
From: Knut Olav Bøhmer @ 2007-09-14 8:47 UTC (permalink / raw)
To: emacs-devel
[-- Attachment #1.1: Type: text/plain, Size: 1625 bytes --]
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
<http://www.freecode.no/>
[-- Attachment #1.2.1: Type: text/html, Size: 3767 bytes --]
[-- Attachment #1.2.2: logo_horizontal.png --]
[-- Type: image/png, Size: 7619 bytes --]
[-- Attachment #2: Type: text/plain, Size: 142 bytes --]
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2007-09-14 8:47 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-14 8:47 FFAP does not suggest non-exsistant files Knut Olav Bøhmer
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.