From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#58447: [PATCH] In project-find-file, add absolute file name to history Date: Thu, 15 Dec 2022 15:54:58 +0200 Message-ID: References: <8735budxiz.fsf@gmail.com> <87k04li5nw.fsf@gmail.com> <864jvphx4r.fsf@mail.linkov.net> <86tu3mftm0.fsf@mail.linkov.net> <875yg0to11.fsf@gmail.com> <86zgdalj0h.fsf@mail.linkov.net> <86fsdpjasd.fsf@mail.linkov.net> <86k02zjiwj.fsf@mail.linkov.net> <864ju1lt5k.fsf@mail.linkov.net> <403e8284-e32c-f547-748e-371d26eedace@yandex.ru> <86cz8or02n.fsf@mail.linkov.net> <87sfhko3tf.fsf@gmail.com> <868rjbusog.fsf@mail.linkov.net> <87h6xylyox.fsf@gmail.com> <1d03758e-369a-c522-a91a-696243f1074f@yandex.ru> <87cz8ln5lt.fsf@gmail.com> <86o7s5i1ec.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="673"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Cc: Eli Zaretskii , Augusto Stoffel , 58447@debbugs.gnu.org To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Dec 15 14:56:27 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p5oip-000AY1-Np for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 15 Dec 2022 14:56:27 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p5oiU-0005vI-PM; Thu, 15 Dec 2022 08:56:06 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p5oiQ-0005th-Ri for bug-gnu-emacs@gnu.org; Thu, 15 Dec 2022 08:56:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p5oiQ-00077n-Jj for bug-gnu-emacs@gnu.org; Thu, 15 Dec 2022 08:56:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p5oiQ-0006QG-82 for bug-gnu-emacs@gnu.org; Thu, 15 Dec 2022 08:56:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 15 Dec 2022 13:56:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58447 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 58447-submit@debbugs.gnu.org id=B58447.167111250924673 (code B ref 58447); Thu, 15 Dec 2022 13:56:02 +0000 Original-Received: (at 58447) by debbugs.gnu.org; 15 Dec 2022 13:55:09 +0000 Original-Received: from localhost ([127.0.0.1]:43026 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p5ohY-0006Pt-II for submit@debbugs.gnu.org; Thu, 15 Dec 2022 08:55:08 -0500 Original-Received: from mail-wr1-f50.google.com ([209.85.221.50]:44704) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p5ohW-0006Pj-N6 for 58447@debbugs.gnu.org; Thu, 15 Dec 2022 08:55:07 -0500 Original-Received: by mail-wr1-f50.google.com with SMTP id u12so3086635wrr.11 for <58447@debbugs.gnu.org>; Thu, 15 Dec 2022 05:55:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=OafQEygGz+k367GRaOyn/ez8el6my7Cwpu4rOFN8LbQ=; b=e9ZdyNf/9yV3jW+qer2Z2AwPhsbVOtq/umftAV9RnIqTerFTz06NRuz1Btp+V4pfhf nQfi9lKopZxSH68w3zlAOYr9fDi3PgIK5dJI/UkrclEpaGhDiwt3UyMzLcTlNB4Jz1WG d1xoan4P9ml5vHuMEyi1CTGaexhmLgQrIr7/ma8RFdB3dULF2p79sEtx9P9hspy0iFnm v0tUVfJyhpW0mV+mDlWLfMiP6YYUlPu/KmBTPKfiQ9VB16O7XMmlFQhqOX/M1F8BihH3 VqX83byoMgpUeKIiHTdBe9asVHbZQbAHFB0ALp1tlVrI2jc47TePuD8FMRWy+V4L5GGQ oAmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=OafQEygGz+k367GRaOyn/ez8el6my7Cwpu4rOFN8LbQ=; b=mcvRArk3Foov86Jp5flwjmJECHGZ/pg6S9eFZWSkTMnwBdgJeqL/HaeO8E2roTz4A0 juk+B2nWnDdgAx1laTuwgLPS/+KBcw+EWWfoEgXfKxVIVf8gqVmezkaanWqc97JT25hp 2ek3HOPynWlp6WUMP2en+OIQtxdMiovR6uXcnh3wvkruJL0wcgyNf+XqPD77KaPzd56Y XTtjqd17KwdpRxIUVktNALh+cjOAZuzsPmHBHQinrtgNfwQepy63rErnmy9NmvhIvSIu LfTbFW7GfUo2L+Hs5N8mCf8eTW00GhdlhVFnOSJw6gp2GWmokmcfWscD5LYzwzeP7dGV esJA== X-Gm-Message-State: ANoB5plNrvtXu/Y/xeRhjB6ILLc3FUYMZ3pO5DH8Wobwt76Wqol9xkrl j7DfJfCxMbeu7FJmTCi+YfE= X-Google-Smtp-Source: AA0mqf6jeUe5BH0Eo8aCggh/sHbu57ZU914wNGxP5hMb2vCg3PlPiGo89CD0FWVGLhor/cYiN3ySZw== X-Received: by 2002:a5d:5a1d:0:b0:242:142a:c8ba with SMTP id bq29-20020a5d5a1d000000b00242142ac8bamr18924434wrb.52.1671112500768; Thu, 15 Dec 2022 05:55:00 -0800 (PST) Original-Received: from [192.168.0.2] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id t6-20020a5d5346000000b0023662245d3csm5997198wrv.95.2022.12.15.05.54.59 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 15 Dec 2022 05:55:00 -0800 (PST) Content-Language: en-US In-Reply-To: <86o7s5i1ec.fsf@mail.linkov.net> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:251091 Archived-At: On 15/12/2022 09:24, Juri Linkov wrote: >> The patches could be combined, but v1 seems to be too invasive for >> emacs-29, yet v2 could be just small enough to be considered "bugfix-only". >> >> So, what does everyone think about the latter? >> >> If people agree that the v2 patch is an improvement, we can check it in and >> leave project-local histories until later. > > Does the second patch allow such workflows as re-visiting > the same relative filenames in another directory? Not really; it filters by project root (more or less). As long as we have global history, it's hard to extract the relative names for it, if they belong to a different directory tree. But the history storage seems to retain text properties. So I suppose one option would be to annotate the "relative" part with a text property, before adding the string to history. And then look up the text property later. > IMHO, the safest fix for emacs-29 would be to add relative filenames > to the separate history. If someone might want to use > 'file-name-history', then a new variable could be added like > 'query-replace-from-history-variable'. Then this variable > could be customized to 'file-name-history', or nil. > > It's needed only when 'project-read-file-name-function' > is 'project--read-file-cpd-relative'. It can work, but having a user option that only works for project--read-file-cpd-relative is pretty awkward. Beginning with having to choose its name. If we do this, I'd rather that happens on master, and we choose something smaller for emacs-29. And the text property trick above could both "store" the relative history and also keep adding entries to 'C-x C-f'. > But please also note that its value 'project--read-file-absolute' > is also broken. It asks confirmation for re-visiting even absolute > filenames, because currently 'C-x p f' adds abbreviated filenames, > but confirmation checks for absolute. Does the breakage show itself only when you add a history entry using one value of project-read-file-name-function and then try to look it up when using another value of project-read-file-name-function? If so, that's probably bearable enough for now (people don't really change this value often). Fixing it will require resolving the abbreviation situation. And we might as well switch to relative names in project-files first.