GNU bug report logs - #24245
25.0.93; AUCTeX TeX-function-p

Previous Next

Package: auctex;

Reported by: <4854nw+cqdha1cwehn9k <at> guerrillamail.com>

Date: Tue, 16 Aug 2016 20:28:01 UTC

Severity: wishlist

Done: Mosè Giordano <mose <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 24245 in the body.
You can then email your comments to 24245 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#24245; Package emacs. (Tue, 16 Aug 2016 20:28:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to <4854nw+cqdha1cwehn9k <at> guerrillamail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 16 Aug 2016 20:28:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: <4854nw+cqdha1cwehn9k <at> guerrillamail.com>
To: "bug-gnu-emacs <at> gnu.org" <bug-gnu-emacs <at> gnu.org>
Subject: 25.0.93; AUCTeX TeX-function-p
Date: Tue, 16 Aug 2016 20:16:12 +0000
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.

A similar function, `message-functionp', in `message.el' has been
removed. See Debian Bug report log #223493.

- a.

In GNU Emacs 25.0.93.1 (x86_64-w64-mingw32)
 of 2016-04-23 built on KAEL
Windowing system distributor 'Microsoft Corp.', version 10.0.14393
Configured using:
 'configure --prefix=/tmp/emacs --without-imagemagick 'CFLAGS=-O2
 -fomit-frame-pointer -g0''

Configured features:
XPM JPEG TIFF GIF PNG RSVG SOUND DBUS NOTIFY ACL GNUTLS LIBXML2 ZLIB
TOOLKIT_SCROLL_BARS





----
Sent using GuerrillaMail.com
Block or report abuse: https://www.guerrillamail.com/abuse/?a=Q1RzSAoOVvkQhQ%2B3414YfAGJQtiX







bug reassigned from package 'emacs' to 'auctex'. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Tue, 16 Aug 2016 20:30:03 GMT) Full text and rfc822 format available.

bug No longer marked as found in versions 25.0.93. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Tue, 16 Aug 2016 20:30:03 GMT) Full text and rfc822 format available.

Severity set to 'wishlist' from 'normal' Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Tue, 16 Aug 2016 20:30:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-auctex <at> gnu.org:
bug#24245; Package auctex. (Fri, 19 Aug 2016 16:43:01 GMT) Full text and rfc822 format available.

Message #14 received at 24245 <at> debbugs.gnu.org (full text, mbox):

From: Robert Cochran <robert-emacs <at> cochranmail.com>
To: <4854nw+cqdha1cwehn9k <at> guerrillamail.com>
Cc: 24245 <at> debbugs.gnu.org
Subject: Re: bug#24245: 25.0.93; AUCTeX TeX-function-p
Date: Fri, 19 Aug 2016 09:42:24 -0700
<4854nw+cqdha1cwehn9k <at> guerrillamail.com> 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`.

> A similar function, `message-functionp', in `message.el' has been
> removed. See Debian Bug report log #223493.

I'd imagine this case is slightly different, as Gnus is an Emacs builtin
(since 1997 if the logs are accurate), so there's a tighter intergration
with the progression of Emacs than AUCTeX. I'm sure that it's a similar
situation here: the invention of `message-functionp` predates that of
`functionp`.

I'd also like to point out that the original reporter reported it
because he was apparently having autoload issues, so `message-functionp`
wasn't defined, which is probably how it got noticed in the first place.

It's probably a good idea to fix it in the AUCTeX repository by removing
`TeX-function-p` and do a M-% for `functionp` and ensuring nothing gets
borked when you do so. I believe the phrase is "patches welcome". :)

(Disclaimer: This is independent and likely incomplete research, along
with what are my best guesses so far as the history bits. Anyone that
sees I've gotten something wrong or missed an important point, please
report in.)

HTH

-- 
~Robert Cochran

GPG Fingerprint - E778 2DD4 FEA6 6A68 6F26  AD2D E5C3 EB36 4886 8871




