GNU bug report logs - #55267
29.0.50; Provide customization to save project-find-file arg to savehist

Previous Next

Package: emacs;

Reported by: Pankaj Jangid <pankaj <at> codeisgreat.org>

Date: Thu, 5 May 2022 03:25:01 UTC

Severity: normal

Fixed in version 29.0.50

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 55267 in the body.
You can then email your comments to 55267 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#55267; Package emacs. (Thu, 05 May 2022 03:25:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Pankaj Jangid <pankaj <at> codeisgreat.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 05 May 2022 03:25:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Pankaj Jangid <pankaj <at> codeisgreat.org>
To: bug-gnu-emacs <at> gnu.org
Subject: 29.0.50; Provide customization to save project-find-file arg to
 savehist
Date: Thu, 05 May 2022 08:54:39 +0530
[Feature request] I use project feature of emacs. And I feel that there is a need for a
customization variable like "project-savehist-enable". When value is
"t", save the files opened with "project-find-file" into savehist.


In GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.24, cairo version 1.16.0)
 of 2022-05-05 built on anant
Repository revision: 5784533cb6e1fe5edf4d5f6c24c02ab8ef5be732
Repository branch: master
System Description: Debian GNU/Linux 11 (bullseye)

Configured using:
 'configure --prefix=/home/pankaj/.local --with-pgtk'

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

Important settings:
  value of $LC_MONETARY: en_IN.UTF-8
  value of $LC_NUMERIC: en_IN.UTF-8
  value of $LC_TIME: en_IN.UTF-8
  value of $LANG: en_IN
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: iso-latin-1-unix

Major mode: ELisp/l

Minor modes in effect:
  company-mode: t
  flymake-mode: t
  electric-pair-mode: t
  editorconfig-mode: t
  which-key-mode: t
  global-git-commit-mode: t
  magit-auto-revert-mode: t
  shell-dirtrack-mode: t
  override-global-mode: t
  savehist-mode: t
  desktop-save-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  column-number-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
/home/pankaj/.emacs.d/elpa/transient-20220503.1118/transient hides /home/pankaj/.local/share/emacs/29.0.50/lisp/transient

