* bug#56648: 29.0.50; Need for `compiled-function-p`
@ 2022-07-19 20:43 Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
[not found] ` <handler.56648.B.165826342614243.ack@debbugs.gnu.org>
2022-07-23 4:30 ` bug#56648: 29.0.50; Need for `compiled-function-p` Lars Ingebrigtsen
0 siblings, 2 replies; 16+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-07-19 20:43 UTC (permalink / raw)
To: 56648
Package: Emacs
Version: 29.0.50
I think we need something like `compiled-function-p`, i.e. a function
which will return non-nil for both byte-code and native-code functions.
Its definition would be
(defun compiled-function-p (obj)
"<Appropriate doc here>"
(or (byte-code-function-p obj)
(subr-native-elisp-p obj)))
This is because `byte-code-function-p` shouldn't be changed to return
non-nil for native-code functions (both because it would break a lot of
code and because the name would be too confusing), but several uses of
`byte-code-function-p` actually want to know "is this an (inefficient)
source code function or not" (e.g. in unidata-gen.el,
loadup.el, bytecomp.el, ...).
Stefan
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#56648: Acknowledgement (29.0.50; Need for `compiled-function-p`)
[not found] ` <handler.56648.B.165826342614243.ack@debbugs.gnu.org>
@ 2022-07-22 5:07 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-07-23 2:55 ` Mike Kupfer
0 siblings, 1 reply; 16+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-07-22 5:07 UTC (permalink / raw)
To: 56648
[-- Attachment #1: Type: text/plain, Size: 92 bytes --]
Here is a draft of a patch for that (no docs yet).
Any comment/suggestion?
Stefan
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: compiled-function.patch --]
[-- Type: text/x-diff, Size: 15085 bytes --]
diff --git a/admin/unidata/unidata-gen.el b/admin/unidata/unidata-gen.el
index 0a9fd5108ce..78dd1c37288 100644
--- a/admin/unidata/unidata-gen.el
+++ b/admin/unidata/unidata-gen.el
@@ -1083,8 +1083,8 @@ unidata-split-name
(defun unidata--ensure-compiled (&rest funcs)
(dolist (fun funcs)
- (or (byte-code-function-p (symbol-function fun))
- (byte-compile fun))))
+ (unless (compiled-function-p (symbol-function fun))
+ (byte-compile fun))))
(defun unidata-gen-table-name (prop index &rest _ignore)
(let* ((table (unidata-gen-table-word-list prop index 'unidata-split-name))
diff --git a/lisp/cedet/semantic/bovine.el b/lisp/cedet/semantic/bovine.el
index 1e52b1f8504..1ab27e33403 100644
--- a/lisp/cedet/semantic/bovine.el
+++ b/lisp/cedet/semantic/bovine.el
@@ -143,14 +143,15 @@ semantic-bovinate-stream
cvl nil ;re-init the collected value list.
lte (car matchlist) ;Get the local matchlist entry.
)
- (if (or (byte-code-function-p (car lte))
+ ;; FIXME: Should this `or' be replaced with `functionp'?
+ (if (or (compiled-function-p (car lte))
(listp (car lte)))
;; In this case, we have an EMPTY match! Make
;; stuff up.
(setq cvl (list nil))))
(while (and lte
- (not (byte-code-function-p (car lte)))
+ (not (compiled-function-p (car lte)))
(not (listp (car lte))))
;; GRAMMAR SOURCE DEBUGGING!
diff --git a/lisp/emacs-lisp/advice.el b/lisp/emacs-lisp/advice.el
index 86a42b208e7..11d055e2059 100644
--- a/lisp/emacs-lisp/advice.el
+++ b/lisp/emacs-lisp/advice.el
@@ -1060,9 +1060,9 @@
;; (print "Let's clean up now!"))
;; foo
;;
-;; Now `foo's advice is byte-compiled:
+;; Now `foo's advice is compiled:
;;
-;; (byte-code-function-p 'ad-Advice-foo)
+;; (compiled-function-p 'ad-Advice-foo)
;; t
;;
;; (foo 3)
@@ -1304,7 +1304,7 @@
;; constructed during preactivation was used, even though we did not specify
;; the `compile' flag:
;;
-;; (byte-code-function-p 'ad-Advice-fum)
+;; (compiled-function-p 'ad-Advice-fum)
;; t
;;
;; (fum 2)
@@ -1335,7 +1335,7 @@
;;
;; A new uncompiled advised definition got constructed:
;;
-;; (byte-code-function-p 'ad-Advice-fum)
+;; (compiled-function-p 'ad-Advice-fum)
;; nil
;;
;; (fum 2)
@@ -2124,9 +2124,9 @@ ad-advice-p
(defsubst ad-compiled-p (definition)
"Return non-nil if DEFINITION is a compiled byte-code object."
- (or (byte-code-function-p definition)
- (and (macrop definition)
- (byte-code-function-p (ad-lambdafy definition)))))
+ (or (compiled-function-p definition)
+ (and (macrop definition)
+ (compiled-function-p (ad-lambdafy definition)))))
(defsubst ad-compiled-code (compiled-definition)
"Return the byte-code object of a COMPILED-DEFINITION."
diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el
index 5705b2a8fd7..0f4131a658d 100644
--- a/lisp/emacs-lisp/byte-opt.el
+++ b/lisp/emacs-lisp/byte-opt.el
@@ -2476,8 +2476,7 @@ byte-optimize-lapcode
;; itself, compile some of its most used recursive functions (at load time).
;;
(eval-when-compile
- (or (byte-code-function-p (symbol-function 'byte-optimize-form))
- (subr-native-elisp-p (symbol-function 'byte-optimize-form))
+ (or (compiled-function-p (symbol-function 'byte-optimize-form))
(assq 'byte-code (symbol-function 'byte-optimize-form))
(let ((byte-optimize nil)
(byte-compile-warnings nil))
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 86681cf4dd4..2cccc85f9c3 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -1393,7 +1393,7 @@ byte-compile-fdefinition
(or (symbolp (symbol-function fn))
(consp (symbol-function fn))
(and (not macro-p)
- (byte-code-function-p (symbol-function fn)))))
+ (compiled-function-p (symbol-function fn)))))
(setq fn (symbol-function fn)))
(let ((advertised (gethash (if (and (symbolp fn) (fboundp fn))
;; Could be a subr.
@@ -1405,7 +1405,7 @@ byte-compile-fdefinition
(if macro-p
`(macro lambda ,advertised)
`(lambda ,advertised)))
- ((and (not macro-p) (byte-code-function-p fn)) fn)
+ ((and (not macro-p) (compiled-function-p fn)) fn)
((not (consp fn)) nil)
((eq 'macro (car fn)) (cdr fn))
(macro-p nil)
@@ -2957,11 +2957,11 @@ byte-compile
(setq fun (cdr fun)))
(prog1
(cond
- ;; Up until Emacs-24.1, byte-compile silently did nothing when asked to
- ;; compile something invalid. So let's tune down the complaint from an
- ;; error to a simple message for the known case where signaling an error
- ;; causes problems.
- ((byte-code-function-p fun)
+ ;; Up until Emacs-24.1, byte-compile silently did nothing
+ ;; when asked to compile something invalid. So let's tone
+ ;; down the complaint from an error to a simple message for
+ ;; the known case where signaling an error causes problems.
+ ((compiled-function-p fun)
(message "Function %s is already compiled"
(if (symbolp form) form "provided"))
fun)
@@ -3538,7 +3538,7 @@ byte-compile-inline-lapcode
(byte-compile-out-tag endtag)))
(defun byte-compile-unfold-bcf (form)
- "Inline call to byte-code-functions."
+ "Inline call to byte-code function."
(let* ((byte-compile-bound-variables byte-compile-bound-variables)
(fun (car form))
(fargs (aref fun 0))
@@ -5272,11 +5272,13 @@ display-call-tree
((not (consp f))
"<malformed function>")
((eq 'macro (car f))
- (if (or (byte-code-function-p (cdr f))
+ (if (or (compiled-function-p (cdr f))
+ ;; FIXME: Can this still happen?
(assq 'byte-code (cdr (cdr (cdr f)))))
" <compiled macro>"
" <macro>"))
((assq 'byte-code (cdr (cdr f)))
+ ;; FIXME: Can this still happen?
"<compiled lambda>")
((eq 'lambda (car f))
"<function>")
@@ -5525,9 +5527,7 @@ byte-compile-report-ops
;; itself, compile some of its most used recursive functions (at load time).
;;
(eval-when-compile
- (or (byte-code-function-p (symbol-function 'byte-compile-form))
- (subr-native-elisp-p (symbol-function 'byte-compile-form))
- (assq 'byte-code (symbol-function 'byte-compile-form))
+ (or (compiled-function-p (symbol-function 'byte-compile-form))
(let ((byte-optimize nil) ; do it fast
(byte-compile-warnings nil))
(mapc (lambda (x)
diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el
index 6646167b92b..ea3c23e7b54 100644
--- a/lisp/emacs-lisp/cl-macs.el
+++ b/lisp/emacs-lisp/cl-macs.el
@@ -3408,7 +3408,7 @@ cl--macroexp-fboundp
(character . natnump)
(char-table . char-table-p)
(command . commandp)
- (compiled-function . byte-code-function-p)
+ (compiled-function . compiled-function-p)
(hash-table . hash-table-p)
(cons . consp)
(fixnum . fixnump)
diff --git a/lisp/emacs-lisp/macroexp.el b/lisp/emacs-lisp/macroexp.el
index 6a193a56d2d..5ae9d8368f0 100644
--- a/lisp/emacs-lisp/macroexp.el
+++ b/lisp/emacs-lisp/macroexp.el
@@ -823,7 +823,7 @@ internal-macroexpand-for-load
(eval-when-compile
(add-hook 'emacs-startup-hook
(lambda ()
- (and (not (byte-code-function-p
+ (and (not (compiled-function-p
(symbol-function 'macroexpand-all)))
(locate-library "macroexp.elc")
(load "macroexp.elc")))))
diff --git a/lisp/emacs-lisp/pcase.el b/lisp/emacs-lisp/pcase.el
index 07443dabfef..10bd4bc6886 100644
--- a/lisp/emacs-lisp/pcase.el
+++ b/lisp/emacs-lisp/pcase.el
@@ -607,31 +607,38 @@ pcase-mutually-exclusive-predicates
(symbolp . vectorp)
(symbolp . stringp)
(symbolp . byte-code-function-p)
+ (symbolp . compiled-function-p)
(symbolp . recordp)
(integerp . consp)
(integerp . arrayp)
(integerp . vectorp)
(integerp . stringp)
(integerp . byte-code-function-p)
+ (integerp . compiled-function-p)
(integerp . recordp)
(numberp . consp)
(numberp . arrayp)
(numberp . vectorp)
(numberp . stringp)
(numberp . byte-code-function-p)
+ (numberp . compiled-function-p)
(numberp . recordp)
(consp . arrayp)
(consp . atom)
(consp . vectorp)
(consp . stringp)
(consp . byte-code-function-p)
+ (consp . compiled-function-p)
(consp . recordp)
(arrayp . byte-code-function-p)
+ (arrayp . compiled-function-p)
(vectorp . byte-code-function-p)
+ (vectorp . compiled-function-p)
(vectorp . recordp)
(stringp . vectorp)
(stringp . recordp)
- (stringp . byte-code-function-p)))
+ (stringp . byte-code-function-p)
+ (stringp . compiled-function-p)))
(defun pcase--mutually-exclusive-p (pred1 pred2)
(or (member (cons pred1 pred2)
@@ -771,8 +778,8 @@ pcase--split-pred
((consp (cadr pat)) #'consp)
((stringp (cadr pat)) #'stringp)
((vectorp (cadr pat)) #'vectorp)
- ((byte-code-function-p (cadr pat))
- #'byte-code-function-p))))
+ ((compiled-function-p (cadr pat))
+ #'compiled-function-p))))
(pcase--mutually-exclusive-p (cadr upat) otherpred))
'(:pcase--fail . nil))
;; Since we turn (or 'a 'b 'c) into (pred (pcase--flip (memq '(a b c))))
diff --git a/lisp/gnus/gnus.el b/lisp/gnus/gnus.el
index 8221f3017a2..7896babbb35 100644
--- a/lisp/gnus/gnus.el
+++ b/lisp/gnus/gnus.el
@@ -4169,8 +4169,7 @@ gnus
;; file.
(unless (string-match "^Gnus" gnus-version)
(load "gnus-load" nil t))
- (unless (or (byte-code-function-p (symbol-function 'gnus))
- (subr-native-elisp-p (symbol-function 'gnus)))
+ (unless (compiled-function-p (symbol-function 'gnus))
(message "You should compile Gnus")
(sit-for 2))
(let ((gnus-action-message-log (list nil)))
diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index dc64a09f3d8..7978108988b 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -1009,7 +1009,7 @@ help-fns-function-description-header
(help-fns--analyze-function function))
(file-name (find-lisp-object-file-name
function (if aliased 'defun def)))
- (beg (if (and (or (byte-code-function-p def)
+ (beg (if (and (or (compiled-function-p def)
(keymapp def)
(memq (car-safe def) '(macro lambda closure)))
(stringp file-name)
@@ -1044,7 +1044,7 @@ help-fns-function-description-header
(t "Lisp function"))))
((or (eq (car-safe def) 'macro)
;; For advised macros, def is a lambda
- ;; expression or a byte-code-function-p, so we
+ ;; expression or a compiled-function-p, so we
;; need to check macros before functions.
(macrop function))
(concat beg "Lisp macro"))
@@ -1538,8 +1538,8 @@ help-fns--var-safe-local
(when safe-var
(princ " This variable is safe as a file local variable ")
(princ "if its value\n satisfies the predicate ")
- (princ (if (byte-code-function-p safe-var)
- "which is a byte-compiled expression.\n"
+ (princ (if (compiled-function-p safe-var)
+ "which is a compiled expression.\n"
(format-message "`%s'.\n" safe-var))))))
(add-hook 'help-fns-describe-variable-functions #'help-fns--var-risky)
diff --git a/lisp/loadup.el b/lisp/loadup.el
index 21a87dbd77b..669470926fe 100644
--- a/lisp/loadup.el
+++ b/lisp/loadup.el
@@ -159,8 +159,7 @@
;; Load-time macro-expansion can only take effect after setting
;; load-source-file-function because of where it is called in lread.c.
(load "emacs-lisp/macroexp")
-(if (or (byte-code-function-p (symbol-function 'macroexpand-all))
- (subr-native-elisp-p (symbol-function 'macroexpand-all)))
+(if (compiled-function-p (symbol-function 'macroexpand-all))
nil
;; Since loaddefs is not yet loaded, macroexp's uses of pcase will simply
;; fail until pcase is explicitly loaded. This also means that we have to
diff --git a/lisp/mh-e/mh-e.el b/lisp/mh-e/mh-e.el
index a3a363e33ff..741de9cb88a 100644
--- a/lisp/mh-e/mh-e.el
+++ b/lisp/mh-e/mh-e.el
@@ -389,11 +389,11 @@ mh-version
(insert "MH-E " mh-version "\n\n")
;; MH-E compilation details.
(insert "MH-E compilation details:\n")
- (let* ((compiled-mhe (byte-code-function-p (symbol-function 'mh-version)))
+ (let* ((compiled-mhe (compiled-function-p (symbol-function 'mh-version)))
(gnus-compiled-version (if compiled-mhe
(mh-macro-expansion-time-gnus-version)
"N/A")))
- (insert " Byte compiled:\t\t" (if compiled-mhe "yes" "no") "\n"
+ (insert " Compiled:\t\t" (if compiled-mhe "yes" "no") "\n"
" Gnus (compile-time):\t" gnus-compiled-version "\n"
" Gnus (run-time):\t" (mh-run-time-gnus-version) "\n\n"))
;; Emacs version.
diff --git a/lisp/subr.el b/lisp/subr.el
index 510a77dbc8d..a3066cf96fd 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -4019,6 +4019,12 @@ macrop
(or (eq 'macro (car def))
(and (autoloadp def) (memq (nth 4 def) '(macro t)))))))
+(defun compiled-function-p (object)
+ "Return non-nil if OBJECT is a function that has been compiled.
+Does not distinguish between functions implemented in machine code
+or byte-code."
+ (or (subrp object) (byte-code-function-p)))
+
(defun field-at-pos (pos)
"Return the field at position POS, taking stickiness etc into account."
(let ((raw-field (get-char-property (field-beginning pos) 'field)))
diff --git a/test/lisp/international/ucs-normalize-tests.el b/test/lisp/international/ucs-normalize-tests.el
index 27a4e70c78e..774a3ea7ec9 100644
--- a/test/lisp/international/ucs-normalize-tests.el
+++ b/test/lisp/international/ucs-normalize-tests.el
@@ -246,7 +246,7 @@ ucs-normalize-part1
ucs-normalize-tests--rule1-failing-for-partX
ucs-normalize-tests--rule1-holds-p
ucs-normalize-tests--rule2-holds-p))
- (or (byte-code-function-p (symbol-function fun))
+ (or (compiled-function-p (symbol-function fun))
(byte-compile fun)))
(let ((ucs-normalize-tests--chars-part1 (make-char-table 'ucs-normalize-tests t)))
(setq ucs-normalize-tests--part1-rule1-failed-lines
^ permalink raw reply related [flat|nested] 16+ messages in thread
* bug#56648: Acknowledgement (29.0.50; Need for `compiled-function-p`)
2022-07-22 5:07 ` bug#56648: Acknowledgement (29.0.50; Need for `compiled-function-p`) Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-07-23 2:55 ` Mike Kupfer
2022-07-23 13:51 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 16+ messages in thread
From: Mike Kupfer @ 2022-07-23 2:55 UTC (permalink / raw)
To: Stefan Monnier; +Cc: 56648
+(defun compiled-function-p (object)
+ "Return non-nil if OBJECT is a function that has been compiled.
+Does not distinguish between functions implemented in machine code
+or byte-code."
+ (or (subrp object) (byte-code-function-p)))
Doesn't byte-code-function-p require an argument?
mike
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#56648: 29.0.50; Need for `compiled-function-p`
2022-07-19 20:43 bug#56648: 29.0.50; Need for `compiled-function-p` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
[not found] ` <handler.56648.B.165826342614243.ack@debbugs.gnu.org>
@ 2022-07-23 4:30 ` Lars Ingebrigtsen
2022-07-24 0:27 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
1 sibling, 1 reply; 16+ messages in thread
From: Lars Ingebrigtsen @ 2022-07-23 4:30 UTC (permalink / raw)
To: Stefan Monnier; +Cc: 56648
Stefan Monnier <monnier@iro.umontreal.ca> writes:
> This is because `byte-code-function-p` shouldn't be changed to return
> non-nil for native-code functions (both because it would break a lot of
> code and because the name would be too confusing), but several uses of
> `byte-code-function-p` actually want to know "is this an (inefficient)
> source code function or not" (e.g. in unidata-gen.el,
> loadup.el, bytecomp.el, ...).
Makes sense to me. <bikeshed>But since the use case is "is this one of
those slow source code functions?" then why not reverse the logic and
call it `uncompiled-function-p'?</bikeshed>
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#56648: Acknowledgement (29.0.50; Need for `compiled-function-p`)
2022-07-23 2:55 ` Mike Kupfer
@ 2022-07-23 13:51 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 0 replies; 16+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-07-23 13:51 UTC (permalink / raw)
To: Mike Kupfer; +Cc: 56648
Mike Kupfer [2022-07-22 19:55:49] wrote:
> Doesn't byte-code-function-p require an argument?
Nah... arguments are overrated!
And besides, we already have so many of them on emacs-devel, do we
really need more?
Stefan "thanks!"
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#56648: 29.0.50; Need for `compiled-function-p`
2022-07-23 4:30 ` bug#56648: 29.0.50; Need for `compiled-function-p` Lars Ingebrigtsen
@ 2022-07-24 0:27 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-07-24 9:22 ` Lars Ingebrigtsen
0 siblings, 1 reply; 16+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-07-24 0:27 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: 56648
Lars Ingebrigtsen [2022-07-23 06:30:03] wrote:
> Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> This is because `byte-code-function-p` shouldn't be changed to return
>> non-nil for native-code functions (both because it would break a lot of
>> code and because the name would be too confusing), but several uses of
>> `byte-code-function-p` actually want to know "is this an (inefficient)
>> source code function or not" (e.g. in unidata-gen.el,
>> loadup.el, bytecomp.el, ...).
>
> Makes sense to me. <bikeshed>But since the use case is "is this one of
> those slow source code functions?" then why not reverse the logic and
> call it `uncompiled-function-p'?</bikeshed>
I can think of 2 reasons:
A) `compiled-function-p` exists in Common-Lisp.
B) It would require redoing some of the work I've just done because
(uncompiled-function-p X) != (not (compiled-function-p X))
when X is not a function, so it's not just a simple search&replace.
-- Stefan
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#56648: 29.0.50; Need for `compiled-function-p`
2022-07-24 0:27 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-07-24 9:22 ` Lars Ingebrigtsen
2022-08-14 16:30 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 16+ messages in thread
From: Lars Ingebrigtsen @ 2022-07-24 9:22 UTC (permalink / raw)
To: Stefan Monnier; +Cc: 56648
Stefan Monnier <monnier@iro.umontreal.ca> writes:
> A) `compiled-function-p` exists in Common-Lisp.
>
> B) It would require redoing some of the work I've just done because
>
> (uncompiled-function-p X) != (not (compiled-function-p X))
>
> when X is not a function, so it's not just a simple search&replace.
Makes sense.
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#56648: 29.0.50; Need for `compiled-function-p`
2022-07-24 9:22 ` Lars Ingebrigtsen
@ 2022-08-14 16:30 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-08-14 16:34 ` Eli Zaretskii
2022-08-14 16:49 ` Eli Zaretskii
0 siblings, 2 replies; 16+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-08-14 16:30 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: 56648-done
Pushed to `master` with some tweaks and doc,
Stefan
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#56648: 29.0.50; Need for `compiled-function-p`
2022-08-14 16:30 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-08-14 16:34 ` Eli Zaretskii
2022-08-14 16:47 ` Lars Ingebrigtsen
2022-08-14 17:27 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-08-14 16:49 ` Eli Zaretskii
1 sibling, 2 replies; 16+ messages in thread
From: Eli Zaretskii @ 2022-08-14 16:34 UTC (permalink / raw)
To: Stefan Monnier; +Cc: monnier, 56648
> Resent-To: bug-gnu-emacs@gnu.org
> Cc: 56648-done@debbugs.gnu.org
> Date: Sun, 14 Aug 2022 12:30:20 -0400
> From: Stefan Monnier via "Bug reports for GNU Emacs,
> the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
>
> Pushed to `master` with some tweaks and doc,
Which completely breaks the "normal" build, sigh...
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#56648: 29.0.50; Need for `compiled-function-p`
2022-08-14 16:34 ` Eli Zaretskii
@ 2022-08-14 16:47 ` Lars Ingebrigtsen
2022-08-14 16:53 ` Eli Zaretskii
2022-08-14 17:27 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
1 sibling, 1 reply; 16+ messages in thread
From: Lars Ingebrigtsen @ 2022-08-14 16:47 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Stefan Monnier, 56648
Eli Zaretskii <eliz@gnu.org> writes:
> Which completely breaks the "normal" build, sigh...
Works for me after a bootstrap.
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#56648: 29.0.50; Need for `compiled-function-p`
2022-08-14 16:30 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-08-14 16:34 ` Eli Zaretskii
@ 2022-08-14 16:49 ` Eli Zaretskii
2022-08-14 17:51 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
1 sibling, 1 reply; 16+ messages in thread
From: Eli Zaretskii @ 2022-08-14 16:49 UTC (permalink / raw)
To: Stefan Monnier; +Cc: 56648
> +(defun compiled-function-p (object)
> + "Return non-nil if OBJECT is a function that has been compiled.
> +Does not distinguish between functions implemented in machine code
> +or byte-code."
> + (or (subrp object) (byte-code-function-p object)))
What happened to this part from bytecomp.el:
> - (or (byte-code-function-p (symbol-function 'byte-compile-form))
> - (subr-native-elisp-p (symbol-function 'byte-compile-form))
> - (assq 'byte-code (symbol-function 'byte-compile-form)) <<<<<<<<<<<<<
> + (or (compiled-function-p (symbol-function 'byte-compile-form))
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#56648: 29.0.50; Need for `compiled-function-p`
2022-08-14 16:47 ` Lars Ingebrigtsen
@ 2022-08-14 16:53 ` Eli Zaretskii
0 siblings, 0 replies; 16+ messages in thread
From: Eli Zaretskii @ 2022-08-14 16:53 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: monnier, 56648
> From: Lars Ingebrigtsen <larsi@gnus.org>
> Cc: Stefan Monnier <monnier@iro.umontreal.ca>, 56648@debbugs.gnu.org
> Date: Sun, 14 Aug 2022 18:47:08 +0200
>
> Eli Zaretskii <eliz@gnu.org> writes:
>
> > Which completely breaks the "normal" build, sigh...
>
> Works for me after a bootstrap.
bootstrap != "normal build"
I never bootstrap, because I keep old executables around, for easier
bisecting. I didn't need to bootstrap in this case, either, just a
couple of annoying manual actions.
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#56648: 29.0.50; Need for `compiled-function-p`
2022-08-14 16:34 ` Eli Zaretskii
2022-08-14 16:47 ` Lars Ingebrigtsen
@ 2022-08-14 17:27 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
1 sibling, 0 replies; 16+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-08-14 17:27 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 56648
Eli Zaretskii [2022-08-14 19:34:32] wrote:
>> Pushed to `master` with some tweaks and doc,
> Which completely breaks the "normal" build, sigh...
Hmm... works for me, so I guess the devil is in the quotes?
Stefan
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#56648: 29.0.50; Need for `compiled-function-p`
2022-08-14 16:49 ` Eli Zaretskii
@ 2022-08-14 17:51 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-08-14 18:03 ` Eli Zaretskii
0 siblings, 1 reply; 16+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-08-14 17:51 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 56648
>> - (or (byte-code-function-p (symbol-function 'byte-compile-form))
>> - (subr-native-elisp-p (symbol-function 'byte-compile-form))
>> - (assq 'byte-code (symbol-function 'byte-compile-form)) <<<<<<<<<<<<<
According to my reading of the code, this `assq` can never return
non-nil.
I think it was a left-over from many years ago when the byte-compiler
cuold generated code of the form (lambda (..) (byte-code ...)).
Strictly speaking we still occasionally generate such (byte-code ...)
thingies, but only in cases that don't apply here (e.g. it's not applied
for functions, see `byte-compile-out-toplevel`).
Stefan
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#56648: 29.0.50; Need for `compiled-function-p`
2022-08-14 17:51 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-08-14 18:03 ` Eli Zaretskii
2022-08-15 2:36 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 16+ messages in thread
From: Eli Zaretskii @ 2022-08-14 18:03 UTC (permalink / raw)
To: Stefan Monnier; +Cc: 56648
> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: 56648@debbugs.gnu.org
> Date: Sun, 14 Aug 2022 13:51:57 -0400
>
> >> - (or (byte-code-function-p (symbol-function 'byte-compile-form))
> >> - (subr-native-elisp-p (symbol-function 'byte-compile-form))
> >> - (assq 'byte-code (symbol-function 'byte-compile-form)) <<<<<<<<<<<<<
>
> According to my reading of the code, this `assq` can never return
> non-nil.
Too bad the commit log message didn't say that, then. Imagine someone
5 or 10 years from now trying to understand the fine points of that
changeset...
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#56648: 29.0.50; Need for `compiled-function-p`
2022-08-14 18:03 ` Eli Zaretskii
@ 2022-08-15 2:36 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 0 replies; 16+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-08-15 2:36 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 56648
>> >> - (or (byte-code-function-p (symbol-function 'byte-compile-form))
>> >> - (subr-native-elisp-p (symbol-function 'byte-compile-form))
>> >> - (assq 'byte-code (symbol-function 'byte-compile-form)) <<<<<<<<<<<<<
>> >> + (or (compiled-function-p (symbol-function 'byte-compile-form))
>>
>> According to my reading of the code, this `assq` can never return
>> non-nil.
>
> Too bad the commit log message didn't say that, then. Imagine someone
> 5 or 10 years from now trying to understand the fine points of that
> changeset...
If (assq 'byte-code (symbol-function 'byte-compile-form)) returns
non-nil, it means that the `byte-compile-form` function has been
byte-compiled by the Emacs-18 byte-compiler (the byte-code-function type
was only introduced in Emacs-19).
So `compiled-function-p` *should* replace all 3 cases.
IOW I believe the above diff is "obviously right" and the question is
whether `compiled-function-p` should be changed to return non-nil for
functions of the form (lambda (...) (byte-code ...)), i.e. those
functions generated by Emacs-18's byte-compiler. I hope we don't need
to keep that backward compatibility, tho ;-)
Stefan
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2022-08-15 2:36 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-19 20:43 bug#56648: 29.0.50; Need for `compiled-function-p` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
[not found] ` <handler.56648.B.165826342614243.ack@debbugs.gnu.org>
2022-07-22 5:07 ` bug#56648: Acknowledgement (29.0.50; Need for `compiled-function-p`) Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-07-23 2:55 ` Mike Kupfer
2022-07-23 13:51 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-07-23 4:30 ` bug#56648: 29.0.50; Need for `compiled-function-p` Lars Ingebrigtsen
2022-07-24 0:27 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-07-24 9:22 ` Lars Ingebrigtsen
2022-08-14 16:30 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-08-14 16:34 ` Eli Zaretskii
2022-08-14 16:47 ` Lars Ingebrigtsen
2022-08-14 16:53 ` Eli Zaretskii
2022-08-14 17:27 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-08-14 16:49 ` Eli Zaretskii
2022-08-14 17:51 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-08-14 18:03 ` Eli Zaretskii
2022-08-15 2:36 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).