[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/jinx 4ea10d1aea 1/2: jinx--load-module: Try first to lo
From: |
ELPA Syncer |
Subject: |
[elpa] externals/jinx 4ea10d1aea 1/2: jinx--load-module: Try first to locate jinx-mod.so on the load-path (Fix #42) |
Date: |
Tue, 18 Apr 2023 03:59:01 -0400 (EDT) |
branch: externals/jinx
commit 4ea10d1aeaff0f3f309bff6e9c98f7322a5b7555
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
jinx--load-module: Try first to locate jinx-mod.so on the load-path (Fix
#42)
---
jinx.el | 34 +++++++++++++++++++---------------
1 file changed, 19 insertions(+), 15 deletions(-)
diff --git a/jinx.el b/jinx.el
index d0cf56dab4..98cc896b39 100644
--- a/jinx.el
+++ b/jinx.el
@@ -469,29 +469,33 @@ If VISIBLE is non-nil, only include visible overlays."
(unless (fboundp #'jinx--mod-dict)
(unless module-file-suffix
(error "Jinx: Dynamic modules are not supported"))
- (let ((default-directory
- (file-name-directory (locate-library "jinx.el" t)))
- (module (file-name-with-extension "jinx-mod" module-file-suffix)))
- (unless (file-exists-p module)
- (let ((command
- `("cc" "-I." "-O2" "-Wall" "-Wextra" "-fPIC" "-shared"
- "-o" ,module ,(file-name-with-extension module ".c")
- ,@(split-string-and-unquote
- (condition-case nil
- (car (process-lines "pkg-config" "--cflags" "--libs"
"enchant-2"))
- (error "-I/usr/include/enchant-2 -lenchant-2"))))))
+ (let* ((mod-name (file-name-with-extension "jinx-mod" module-file-suffix))
+ (mod-file (locate-library mod-name t)))
+ (unless mod-file
+ (let* ((c-name (file-name-with-extension mod-name ".c"))
+ (default-directory (file-name-directory
+ (or (locate-library c-name t)
+ (error "Jinx: %s not found" c-name))))
+ (command
+ `("cc" "-I." "-O2" "-Wall" "-Wextra" "-fPIC" "-shared"
+ "-o" ,mod-name ,c-name
+ ,@(split-string-and-unquote
+ (condition-case nil
+ (car (process-lines "pkg-config" "--cflags" "--libs"
"enchant-2"))
+ (error "-I/usr/include/enchant-2 -lenchant-2"))))))
(with-current-buffer (get-buffer-create "*jinx module compilation*")
(let ((inhibit-read-only t))
(erase-buffer)
(compilation-mode)
(insert (string-join command " ") "\n")
(if (equal 0 (apply #'call-process (car command) nil
(current-buffer) t (cdr command)))
- (insert (message "Jinx: %s compiled successfully" module))
- (let ((msg (format "Jinx: Compilation of %s failed" module)))
+ (insert (message "Jinx: %s compiled successfully" mod-name))
+ (let ((msg (format "Jinx: Compilation of %s failed" mod-name)))
(insert msg)
(pop-to-buffer (current-buffer))
- (error msg)))))))
- (module-load (expand-file-name module)))))
+ (error msg)))))
+ (setq mod-file (expand-file-name mod-name))))
+ (module-load mod-file))))
(defun jinx--annotate-suggestion (word)
"Annotate WORD during completion."