Subject: 28.0.50; Customize project-find-file without thing-at-pont

From: Manuel Uberti <[email-masked]>
Date: Wed, 4 Aug 2021 08:16:11 +0200

Hi,

when I use project-find-file it always picks up the thing at point even when it 
is something I am pretty sure that does not correspond to a filename, which, in 
my case, is all the times.

I see that in project.el, project-find-file uses project-find-file-in:

;;;###autoload
(defun project-find-file ()
   "Visit a file (with completion) in the current project.

The completion default is the filename at point, determined by
`thing-at-point' (whether such file exists or not)."
   (interactive)
   (let* ((pr (project-current t))
          (dirs (list (project-root pr))))
     (project-find-file-in (thing-at-point 'filename) dirs pr)))

Would it be possible to make it customizable with regards to that
(thing-at-point 'filename)?

At the moment I am using this in my init.el, which I have bound to f in 
project-prefix-map:

(defun mu-project-find-file ()
   "Visit a file (with completion) in the current project."
   (interactive)
   (let* ((pr (project-current t))
          (dirs (list (project-root pr))))
     (project-find-file-in nil dirs pr)))

So what I would like is a defcustom that makes me choose whether to pass nil or 
(thing-at-point ...) to project-find-file-in.

I know that this is not a real bug because I can still type whatever I want 
after calling project-find-file, so I totally understand if this is not 
something worth new code in project.el. It's just that I don't see the point for 
project-find-file to suggest me as defaults things like "defun" or "interactive".

Thank you.

In GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.18, cairo 
version 1.16.0)
  of 2021-08-04 built on hathaway
Repository revision: bee3e51550174047c73a1e942c16c8d45e2db1b8
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12009000
System Description: Ubuntu 20.04 LTS

Configured using:
  'configure --with-harfbuzz --with-native-compilation'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES
NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND THREADS TIFF
TOOLKIT_SCROLL_BARS X11 XDBE XIM XPM GTK3 ZLIB

Important settings:
   value of $LC_MONETARY: it_IT.UTF-8
   value of $LC_NUMERIC: it_IT.UTF-8
   value of $LC_TIME: it_IT.UTF-8
   value of $LANG: en_US.UTF-8
   value of $XMODIFIERS: @im=ibus
   locale-coding-system: utf-8-unix

Major mode: ELisp/l

Minor modes in effect:
   electric-pair-mode: t
   flyspell-mode: t
   delete-selection-mode: t
   auto-image-file-mode: t
   show-paren-mode: t
   global-so-long-mode: t
   global-company-mode: t
   company-mode: t
   envrc-global-mode: t
   envrc-mode: t
   flymake-mode: t
   goto-address-prog-mode: t
   hl-line-mode: t
   global-git-commit-mode: t
   magit-auto-revert-mode: t
   shell-command-with-editor-mode: t
   shell-dirtrack-mode: t
   minibuffer-depth-indicate-mode: t
   minibuffer-electric-default-mode: t
   savehist-mode: t
   global-diff-hl-mode: t
   diff-hl-mode: t
   vertico-mode: t
   recentf-mode: t
   save-place-mode: t
   mu-keys-mode: t
   global-eldoc-mode: t
   eldoc-mode: t
   electric-indent-mode: t
   mouse-wheel-mode: t
   tool-bar-mode: t
   menu-bar-mode: t
   file-name-shadow-mode: t
   global-font-lock-mode: t
   font-lock-mode: t
   window-divider-mode: t
   auto-composition-mode: t
   auto-encryption-mode: t
   auto-compression-mode: t
   buffer-read-only: t
   column-number-mode: t
   line-number-mode: t
   transient-mark-mode: t
   view-mode: t

Load-path shadows:
/home/manuel/.emacs.d/elpa/transient-20210723.1601/transient hides 
/usr/local/share/emacs/28.0.50/lisp/transient

Features:
(shadow sort mail-extr emacsbug sendmail noutline outline checkdoc pulse
color view jka-compr help-fns radix-tree elec-pair package-lint-flymake
package-lint let-alist finder finder-inf lisp-mnt bug-reference flyspell
ispell delsel image-file image-converter paren so-long company-oddmuse
company-keywords company-etags etags fileloop generator xref
company-gtags company-dabbrev-code company-dabbrev company-files
company-clang company-capf company-cmake company-semantic
company-template company-bbdb company envrc inheritenv flymake-proselint
flymake-proc flymake compile keychain-environment goto-addr thingatpt
hl-line face-remap vc-git magit-extras magit-bookmark magit-submodule
magit-obsolete magit-blame magit-stash magit-reflog magit-bisect
magit-push magit-pull magit-fetch magit-clone magit-remote magit-commit
magit-sequence magit-notes magit-worktree magit-tag magit-merge
magit-branch magit-reset magit-files magit-refs magit-status magit
magit-repos magit-apply magit-wip magit-log which-func imenu magit-diff
smerge-mode diff git-commit log-edit message rmc puny dired-x dired-aux
dired dired-loaddefs rfc822 mml mml-sec epa derived epg epg-config
gnus-util rmail rmail-loaddefs time-date mm-decode mm-bodies mm-encode
mail-parse rfc2231 rfc2047 rfc2045 mm-util ietf-drums mail-prsvr
mailabbrev mail-utils gmm-utils mailheader add-log magit-core
magit-autorevert magit-margin magit-transient magit-process with-editor
shell pcomplete comint server ansi-color magit-mode transient
format-spec magit-git magit-section magit-utils crm dash cursor-sensor
project autorevert filenotify mb-depth minibuf-eldef savehist
consult-vertico consult bookmark text-property-search pp diff-hl
log-view pcvs-util vc-dir ewoc vc vc-dispatcher diff-mode orderless
vertico modus-operandi-theme modus-themes mode-local advice find-func
recentf tree-widget wid-edit saveplace delight comp comp-cstr warnings
packages pdf-loader cl-extra help-mode hydra ring lv built-ins rx pcase
ibuf-macs core-settings edmacro kmacro disp-table core-packages
no-littering core-lib easy-mmode tex-site info package browse-url url
url-proxy url-privacy url-expand url-methods url-history url-cookie
url-domsuf url-util mailcap url-handlers url-parse auth-source cl-seq
eieio eieio-core cl-macs eieio-loaddefs password-cache json subr-x map
url-vars seq byte-opt gv bytecomp byte-compile cconv cl-loaddefs cl-lib
iso-transl tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar
dnd fontset image regexp-opt fringe tabulated-list replace newcomment
text-mode elisp-mode lisp-mode prog-mode register page tab-bar menu-bar
rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock
font-lock syntax font-core term/tty-colors frame minibuffer cl-generic
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray
cl-preloaded nadvice button loaddefs faces cus-face macroexp files
window text-properties overlay sha1 md5 base64 format env code-pages
mule custom widget hashtable-print-readable backquote threads dbusbind
inotify lcms2 dynamic-setting system-font-setting font-render-setting
cairo move-toolbar gtk x-toolkit x multi-tty make-network-process
native-compile emacs)

Memory information:
((conses 16 409418 31095)
  (symbols 48 43772 1)
  (strings 32 99103 5677)
  (string-bytes 1 3151508)
  (vectors 16 43539)
  (vector-slots 8 919095 45828)
  (floats 8 278 522)
  (intervals 56 1423 131)
  (buffers 992 19))

-- 
Manuel Uberti
www.manueluberti.eu