From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Damien Cassou Newsgroups: gmane.emacs.bugs Subject: bug#58071: 28.2; [PATCH] jumprel: A tool to find/create related files Date: Wed, 28 Sep 2022 21:26:51 +0200 Message-ID: <874jwr9u6c.fsf@cassou.me> References: <878rm7wvib.fsf@cassou.me> <83k05qlgyw.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10377"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 58071@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Sep 28 21:27:14 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 1odci8-0002Vt-NO for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 28 Sep 2022 21:27:12 +0200 Original-Received: from localhost ([::1]:43320 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1odci7-0002AG-Qr for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 28 Sep 2022 15:27:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45604) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odchy-000285-On for bug-gnu-emacs@gnu.org; Wed, 28 Sep 2022 15:27:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:35678) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1odchy-00052i-H1 for bug-gnu-emacs@gnu.org; Wed, 28 Sep 2022 15:27:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1odchy-0003Ca-Cg for bug-gnu-emacs@gnu.org; Wed, 28 Sep 2022 15:27:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Damien Cassou Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 28 Sep 2022 19:27:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58071 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 58071-submit@debbugs.gnu.org id=B58071.166439321912299 (code B ref 58071); Wed, 28 Sep 2022 19:27:02 +0000 Original-Received: (at 58071) by debbugs.gnu.org; 28 Sep 2022 19:26:59 +0000 Original-Received: from localhost ([127.0.0.1]:34756 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1odchu-0003CI-Nt for submit@debbugs.gnu.org; Wed, 28 Sep 2022 15:26:59 -0400 Original-Received: from mail.choca.pics ([80.67.172.235]:46034) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1odchr-0003C7-MG for 58071@debbugs.gnu.org; Wed, 28 Sep 2022 15:26:58 -0400 Original-Received: from localhost (localhost.localdomain [IPv6:::1]) by mail.choca.pics (Postfix) with ESMTP id BDE5E181942A3; Wed, 28 Sep 2022 21:26:53 +0200 (CEST) Original-Received: from mail.choca.pics ([IPv6:::1]) by localhost (mail.choca.pics [IPv6:::1]) (amavisd-new, port 10032) with ESMTP id 9Dl88vGLN1gO; Wed, 28 Sep 2022 21:26:52 +0200 (CEST) Original-Received: from localhost (localhost.localdomain [IPv6:::1]) by mail.choca.pics (Postfix) with ESMTP id CE880181942A7; Wed, 28 Sep 2022 21:26:52 +0200 (CEST) X-Virus-Scanned: amavisd-new at choca.pics Original-Received: from mail.choca.pics ([IPv6:::1]) by localhost (mail.choca.pics [IPv6:::1]) (amavisd-new, port 10026) with ESMTP id phFrcIRk7bcC; Wed, 28 Sep 2022 21:26:52 +0200 (CEST) Original-Received: from localhost (153.226.95.79.rev.sfr.net [79.95.226.153]) by mail.choca.pics (Postfix) with ESMTPSA id 7A782181942A3; Wed, 28 Sep 2022 21:26:52 +0200 (CEST) In-Reply-To: <83k05qlgyw.fsf@gnu.org> 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" Xref: news.gmane.io gmane.emacs.bugs:243849 Archived-At: Thank you very much Eli for your review. I appreciate the time you took to have a look at my code. I imagine how busy you are and my package isn't small. Eli Zaretskii writes: > - "jumprel" is not the best name, IMO; something like "related-files" > would be better sure > - what you call "recipes", i.e. descriptors of how to generate the > name of related files from a given file name, should be documented in > a single doc string, and the other places that use recipes should > reference the symbol whose doc string documents them do you have any suggestion for this? The only place I can find is `jumprel-recipe--apply-filename-jumper' which is private. I could also add it to the override of `jumprel-apply' but I'm not sure how to reference an override from a docstring. > - I find no documentation of how to describe alternatives -- several > alternative file names produced from a single original file name several alternatives can be produced with: 1. several jumpers produce several alternatives: all jumpers are executed on the current file name and their results are merged into a single list of candidates (see `jumprel--collect-existing-places' and `jumprel--call-jumpers'). 2. a function-based jumper returning a list (this is described in the docstring of `jumprel-apply') 3. a regexp-based jumper may also return a list of candidates if the globs match several existing filenames 4. a recipe-based jumper may also return a list of candidates if :add-directory is used and several matching directories exist Does that answer your question or did I miss the point? > - I wonder whether "recipes" like these are a convenient method of > customizing this facility: do people really find it easy to write > "ordered" property lists for this purpose? I find the resulting syntax very easy to read: (recipe :remove-suffix ".js" :add-suffix "-tests.js" :add-directory "tests"= :case-transformer uncapitalize) (recipe :remove-suffix ".js" :add-suffix ".spec.component.js" :filler (yasn= ippet :name "componentSpec")) (recipe :remove-suffix ".js" :add-suffix ".less") (recipe :remove-suffix ".js" :add-suffix ".stories.js" :filler (yasnippet := name "stories"))) I think this is much clearer than using regular expressions but this is maybe only me? If you don't like the recipe syntax, we can leave this one out of the patch and only include regexp-based jumpers. What do you expect from me now? Send a new patch with the new package name? Or do you plan to give more feedback first? Lars Ingebrigtsen writes: > I think jumprel would probably be better suited as an ELPA > package. Like completion frameworks, there's no one size fits all in > this area -- the DWIM for one person isn't the DWIM for another > person. Thank you very much Lars for giving feedback on this package! I appreciate your point of view because you've already written a similar feature which probably means you are using it. > jumprel is a different take on what find-file does, just like Helm is > a different take how completion should look. I'm not sure I understand what you mean. I agree that there is no point in having 10 many different completion frameworks in Emacs core (even though we might be close to this number already =F0=9F=98=8A). Similarly, I wouldn't like to have 3 find-related-files packages. But I think that, contrary to completion frameworks, these 3 packages provide the same feature: namely "a command to find file(s) related to the current one". Said differently, the user-visible behavior is the same. As soon as the setup is done, there shouldn't any difference between `find-sibling-file' and `jumprel'. Is there anything in your process that would change if you would switch from `find-sibling-file' to `jumprel'? In my opinion, what differs between these packages is the extensibility of the implementation. If regexps are a good solution to configure relations between files, both packages support that thanks to your work. But if users want something else, they could only get it in `jumprel': either with functions, with recipes or with something else of their creation. Also, jumprel supports creation of related files and automatic filling of new files through an extensible mechanism I called a "filler". Best --=20 Damien Cassou "Success is the ability to go from one failure to another without losing enthusiasm." --Winston Churchill