all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: Dmitry Gutov <dgutov@yandex.ru>
Cc: emacs-devel@gnu.org
Subject: Slight confusion in project-find-file
Date: Mon, 13 Sep 2021 16:07:49 +0200	[thread overview]
Message-ID: <871r5sd0wa.fsf@gnus.org> (raw)

I was looking at

*** 'project-find-file' doesn't use the string at point as default input.
Now it's only suggested as part of the "future history".

which comes from

commit fa895379d6166c52b89774a9e450a94c2e429dae
Author:     Dmitry Gutov <dgutov@yandex.ru>
AuthorDate: Fri Aug 6 03:30:10 2021 +0300

    Change how project-find-file's completion works
    
    * lisp/progmodes/project.el (project--completing-read-strict):
    Allow to choose a non-existent file, with confirmation
    (bug#49204).
    Don't use the string at point as a "real" default, and instead
    only include it in "future history": meaning, it will be inserted
    on 'M-n' (bug#49865).

And, indeed, it doesn't put anything in the default.  However, I'm
getting a bit confused trying to follow the logic:

(defun project-or-external-find-file ()
  "Visit a file (with completion) in the current project or external roots.

The completion default is the filename at point, determined by
`thing-at-point' (whether such file exists or not)."

So this says "default", but "completion default"...  (And same string in
project-find-file).  Also:

@findex project-find-file
[...]
belonging to the current project, and nothing else.  If there's a file
name at point, this command offers that file as the default to visit.

However, we basically end up calling:

(uniq-file-read "Prompt" nil nil nil "file-name")

there "file-name" is in the DEFAULT position, but is put in the "future
history".

Furthermore, `M-x project-find-file RET RET':

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  expand-file-name(nil)
  find-file-noselect(nil nil nil nil)
  find-file(nil)
  project-find-file-in(#("." 0 1 (fontified t)) ("~/src/emacs/trunk/") (vc . "~/src/emacs/trunk/"))
  project-find-file()
  funcall-interactively(project-find-file)

So I think this needs a bit more updating in the doc
strings/documentation/parameter names, and perhaps a different way of
erroring out on RET.  (Or even actually using the DEFAULT as a default.)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




             reply	other threads:[~2021-09-13 14:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-13 14:07 Lars Ingebrigtsen [this message]
2021-09-13 14:25 ` Slight confusion in project-find-file Manuel Uberti
2021-09-13 22:04   ` Dmitry Gutov
2021-09-13 22:03 ` Dmitry Gutov
2021-09-14 11:22   ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871r5sd0wa.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=dgutov@yandex.ru \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.