summaryrefslogtreecommitdiff
path: root/helm-lib.el
diff options
context:
space:
mode:
authorGraham Clark <grclark@gmail.com>2020-08-30 11:15:33 -0400
committerGraham Clark <grclark@gmail.com>2020-08-30 11:15:33 -0400
commit732ae6f071e20c1f8f52070d0269daab8a69c360 (patch)
treeaa0b32bcaf2854d03a1b0529be1e536a5846d634 /helm-lib.el
parente766d2f46c1b8bf6827c0f0b2cb7604d6a63f898 (diff)
Fix issues running emacs built from the native-comp branch (#2375)
The emacs native-comp branch provides "a modified Emacs capable of compiling and running Emacs Lisp as native code in form of re-loadable elf files" (https://akrl.sdf.org/gccemacs.html). Functions that are natively-compiled do not return t to byte-code-function-p, but do return t to subr-native-elisp-p, a function that is built-in to the native-comp emacs. The problem here is that helm-symbol-name tries to call symbol-name on an object if it is not functionp OR byte-code-function-p; when running with native-comp, this now needs to include subr-native-elisp-p too. I've also modified some other functions that use a similar pattern.
Diffstat (limited to 'helm-lib.el')
-rw-r--r--helm-lib.el14
1 files changed, 13 insertions, 1 deletions
diff --git a/helm-lib.el b/helm-lib.el
index c92be7fc..7596d792 100644
--- a/helm-lib.el
+++ b/helm-lib.el
@@ -363,6 +363,17 @@ available APPEND is ignored."
(setq guess (abbreviate-file-name (expand-file-name guess))))
(read-file-name prompt (file-name-directory guess) nil nil
(file-name-nondirectory guess))))
+
+;; The native-comp branch of emacs "is a modified Emacs capable of compiling
+;; and running Emacs Lisp as native code in form of re-loadable elf files."
+;; (https://akrl.sdf.org/gccemacs.html). The function subr-native-elisp-p is a
+;; native function available only in this branch and evaluates to true if the
+;; argument supplied is a natively compiled lisp function. Use this function
+;; if it's available, otherwise return nil. Helm needs to distinguish compiled
+;; functions from other symbols in a various places.
+(defun helm-subr-native-elisp-p (object)
+ (when (fboundp 'subr-native-elisp-p)
+ (subr-native-elisp-p object)))
;;; Macros helper.
;;
@@ -1110,7 +1121,8 @@ Example:
(defun helm-symbol-name (obj)
(if (or (and (consp obj) (functionp obj))
- (byte-code-function-p obj))
+ (byte-code-function-p obj)
+ (helm-subr-native-elisp-p obj))
"Anonymous"
(symbol-name obj)))