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

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

bug#55778: 29.0.50; [PATCH] M-. into a .gz; we've all been there.


From: Lars Ingebrigtsen
Subject: bug#55778: 29.0.50; [PATCH] M-. into a .gz; we've all been there.
Date: Sun, 05 Jun 2022 15:49:04 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Lars Ingebrigtsen <larsi@gnus.org> writes:

> The idea of the feature is good, though, but can probably be implemented
> as a simple file name regexp substitution in the xref machinery that
> says "if we were going to jump to
> /usr/share/emacs/27.1/lisp/gnus/gnus.el.gz, then jump to
> /usr/src/emacs/27.1/lisp/gnus/gnus.el" instead.

This reminded me of something Stefan M said the other day(ish) -- it'd
be nice to be able to jump to "another file" that's somehow tied to the
current file.  For instance, jump to files-tests.el from files.el, or to
emacs-28/lisp/files.el when you're in trunk/lisp/files.el, or jump to
foo.h when you're in foo.c.

And this is basically the same -- if you're in
/usr/share/emacs/27.1/lisp/abbrev.el.gz, then you want to jump to the
development sources.

So I've now added a new command `find-sibling-file' to Emacs 29.  This
setting does what the latter:

(setq find-sibling-rules
      '(("\\(/usr/share/emacs.*/\\(lisp/.*.el\\).gz\\)"
         "/home/larsi/src/emacs/trunk/\\2\\'")))

Something like this does the Emacs development sibling dance:

(setq find-sibling-rules
      '(("src/emacs/trunk/[^/]+/\\(.*\\)\\'" "src/emacs/emacs-28/.*/\\1\\'")
        ("emacs/trunk/\\(.*\\)\\.\\(c\\|el\\)\\'"
         "emacs/trunk/test/\\1-tests.el\\'")))

And this is foo.c -> foo.h:

(setq find-sibling-rules
      '(("\\([^/]+\\)\\.c\\'" "\\1.h")))

I'm not 100% sure about the semantics of the match/expansions here --
there may well be use cases I haven't considered, so this should
probably be tweaked a bit.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





reply via email to

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