diff options
| author | Kisaragi Hiu <mail@kisaragi-hiu.com> | 2022-05-30 09:22:03 +0900 |
|---|---|---|
| committer | Wilfred Hughes <me@wilfred.me.uk> | 2022-07-04 10:22:11 -0700 |
| commit | 94a07d49a80f66f8ebc54a49a4b4f6899a65fbe3 (patch) | |
| tree | 17af230e108b56a080f4fd3683049731b45e2506 | |
| parent | 209971ba9f576ba080352642cfbf25df5692b1d7 (diff) | |
Fix advised native-compiled function being treated as primitives
In Emacs 28, subrp is t for a native-compiled function; to check
whether a function is a primitive, there is a new function
subr-primitive-p.
Previously, unadvised functions have an extra check that does the same
thing as subr-primitive-p, but that was not applied to advised
functions. This applies it to both.
| -rw-r--r-- | helpful.el | 29 |
1 files changed, 15 insertions, 14 deletions
@@ -1684,20 +1684,21 @@ POSITION-HEADS takes the form ((123 (defun foo)) (456 (defun bar)))." (defun helpful--primitive-p (sym callable-p) "Return t if SYM is defined in C." - (cond - ((and callable-p (helpful--advised-p sym)) - (subrp (helpful--without-advice sym))) - (callable-p - (and (not (and (fboundp 'subr-native-elisp-p) - (subr-native-elisp-p (indirect-function sym)))) - (subrp (indirect-function sym)))) - (t - (let ((filename (find-lisp-object-file-name sym 'defvar))) - (or (eq filename 'C-source) - (and (stringp filename) - (let ((ext (file-name-extension filename))) - (or (equal ext "c") - (equal ext "rs"))))))))) + (let ((subrp (if (fboundp 'subr-primitive-p) + #'subr-primitive-p + #'subrp))) + (cond + ((and callable-p (helpful--advised-p sym)) + (funcall subrp (helpful--without-advice sym))) + (callable-p + (funcall subrp (indirect-function sym))) + (t + (let ((filename (find-lisp-object-file-name sym 'defvar))) + (or (eq filename 'C-source) + (and (stringp filename) + (let ((ext (file-name-extension filename))) + (or (equal ext "c") + (equal ext "rs")))))))))) (defun helpful--sym-value (sym buf) "Return the value of SYM in BUF." |
