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

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

bug#21466: [PATCH] Avoid defining (temporarily) vars and functions


From: Stefan Monnier
Subject: bug#21466: [PATCH] Avoid defining (temporarily) vars and functions
Date: Tue, 11 May 2021 18:03:38 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

> There are little things I'm unhappy about with the patch: it
> explicitly tests (featurep 'xemacs), which is not done in CC Mode,
> being regarded as somewhat vulgar.  Instead specific functionalities
> are always tested for.

I use (featurep 'xemacs) because it results in cleaner byte-code because
the compiler replaces it with nil.  It also usually results in fewer
spurious warnings (because of the removal of XEmacs-only code).
[ I believe the same holds on XEmacs where (featurep 'xemacs) is
  optimized to t, which removes Emacs-only code.  ]
But that's just my favorite bikeshed color, it's not crucial for the patch.

> Also, in place of cc-bytecomp-defun is proposed declare-function.
> However this is in an inconsistent state, with the documentation
> requiring a FILE argument, but Stefan's patch supplying nil.

`declare-function` says:

    The FILE argument is not used by the byte-compiler, but by the
    `check-declare' package, which checks that FILE contains a
    definition for FN.

So indeed, a real FILE argument would be preferable, but passing nil
works fine (it will simply prevent `check-declare` from making sure
that file indeed defines that function, which is no different than what
we have now with `cc-bytecomp-defun` which `check-declare` also
ignores).
If you want the "better" option, then it will require changing
`cc-bytecomp-defun` so it takes a FILE arg.


        Stefan






reply via email to

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