Am 14.02.21 um 09:12 schrieb Johannes Sixt:
Am 14.02.21 um 02:41 schrieb Ævar Arnfjörð Bjarmason:
Just a cursory "git log -p -- lisp" in emacs.git with your patch shows
e.g. lisp/thingatpt.el where forms in a "defun" aren't indented (before
it selects the "defun", after with yours it's a "put" in the middle of
the function).
Note that negative matches can be specified. We use the feature in the
cpp case to exclude public:/protected:/private: and label: that happen
to be not indented. Perhaps that can be useful here?
Oh, and BTW, what the patterns treat as "function" must not match what
I meant to say "need not match".
the language treats as function. The purpose of the hunk header is to
spot a place in the source file easily. So, it does not hurt if
eval-and-compile forms are captured (as was mentioned in the linked
thread) if desired.
Yours also changes it from e.g.:
@@ -61,7 +61,7 @@ forward-thing
to:
@@ -61,7 +61,7 @@ (defun forward-thing (thing &optional n)
Is this really desired in elisp?
It's common practice to extract the entire line (sans indentation if
applicable), not just the function name. Why would somebody want the
latter? It doesn't carry as much information as could be possible.
I also note how our tests in
t4018-diff-funcname.sh are really bad in not testing for this at
all. I.e. we just test that we match the right line, not how we extract
a match from it.
Oh, well. These are "semi-automated" tests cases. If you have an idea
how to achieve the goal without burdening test writers with lots of
subtleties, be my guest. ;)
1. https://lists.gnu.org/archive/html/emacs-devel/2021-02/msg00739.html
-- Hannes