bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#64210: Allow ff-other-file-alist to specify which file to create


From: Aaron Zeng
Subject: bug#64210: Allow ff-other-file-alist to specify which file to create
Date: Wed, 21 Jun 2023 11:50:46 -0400

Tags: patch

Tags: patch


This patch adds an optional third element to the lists that make
ff-other-file-alist.  If this third element is present, it is used as
the extension for a new file, when none of the other options were
found.  Previously, this was forced to be the first extension in the
list, which unnecessarily coupled search order and file-to-create.

The specific use case I have in mind is for the following scenario in
OCaml source files: it is common to have the following three files for
a module "Foo": foo.ml, foo.mli, and foo_intf.ml.  I would like to
make ff-find-other-file cycle between these files if all of them
exist, or to create a new file if they do not.  However, it is also
normal for only foo.ml and foo.mli to exist, and foo_intf.ml should
not be created if it is not necessary.

At the moment, if the user is looking at foo.mli, there is no way to
program ff-other-file-alist to say, "go to foo_intf.ml if it exists,
otherwise foo.ml, but if neither exist, create foo.ml".  This patch
makes it possible to specify what file to create, if it is not the
first file searched for.

The manual has not yet been updated for this change, since I wanted to
get some feedback on the patch itself first.  Happy to make the
changes in the appropriate places if the patch looks reasonable.

In GNU Emacs 28.2 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo version 
1.15.12, Xaw scroll bars)
 of 2023-02-09 built on igm-qws-u12685a
Repository revision: 739b5d0e52d83ec567bd61a5a49ac0e93e0eb469
Repository branch: HEAD
Windowing system distributor 'The X.Org Foundation', version 11.0.12011000
System Description: CentOS Linux 7 (Core)

Configured using:
 'configure --with-x-toolkit=lucid --without-gpm --without-gconf
 --without-selinux --without-imagemagick --with-modules --with-gif=no
 --with-cairo --with-rsvg
 --prefix=/j/office/app/emacs/builds/28.2-20230209-135825'

Attachment: 0001-Allow-ff-other-file-alist-functions-to-be-lambdas.patch
Description: Text Data

Attachment: 0002-Allow-ff-other-file-alist-to-specify-the-extension-f.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]