[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#49865: 28.0.50; Customize project-find-file without thing-at-pont
From: |
Dmitry Gutov |
Subject: |
bug#49865: 28.0.50; Customize project-find-file without thing-at-pont |
Date: |
Fri, 6 Aug 2021 03:51:13 +0300 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 |
Hi Lars,
On 04.08.2021 11:37, Lars Ingebrigtsen wrote:
This reminded me that I've been meaning to add a thing-at-point target
that is like `filename', but returns nil if the file named doesn't
exist, so I've now done this in Emacs 28.
Perhaps project.el should use it here?
I don't know if it will be the best choice here.
First of all, we already have the hook file-name-at-point-functions,
which is consulted by read-file-name--defaults. So one can already e.g.
move point to some existing file name, press C-x C-f M-n and with the
power of the ffap package have the file name inserted.
But when we're completing project-wide, there will also be references
that are not relative to the current directory (and instead relate to
some project-configured path). Like
#include "stuff/thingy.h"
or
require 'actor/abc'
...where the string is both not relative to the current dir and is
missing the extension.
ffap actually includes support for this, like having
(require 'cl-lib)
be recognized as '.../lisp/emacs-lisp/cl-lib.el', but it only works for
a limited set of languages, and OOTB only for Elisp (for all others you
need to configure variables like ffap-c++-path).