Subject: Re: bug#24245: 25.0.93; AUCTeX TeX-function-p

From: Mosè Giordano <[email-masked]>
Date: Sun, 21 Aug 2016 16:51:00 +0200

Hi

2016-08-19 18:42 GMT+02:00 Robert Cochran <[email-masked]>:
> <[email-masked]> writes:
>
>> What is the actual purpose of the Lisp function `TeX-function-p' found
>> in AUCTeX ‘tex.el’?
>>
>> (defun TeX-function-p (arg)
>>   "Return non-nil if ARG is callable as a function."
>>   (or (and (fboundp 'byte-code-function-p)
>>        (byte-code-function-p arg))
>>       (and (listp arg)
>>        (eq (car arg) 'lambda))
>>       (and (symbolp arg)
>>          (fboundp arg))))
>>
>> How this code is better of `functionp'?
>> If there is no actual design improvement of `TeX-function-p' over
>> `functionp', the latter is supposed to be faster as it is built-in.
>
> It's not 'better'. A blame of the AUCTeX repository shows that
> `TeX-function-p` was written (and last touched) in 1994. The only
> history that's in the Emacs repository commit-wise about `functionp`
> dates back to 2010, and the files within it show relevant history from
> 2005 (which aren't in the repo as their own commits). Doubtless it's
> hard to pin down without the complete history, but it's likely
> `TeX-function-p` was written before `functionp`.

`functionp' seems to have been introduced in Emacs with commit:

    * a9a44ed (1997-04-12)  (functionp): New function.

so well before GNU Emacs 21.1, that is the oldest version of Emacs we
aim to support.  I agree `functionp' should be able to safely replace
`TeX-function-p', I tested with Emacs 22, 23, and 24.

AUCTeX turned 25 a few months ago, being so old you may find other
such crufts: sometimes they're needed to keep compatibility with old
Emacsens, other times (like this one) they can be replaced with well
established Emacs functions.

Thanks for the report.

Bye,
Mosè