Features:
(shadow sort flyspell ispell mail-extr shortdoc help-fns emacsbug
autoload radix-tree diary-lib diary-loaddefs sql view dockerfile-mode
sh-script smie executable markdown-mode conf-mode ol-eww eww xdg
url-queue mm-url ol-rmail ol-mhe ol-irc ol-info ol-gnus nnselect
gnus-art mm-uu mml2015 mm-view mml-smime smime gnutls dig gnus-sum shr
pixel-fill kinsoku url-file url-dired svg dom gnus-group gnus-undo
gnus-start gnus-dbus dbus xml gnus-cloud nnimap nnmail mail-source utf7
netrc nnoo gnus-spec gnus-int gnus-range gnus-win gnus nnheader range
ol-docview doc-view image-mode exif ol-bibtex ol-bbdb ol-w3m ol-doi
org-link-doi yaml-mode mule-util jka-compr tramp-cache prettier nvm f s
iter2 js vc-git checkdoc company-oddmuse company-keywords company-etags
etags fileloop company-gtags company-dabbrev-code company-dabbrev
company-files company-clang company-capf company-cmake company-semantic
company-template company-bbdb company flymake-proc flymake elec-pair
editorconfig-core editorconfig-core-handle editorconfig-fnmatch init
my-init org-element avl-tree generator org org-macro org-footnote
org-pcomplete org-list org-faces org-entities noutline outline
org-version ob-plantuml ob-sql ob-css ob-js ob-java ob-C cc-mode
cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars
cc-defs ob-python python ob-R ob ob-tangle org-src ob-ref ob-lob
ob-table ob-exp ob-comint ob-emacs-lisp ob-core ob-eval org-table
oc-basic bibtex ol org-keys oc org-compat advice org-macs org-loaddefs
cal-menu calendar cal-loaddefs warnings sesman vc vc-dispatcher
clojure-mode lisp-mnt align thingatpt editorconfig tree-sitter-langs
tree-sitter-langs-build tar-mode arc-mode archive-mode tree-sitter-hl
tree-sitter tree-sitter-load tree-sitter-cli tsc tsc-dyn tsc-dyn-get
dired-aux tsc-obsolete gtags-mode xref project which-key vterm
magit-bookmark bookmark tramp tramp-loaddefs trampver tramp-integration
cus-edit pp wid-edit files-x tramp-compat parse-time iso8601 ls-lisp
face-remap compile color term disp-table ehelp find-func vterm-module
term/xterm xterm 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 diff-mode git-commit rx
log-edit pcvs-util add-log magit-core magit-autorevert autorevert
filenotify magit-margin magit-transient magit-process with-editor shell
pcomplete comint ring server ansi-color magit-mode transient magit-git
magit-base magit-section format-spec crm dash compat-27 compat-26 compat
exec-path-from-shell bbdb-message message sendmail yank-media rmc puny
dired dired-loaddefs rfc822 mml mml-sec epa derived epg rfc6068
epg-config gnus-util text-property-search 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 bbdb bbdb-site
timezone edmacro kmacro modus-vivendi-theme modus-themes pcase delight
cl-extra help-mode use-package use-package-ensure use-package-delight
use-package-diminish use-package-bind-key bind-key easy-mmode
use-package-core hl-line savehist desktop frameset avoid cus-load
finder-inf 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 map url-vars seq gv subr-x
byte-opt bytecomp byte-compile cconv cl-loaddefs cl-lib early-init
iso-transl tooltip eldoc paren electric uniquify ediff-hook vc-hooks
lisp-float-type elisp-mode mwheel term/pgtk-win pgtk-win term/common-win
tool-bar dnd fontset image regexp-opt fringe tabulated-list replace
newcomment text-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 nadvice
simple 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
emoji-zwj charscript charprop case-table epa-hook jka-cmpr-hook help
abbrev obarray oclosure cl-preloaded button loaddefs faces cus-face
macroexp files window text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget keymap hashtable-print-readable backquote
threads dbusbind inotify dynamic-setting system-font-setting
font-render-setting cairo gtk pgtk lcms2 multi-tty make-network-process
emacs)

Memory information:
((conses 16 706707 35589)
 (symbols 48 49850 1)
 (strings 32 197900 6452)
 (string-bytes 1 6185931)
 (vectors 16 88510)
 (vector-slots 8 1746492 208908)
 (floats 8 556 53)
 (intervals 56 1933 43)
 (buffers 992 96))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55267; Package emacs. (Thu, 05 May 2022 03:51:01 GMT) Full text and rfc822 format available.

Message #8 received at 55267 <at> debbugs.gnu.org (full text, mbox):

From: Pankaj Jangid <pankaj <at> codeisgreat.org>
To: 55267 <at> debbugs.gnu.org
Subject: Re: bug#55267: Acknowledgement (29.0.50; Provide customization to
 save project-find-file arg to savehist)
Date: Thu, 05 May 2022 09:20:13 +0530
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)?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55267; Package emacs. (Thu, 05 May 2022 07:55:02 GMT) Full text and rfc822 format available.

Message #11 received at 55267 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Pankaj Jangid <pankaj <at> codeisgreat.org>
Cc: 55267 <at> debbugs.gnu.org
Subject: Re: bug#55267: 29.0.50; Provide customization to save
 project-find-file arg to savehist
Date: Thu, 05 May 2022 10:28:15 +0300
> 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.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55267; Package emacs. (Thu, 12 May 2022 17:09:04 GMT) Full text and rfc822 format available.

Message #14 received at 55267 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Pankaj Jangid <pankaj <at> codeisgreat.org>
Cc: 55267 <at> debbugs.gnu.org
Subject: Re: bug#55267: 29.0.50; Provide customization to save
 project-find-file arg to savehist
Date: Thu, 12 May 2022 19:38:48 +0300
[Message part 1 (text/plain, inline)]
>> 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.

[project-find-file.patch (text/x-diff, inline)]
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)

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55267; Package emacs. (Sun, 29 May 2022 21:43:02 GMT) Full text and rfc822 format available.

Message #17 received at 55267 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Juri Linkov <juri <at> linkov.net>, Pankaj Jangid <pankaj <at> codeisgreat.org>
Cc: 55267 <at> debbugs.gnu.org
Subject: Re: bug#55267: 29.0.50; Provide customization to save
 project-find-file arg to savehist
