[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Do shorthands break basic tooling (tags, grep, etc)? (was Re: Shorth
From: |
Stefan Monnier |
Subject: |
Re: Do shorthands break basic tooling (tags, grep, etc)? (was Re: Shorthands have landed on master) |
Date: |
Tue, 28 Sep 2021 08:40:05 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
> emacs -Q
> M-x load-file RET lisp/profiler.el RET
> C-x C-f lisp/profiler.el RET
> C-u 10006 M-g c ;; this puts point on a call to profiler-make-calltree
> M-.
>
> The result is an error message.
This is a "loading order" bug: if you somehow load `cl-extra` (which
tends to happen more often than I expected, so the bug "disappeared"
when I tried to dig into it) you won't get the error any more.
IOW the fix is this chunk of code in `cl-extra.el`:
(with-eval-after-load 'find-func
(defvar find-function-regexp-alist)
(add-to-list 'find-function-regexp-alist
'(define-type . cl--typedef-regexp)))
we should probably move it to something like `cl-preloaded.el`.
> This happens to me quite a lot recently,
The above is a plain bug.
> as more and more code is converted to using cl-defstruct.
In the above example, the problem is fairly minor (I mean, after fixing
the bug), but it gets worse in two cases:
- when the `cl-defstruct` has several longish constructors:
`M-.` jumps to the `cl-defstruct` but not to the actual place where
`profiler-make-calltree` is defined within the `cl-defstruct`.
- when jumping to an accessor (rather than a constructor) because the
accessor's name is not present literally in the `cl-defstruct`
so you jumped from `foo-bar` and you end up on a `cl-defstruct` for
`foo` and need to know that the `bar` symbol you might find a few
lines below is the one that caused the definition of `foo-bar`.
It shouldn't be very hard [IOW, I encourage some of the readers here to
go out and do it] to refine/extend the `find-function-regexp-alist`
mechanism so that `M-.` jumps directly to the actual `:constructor`
thingy or to the actual field corresponding to an accessor.
> Then I guess you dislike cl-defstruct, add-function, pcase, and other
> macros and features that change how the source code looks and produce
> symbols under the hood?
Neither `pcase` nor `add-function` generate symbols under the hood
(other than gensym'd ones, admittedly, but these aren't relevant in
this discussion). `cl-defstruct` does, tho only for field accessors and
not for the constructor you showed in your example.
>> Long names being "tedious" (quoting the new info manual) to read
>> and write seems like an insufficient reason, IMHO.
As a researcher in programming languages, I tend to take it for granted
that "syntax doesn't matter", but in reality details of syntax have
enormous impacts on how languages are used and perceived, so I really
wouldn't dismiss "tedious" as an insufficient reason.
Stefan
- Re: Do shorthands break basic tooling (tags, grep, etc)? (was Re: Shorthands have landed on master), (continued)
- Re: Do shorthands break basic tooling (tags, grep, etc)? (was Re: Shorthands have landed on master), André A . Gomes, 2021/09/30
- Re: Do shorthands break basic tooling (tags, grep, etc)? (was Re: Shorthands have landed on master), André A . Gomes, 2021/09/30
- Re: Do shorthands break basic tooling (tags, grep, etc)? (was Re: Shorthands have landed on master), Gregory Heytings, 2021/09/30
- Re: Do shorthands break basic tooling (tags, grep, etc)? (was Re: Shorthands have landed on master), João Távora, 2021/09/30
- Re: Do shorthands break basic tooling (tags, grep, etc)? (was Re: Shorthands have landed on master), Tomas Hlavaty, 2021/09/30
- Re: Do shorthands break basic tooling (tags, grep, etc)? (was Re: Shorthands have landed on master), Tomas Hlavaty, 2021/09/30
Re: Do shorthands break basic tooling (tags, grep, etc)? (was Re: Shorthands have landed on master), Eli Zaretskii, 2021/09/28
Re: Do shorthands break basic tooling (tags, grep, etc)? (was Re: Shorthands have landed on master), Alan Mackenzie, 2021/09/28
- Re: Do shorthands break basic tooling (tags, grep, etc)? (was Re: Shorthands have landed on master), Eli Zaretskii, 2021/09/28
- Re: Do shorthands break basic tooling (tags, grep, etc)? (was Re: Shorthands have landed on master), Alan Mackenzie, 2021/09/28
- Re: Do shorthands break basic tooling (tags, grep, etc)? (was Re: Shorthands have landed on master), Eli Zaretskii, 2021/09/28
- Re: Do shorthands break basic tooling (tags, grep, etc)? (was Re: Shorthands have landed on master), Phil Sainty, 2021/09/30
- Re: Do shorthands break basic tooling (tags, grep, etc)? (was Re: Shorthands have landed on master), Gregory Heytings, 2021/09/30
- Re: Do shorthands break basic tooling (tags, grep, etc)? (was Re: Shorthands have landed on master), Gregory Heytings, 2021/09/30
Re: Do shorthands break basic tooling (tags, grep, etc)? (was Re: Shorthands have landed on master), Tomas Hlavaty, 2021/09/30