all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: Pankaj Jangid <pankaj@codeisgreat.org>
Cc: 55267@debbugs.gnu.org
Subject: bug#55267: 29.0.50; Provide customization to save project-find-file arg to savehist
Date: Thu, 12 May 2022 19:38:48 +0300	[thread overview]
Message-ID: <86czgj5e6n.fsf@mail.linkov.net> (raw)
In-Reply-To: <86a6bwv2qk.fsf_-_@mail.linkov.net> (Juri Linkov's message of "Thu, 05 May 2022 10:28:15 +0300")

[-- Attachment #1: Type: text/plain, Size: 763 bytes --]

>> I just noticed that "project-find-file" is ultimately calling
>> "find-file" only. So it should save the file to minibuffer history if
>> savehist-mode is enabled.
>>
>> But this is not happening in my environment right now. Is this a bug
>> (instead of feature request)?
>
> Recently I noticed this problem too.  So project-find-file-in
> needs to specify the same history variable 'file-name-history'
> as used in read-file-name-default.
>
> Then you could add 'file-name-history' to savehist-additional-variables.

BTW, here is another improvement for project-find-file.
If there is no file name under point, it could propose
the current file name for editing in the minibuffer,
to find another file based on the current file
when their names are similar.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: project-find-file.patch --]
[-- Type: text/x-diff, Size: 760 bytes --]

diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index 6c50135358..5eee20e408 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -863,8 +863,12 @@ project-find-file
 for VCS directories listed in `vc-directory-exclusion-list'."
   (interactive "P")
   (let* ((pr (project-current t))
-         (dirs (list (project-root pr))))
-    (project-find-file-in (thing-at-point 'filename) dirs pr include-all)))
+         (root (project-root pr))
+         (dirs (list root)))
+    (project-find-file-in
+     (or (thing-at-point 'filename)
+         (and buffer-file-name (file-relative-name buffer-file-name root)))
+     dirs pr include-all)))
 
 ;;;###autoload
 (defun project-or-external-find-file (&optional include-all)

  reply	other threads:[~2022-05-12 16:38 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-05  3:24 bug#55267: 29.0.50; Provide customization to save project-find-file arg to savehist Pankaj Jangid
     [not found] ` <handler.55267.B.165172109316668.ack@debbugs.gnu.org>
2022-05-05  3:50   ` bug#55267: Acknowledgement (29.0.50; Provide customization to save project-find-file arg to savehist) Pankaj Jangid
2022-05-05  7:28     ` bug#55267: 29.0.50; Provide customization to save project-find-file arg to savehist Juri Linkov
2022-05-12 16:38       ` Juri Linkov [this message]
2022-05-29 21:44         ` Dmitry Gutov
2022-05-30  6:08           ` Pankaj Jangid
2022-05-30  9:21             ` Dmitry Gutov
2022-05-29 21:42       ` Dmitry Gutov
2022-05-30 16:32         ` Juri Linkov

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=86czgj5e6n.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=55267@debbugs.gnu.org \
    --cc=pankaj@codeisgreat.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.