Date: Mon, 30 May 2022 00:42:42 +0300
Hi Juri,

On 05.05.2022 10:28, Juri Linkov wrote:
> 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.

If this works for you, and looks helpful, please go ahead with that change.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55267; Package emacs. (Sun, 29 May 2022 21:45:02 GMT) Full text and rfc822 format available.

Message #20 received at 55267 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Juri Linkov <juri <at> linkov.net>, Pankaj Jangid <pankaj <at> codeisgreat.org>
Cc: 55267 <at> debbugs.gnu.org
Subject: Re: bug#55267: 29.0.50; Provide customization to save
 project-find-file arg to savehist
Date: Mon, 30 May 2022 00:44:19 +0300
On 12.05.2022 19:38, Juri Linkov wrote:
> 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.

Here as well: if you find this helpful, that sounds okay to me.

I haven't ever felt a need for this particular behavior, but it 
shouldn't hurt either.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55267; Package emacs. (Mon, 30 May 2022 06:09:02 GMT) Full text and rfc822 format available.

Message #23 received at 55267 <at> debbugs.gnu.org (full text, mbox):

From: Pankaj Jangid <pankaj <at> codeisgreat.org>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: 55267 <at> debbugs.gnu.org, Juri Linkov <juri <at> linkov.net>
Subject: Re: bug#55267: 29.0.50; Provide customization to save
 project-find-file arg to savehist
Date: Mon, 30 May 2022 11:38:40 +0530
Dmitry Gutov <dgutov <at> yandex.ru> writes:

> On 12.05.2022 19:38, Juri Linkov wrote:
>> 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.
>
> Here as well: if you find this helpful, that sounds okay to me.
>
> I haven't ever felt a need for this particular behavior, but it
> shouldn't hurt either.

To be consistent with other subsystems of Emacs, we can do something
that Dired does.

1. Press ’R’ to rename a file.

2. Then press ’M-n’. It invokes (next-history-element) which fills
   current file in the minibuffer for editing.

the advantage of this above approach is that it offers user a
choice - continue using the same behaviour or press ’M-n’ to prefill
current file name.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55267; Package emacs. (Mon, 30 May 2022 09:22:01 GMT) Full text and rfc822 format available.

Message #26 received at 55267 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Pankaj Jangid <pankaj <at> codeisgreat.org>
Cc: 55267 <at> debbugs.gnu.org, Juri Linkov <juri <at> linkov.net>
Subject: Re: bug#55267: 29.0.50; Provide customization to save
 project-find-file arg to savehist
Date: Mon, 30 May 2022 12:21:30 +0300
On 30.05.2022 09:08, Pankaj Jangid wrote:
> To be consistent with other subsystems of Emacs, we can do something
> that Dired does.
> 
> 1. Press ’R’ to rename a file.
> 
> 2. Then press ’M-n’. It invokes (next-history-element) which fills
>     current file in the minibuffer for editing.
> 
> the advantage of this above approach is that it offers user a
> choice - continue using the same behaviour or press ’M-n’ to prefill
> current file name.

I think that's what Juri is suggesting, more or less.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55267; Package emacs. (Mon, 30 May 2022 16:33:02 GMT) Full text and rfc822 format available.

Message #29 received at 55267 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: Pankaj Jangid <pankaj <at> codeisgreat.org>, 55267 <at> debbugs.gnu.org
Subject: Re: bug#55267: 29.0.50; Provide customization to save
 project-find-file arg to savehist
Date: Mon, 30 May 2022 19:32:07 +0300
close 55267 29.0.50
thanks

>> 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.
>
> If this works for you, and looks helpful, please go ahead with that change.

Thanks for approval, now both changes were added to project.el.




bug marked as fixed in version 29.0.50, send any further explanations to 55267 <at> debbugs.gnu.org and Pankaj Jangid <pankaj <at> codeisgreat.org> Request was from Juri Linkov <juri <at> linkov.net> to control <at> debbugs.gnu.org. (Mon, 30 May 2022 16:33:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 28 Jun 2022 11:24:10 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 275 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.