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

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

[nongnu] elpa/typst-ts-mode 57616b137b 165/246: fix: corfu completion is


From: ELPA Syncer
Subject: [nongnu] elpa/typst-ts-mode 57616b137b 165/246: fix: corfu completion issue
Date: Fri, 14 Feb 2025 16:55:05 -0500 (EST)

branch: elpa/typst-ts-mode
commit 57616b137bed7f4a061eb2f65dfed78343e01776
Author: Meow King <mr.meowking@anche.no>
Commit: Meow King <mr.meowking@anche.no>

    fix: corfu completion issue
    
    closes: https://codeberg.org/meow_king/typst-ts-mode/issues/6
---
 test/indentation-test.typ |  1 +
 typst-ts-editing.el       | 26 ++++++++++++++++----------
 typst-ts-mode.el          | 33 +++++++++++++++++----------------
 3 files changed, 34 insertions(+), 26 deletions(-)

diff --git a/test/indentation-test.typ b/test/indentation-test.typ
index a75fbec0e3..322c513cb8 100644
--- a/test/indentation-test.typ
+++ b/test/indentation-test.typ
@@ -5,6 +5,7 @@
 
 // typst-ts-mode-indent-offset: 4
 
+
 #show: cv.with(
     author: "",
     [
diff --git a/typst-ts-editing.el b/typst-ts-editing.el
index 2c6feaa8e7..95dccede27 100644
--- a/typst-ts-editing.el
+++ b/typst-ts-editing.el
@@ -152,16 +152,22 @@ When prefix ARG is non-nil, call global return function."
           ))))
     ;; execute default action if not successful
     (unless (eq execute-result 'success)
-      (let ((global-ret-function
-             (global-key-binding (kbd "RET"))))
-        (if (and current-prefix-arg
-                 (yes-or-no-p
-                  (format
-                   "Execute function `%s' with the given prefix argument?"
-                   global-ret-function)))
-            (call-interactively global-ret-function)
-          (let ((current-prefix-arg nil))
-            (call-interactively global-ret-function)))))))
+      ;; temporary solution for corfu completion
+      ;; see the issue here: 
https://codeberg.org/meow_king/typst-ts-mode/issues/6
+      (if (and (boundp 'corfu--input) (fboundp 'corfu-insert)
+               corfu--input)
+          (corfu-insert)
+        (let ((global-ret-function
+               (global-key-binding (kbd "RET"))))
+          (if (and current-prefix-arg
+                   (yes-or-no-p
+                    (format
+                     "Execute function `%s' with the given prefix argument?"
+                     global-ret-function)))
+              (call-interactively global-ret-function)
+            (let ((current-prefix-arg nil))
+              (call-interactively global-ret-function)))))))
+  )
 
 (defun typst-ts-mode-insert--item (node)
   "Insert an item after NODE.
diff --git a/typst-ts-mode.el b/typst-ts-mode.el
index b77bbff68a..80ce305c1f 100644
--- a/typst-ts-mode.el
+++ b/typst-ts-mode.el
@@ -600,21 +600,22 @@ FILE: file path for the result compile file."
   (browse-url file))
 
 ;;;###autoload
-(defvar typst-ts-mode-map
-  (let ((map (make-sparse-keymap)))
-    (define-key map (kbd "C-c C-c c") #'typst-ts-compile-and-preview)
-    (define-key map (kbd "C-c C-c C") #'typst-ts-compile)
-    (define-key map (kbd "C-c C-c w") #'typst-ts-watch-mode)
-    (define-key map (kbd "C-c C-c p") #'typst-ts-mode-preview)
-    (define-key map (kbd "M-<left>") #'typst-ts-mode-heading-decrease)
-    (define-key map (kbd "M-<right>") #'typst-ts-mode-heading-increase)
-    (define-key map (kbd "M-<down>") #'typst-ts-mode-heading-down)
-    (define-key map (kbd "M-<up>") #'typst-ts-mode-heading-up)
-    (define-key map (kbd "M-<return>") #'typst-ts-mode-meta-return)
-    (define-key map (kbd "<return>") #'typst-ts-mode-return)
-    (define-key map (kbd "TAB") #'typst-ts-mode-cycle)
-    (define-key map (kbd "C-c '") #'typst-ts-edit-indirect)
-    map))
+(defvar-keymap typst-ts-mode-map
+  "C-c C-c c" #'typst-ts-compile-and-preview
+  "C-c C-c C" #'typst-ts-compile
+  "C-c C-c w" #'typst-ts-watch-mode
+  "C-c C-c p" #'typst-ts-mode-preview
+  
+  "M-<left>" #'typst-ts-mode-heading-decrease
+  "M-<right>" #'typst-ts-mode-heading-increase
+  "M-<down>" #'typst-ts-mode-heading-down
+  "M-<up>" #'typst-ts-mode-heading-up
+  "M-<return>" #'typst-ts-mode-meta-return
+  
+  "TAB" #'typst-ts-mode-cycle
+  "RET" #'typst-ts-mode-return
+  "C-c '" #'typst-ts-edit-indirect)
+
 
 (defun typst-ts-mode-indent-line-function ()
   "A simple wrapper of `treesit-indent' for handle indentation edge cases.
@@ -690,7 +691,7 @@ typst tree sitter grammar (at least %s)!" 
(current-time-string min-time))
   :syntax-table typst-ts-mode-syntax-table
   :after-hook
   (typst-ts-mode-after-hook-function)
-
+  
   (unless (treesit-ready-p 'typst)
     (user-error "Tree-sitter for Typst isn't available"))
 



reply via email to

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