From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: James N. V. Cash Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] Handle case where `beg` and `end` are strings instead of markers Date: Sat, 30 Apr 2022 11:48:02 -0400 Message-ID: <87ee1e374d.fsf@occasionallycogent.com> References: <87k0b84tfr.fsf@occasionallycogent.com> <87h76c4ruf.fsf@occasionallycogent.com> <86sfpwwerz.fsf@mail.linkov.net> <87czh03xa9.fsf@occasionallycogent.com> <87o80i3frf.fsf@occasionallycogent.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12797"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org, Juri Linkov To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Apr 30 17:49:03 2022 Return-path: Envelope-to: ged-emacs-devel@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 1nkpLC-00039T-Uf for ged-emacs-devel@m.gmane-mx.org; Sat, 30 Apr 2022 17:49:02 +0200 Original-Received: from localhost ([::1]:53108 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nkpLB-0003Lq-H3 for ged-emacs-devel@m.gmane-mx.org; Sat, 30 Apr 2022 11:49:01 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45768) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nkpKK-0002dZ-IH for emacs-devel@gnu.org; Sat, 30 Apr 2022 11:48:09 -0400 Original-Received: from mail-qk1-f180.google.com ([209.85.222.180]:40922) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nkpKI-0007xA-E4 for emacs-devel@gnu.org; Sat, 30 Apr 2022 11:48:07 -0400 Original-Received: by mail-qk1-f180.google.com with SMTP id e128so7997594qkd.7 for ; Sat, 30 Apr 2022 08:48:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=hiilyJ7uXSjOKCHbsGxNWcbrusN1SSAr//TOM1BqC10=; b=ybFOV26MPSB0IERT9lFELY8/LVDW7Hs2jg20DsvF/6aSjuM1Xe0sEnJuidJs6vIACS 6R41iYF2rLk7mVxHalj4TsKvKqZwX4eI/igRVf2e9Blb3WG9V22WpAbtCFMqUHwyC/3A ywAH4NBKSWZwueGJfGhld/1ZYg3gB4gwzK/Xxhe9uAyLp+4dnbAVWjpgiAJHvAJ28ovz x1faJ0UNeV09hRiDjRqt/XtSgpShQwqbMydfnoK4AweYEf074z5+lol+q5QAbBkPkuGe rft1Ejiibtu7aSmxA5yJOsT6Ut1CjwWJyghwBnrwI7msOg294K0mODHBbKjWTA6FgcLW OXcw== X-Gm-Message-State: AOAM533z/sjKtcDBveop7TOUdSxMgLomp5W7OttzSETheSdE9qf6jqSK tnU9EsSwPxBdyNQGVUyCCxE3vHky9Go= X-Google-Smtp-Source: ABdhPJxyiWEe6POTNp7Vu/DeJ+7mIRs2AaEkb4Hvkg7MhlSvXTqk+vPJ49lGyZnvkGg7zq+GMCp3TA== X-Received: by 2002:a37:a7c1:0:b0:69f:b85f:b2e2 with SMTP id q184-20020a37a7c1000000b0069fb85fb2e2mr3128423qke.251.1651333685177; Sat, 30 Apr 2022 08:48:05 -0700 (PDT) Original-Received: from auth1-smtp.messagingengine.com (auth1-smtp.messagingengine.com. [66.111.4.227]) by smtp.gmail.com with ESMTPSA id w23-20020a05620a149700b0069fc13ce233sm1311961qkj.100.2022.04.30.08.48.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Apr 2022 08:48:04 -0700 (PDT) Original-Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailauth.nyi.internal (Postfix) with ESMTP id 4530027C005A; Sat, 30 Apr 2022 11:48:03 -0400 (EDT) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Sat, 30 Apr 2022 11:48:04 -0400 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvddugdelvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvfevufgjfhffkfggtgesthdtredttddttdenucfhrhhomheplfgrmhgvshcu pfdrucggrdcuvegrshhhuceojhgrmhgvshdrnhhvtgesghhmrghilhdrtghomheqnecugg ftrfgrthhtvghrnhepudehtdeukeekiedvfeekudefkeeileejgeehfffhieevuefhkeeu ffefgfeileeknecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrh homhepjhgrmhgvshgptggrshhhodhmvghsmhhtphgruhhthhhpvghrshhonhgrlhhithih qdduvdefvddtvdejledvqddvjeekgedtudehvddqjhgrmhgvshdrnhhvtgeppehgmhgrih hlrdgtohhmsehotggtrghsihhonhgrlhhlhigtohhgvghnthdrtghomh X-ME-Proxy: Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 30 Apr 2022 11:48:03 -0400 (EDT) In-Reply-To: Received-SPF: pass client-ip=209.85.222.180; envelope-from=james.nvc@gmail.com; helo=mail-qk1-f180.google.com X-Spam_score_int: -9 X-Spam_score: -1.0 X-Spam_bar: - X-Spam_report: (-1.0 / 5.0 requ) BAYES_00=-1.9, DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001, NML_ADSP_CUSTOM_MED=0.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:289061 Archived-At: Stefan Monnier writes: > This makes it specific to CRM. I think we should try and think more > locally, without paying too much attention about the various possible > external cases: what do we want the `beg` and `end` strings to *mean*? > > Maybe instead of strings, they should be functions, so CRM can set them > to functions that first look for the separator and then search for some > leading/trailing string? Upon further inspection, I see that `minibuffer-completion-help` is setting `completion-list-insert-choice-function` to a function that checks if the `beg` and `end` arguments are strings, in which case it just replaces the minibuffer contents with "beg" + "choice" + "end". Indeed, when doing `completing-read` instead of `completing-read-multiple`, `completion--replace` doesn't get called at all in this case. On one hand, that *might* mean that this particular code path (completion--replace being called with `beg` and `end` strings) necessarily means it's a completing-read-multiple, so searching for the crm-separator is justifiable. On the other, a better solution than my patch then might be to figure out why that function is being "lost" in the completion-read-multiple case, so the "replace minibuffer contents with beg + selection + end" behaviour happens there too (maybe, arguably, in the CRM case in particular, deleting part of the prefix then selecting a completion makes sense, but in the normal case, the current behaviour (essentially, ignoring edits that have happened in the prefix) seems like the only sensible thing to do). James