Reply sent to Mosè Giordano <mose <at> gnu.org>:
You have taken responsibility. (Sun, 21 Aug 2016 14:52:02 GMT) Full text and rfc822 format available.

Notification sent to <4854nw+cqdha1cwehn9k <at> guerrillamail.com>:
bug acknowledged by developer. (Sun, 21 Aug 2016 14:52:02 GMT) Full text and rfc822 format available.

Message #19 received at 24245-done <at> debbugs.gnu.org (full text, mbox):

From: Mosè Giordano <mose <at> gnu.org>
To: Robert Cochran <robert-emacs <at> cochranmail.com>
Cc: 24245-done <at> debbugs.gnu.org, 4854nw+cqdha1cwehn9k <at> guerrillamail.com
Subject: Re: bug#24245: 25.0.93; AUCTeX TeX-function-p
Date: Sun, 21 Aug 2016 16:51:00 +0200
Hi

2016-08-19 18:42 GMT+02:00 Robert Cochran <robert-emacs <at> cochranmail.com>:
> <4854nw+cqdha1cwehn9k <at> guerrillamail.com> 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è




Information forwarded to bug-auctex <at> gnu.org:
bug#24245; Package auctex. (Fri, 02 Sep 2016 02:41:02 GMT) Full text and rfc822 format available.

Message #22 received at 24245 <at> debbugs.gnu.org (full text, mbox):

From: npostavs <at> users.sourceforge.net
To: mose <at> gnu.org
Cc: 24245 <at> debbugs.gnu.org, robert-emacs <at> cochranmail.com,
 4854nw+cqdha1cwehn9k <at> guerrillamail.com
Subject: Re: bug#24245: closed (Re: bug#24245: 25.0.93; AUCTeX TeX-function-p)
Date: Thu, 01 Sep 2016 22:40:44 -0400
From: Mosè Giordano <mose <at> gnu.org>
>Hi
>
>2016-08-19 18:42 GMT+02:00 Robert Cochran <robert-emacs <at> cochranmail.com>:
>> <4854nw+cqdha1cwehn9k <at> guerrillamail.com> 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 possibly worse, since `TeX-function-p' will misidentify closures as
non-functions.

>>
>> 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.

It might cause problems in Emacs 22, I find this in NEWS.23:

    * Incompatible Lisp Changes in Emacs 23.1
    [...]
    ** `functionp' returns nil for special forms.
    I.e., it only returns t for objects that can be passed to `funcall'.

From which I gather that before then, `functionp' would return t for
special forms.






Information forwarded to bug-auctex <at> gnu.org:
bug#24245; Package auctex. (Fri, 02 Sep 2016 22:53:02 GMT) Full text and rfc822 format available.

Message #25 received at 24245 <at> debbugs.gnu.org (full text, mbox):

From: Mosè Giordano <mose <at> gnu.org>
To: npostavs <at> users.sourceforge.net
Cc: 24245 <at> debbugs.gnu.org, Robert Cochran <robert-emacs <at> cochranmail.com>,
 4854nw+cqdha1cwehn9k <at> guerrillamail.com
Subject: Re: bug#24245: closed (Re: bug#24245: 25.0.93; AUCTeX TeX-function-p)
Date: Sat, 3 Sep 2016 00:51:12 +0200
Hi,

2016-09-02 4:40 GMT+02:00  <npostavs <at> users.sourceforge.net>:
> It might cause problems in Emacs 22, I find this in NEWS.23:
>
>     * Incompatible Lisp Changes in Emacs 23.1
>     [...]
>     ** `functionp' returns nil for special forms.
>     I.e., it only returns t for objects that can be passed to `funcall'.
>
> From which I gather that before then, `functionp' would return t for
> special forms.

Thanks for sharing this, however the expanders in
`TeX-expand-list-builtin' are all lambdas or function names, so there
shouldn't be problems. In addition special forms can be easily wrapped
in a lambda.

Bye,
Mosè




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 01 Oct 2016 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 8 years and 314 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.