emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/jinx 05ba6f1244 1/3: Add success message to *jinx compi


From: ELPA Syncer
Subject: [elpa] externals/jinx 05ba6f1244 1/3: Add success message to *jinx compilation* buffer
Date: Sun, 26 Mar 2023 11:58:56 -0400 (EDT)

branch: externals/jinx
commit 05ba6f12442a16aaf6b315e07e018d1c9d02b9f8
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>

    Add success message to *jinx compilation* buffer
---
 jinx-mod.c | 14 ++++++++------
 jinx.el    | 10 ++++++----
 2 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/jinx-mod.c b/jinx-mod.c
index c275bb3de6..4cc8bfcf47 100644
--- a/jinx-mod.c
+++ b/jinx-mod.c
@@ -99,17 +99,17 @@ static emacs_value jinx_describe(emacs_env* env, ptrdiff_t 
jinx_unused(nargs),
 
 static emacs_value jinx_check(emacs_env* env, ptrdiff_t jinx_unused(nargs),
                               emacs_value args[], void* jinx_unused(data)) {
-    g_autofree char* str = jinx_cstr(env, args[1]);
     EnchantDict* dict = env->get_user_ptr(env, args[0]);
-    return env->intern(env, !str || !dict || enchant_dict_check(dict, str, -1)
+    g_autofree char* str = jinx_cstr(env, args[1]);
+    return env->intern(env, !dict || !str || enchant_dict_check(dict, str, -1)
                        ? "nil" : "t");
 }
 
 static emacs_value jinx_add(emacs_env* env, ptrdiff_t jinx_unused(nargs),
                             emacs_value args[], void* jinx_unused(data)) {
-    g_autofree char* str = jinx_cstr(env, args[1]);
     EnchantDict* dict = env->get_user_ptr(env, args[0]);
-    if (str && dict)
+    g_autofree char* str = jinx_cstr(env, args[1]);
+    if (dict && str)
         enchant_dict_add(dict, str, -1);
     return env->intern(env, "nil");
 }
@@ -124,8 +124,8 @@ static emacs_value jinx_wordchars(emacs_env* env, ptrdiff_t 
jinx_unused(nargs),
 
 static emacs_value jinx_suggest(emacs_env* env, ptrdiff_t jinx_unused(nargs),
                                 emacs_value args[], void* jinx_unused(data)) {
-    g_autofree char* str = jinx_cstr(env, args[1]);
     EnchantDict* dict = env->get_user_ptr(env, args[0]);
+    g_autofree char* str = jinx_cstr(env, args[1]);
     emacs_value list = env->intern(env, "nil");
     size_t count = 0;
     char** suggs = str && dict ? enchant_dict_suggest(dict, str, -1, &count) : 
0;
@@ -140,9 +140,11 @@ static emacs_value jinx_suggest(emacs_env* env, ptrdiff_t 
jinx_unused(nargs),
 }
 
 int emacs_module_init(struct emacs_runtime *runtime) {
-    if (runtime->size < (ptrdiff_t)sizeof (*runtime))
+    if ((size_t)runtime->size < sizeof (*runtime))
         return 1;
     emacs_env* env = runtime->get_environment(runtime);
+    if ((size_t)env->size < sizeof (*env))
+        return 2;
     jinx_defun(env, "jinx--mod-suggest", 2, 2, jinx_suggest);
     jinx_defun(env, "jinx--mod-check", 2, 2, jinx_check);
     jinx_defun(env, "jinx--mod-add", 2, 2, jinx_add);
diff --git a/jinx.el b/jinx.el
index 542acd5ec7..d1dd763904 100644
--- a/jinx.el
+++ b/jinx.el
@@ -442,10 +442,12 @@ Returns a pair of updated (START END) bounds."
               (erase-buffer)
               (insert (string-join command " ") "\n")
               (if (equal 0 (apply #'call-process (car command) nil 
(current-buffer) t (cdr command)))
-                  (message "Jinx: %s compiled successfully" module)
-                (compilation-mode)
-                (pop-to-buffer (current-buffer))
-                (error "Jinx: Compilation of %s failed" module))))))
+                  (insert (message "Jinx: %s compiled successfully" module))
+                (let ((msg (format "Jinx: Compilation of %s failed" module)))
+                  (insert msg)
+                  (compilation-mode)
+                  (pop-to-buffer (current-buffer))
+                  (error msg)))))))
       (module-load (expand-file-name module)))))
 
 (defun jinx--force-check (start end)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]