forked from FG42/FG42
Add the Meissa cube
This commit is contained in:
parent
e07321a690
commit
65b79792b3
|
@ -26,7 +26,7 @@
|
||||||
(require 'fg42/utils)
|
(require 'fg42/utils)
|
||||||
|
|
||||||
(defcube fg42/cmake-cube
|
(defcube fg42/cmake-cube
|
||||||
"This cube enable CMake integration with FG42"
|
"This cube enables CMake integration with FG42"
|
||||||
(:title "CMake cube"
|
(:title "CMake cube"
|
||||||
:flag-default t
|
:flag-default t
|
||||||
:flag cmake)
|
:flag cmake)
|
||||||
|
@ -35,11 +35,22 @@
|
||||||
(fpkg/use eldoc-cmake))
|
(fpkg/use eldoc-cmake))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
(defcube fg42/ninja-cube
|
||||||
|
"This cube enables Ninja integration with FG42. For more info checkout:
|
||||||
|
https://github.com/ninja-build/ninja/blob/master/misc/ninja-mode.el"
|
||||||
|
(:title "Ninja cube"
|
||||||
|
:flag-default t
|
||||||
|
:flag ninja)
|
||||||
|
(fpkg/use ninja-mode))
|
||||||
|
|
||||||
|
|
||||||
(defcube fg42/c++-cube
|
(defcube fg42/c++-cube
|
||||||
"C++ cube"
|
"C++ cube"
|
||||||
(:title "C++ cube"
|
(:title "C++ cube"
|
||||||
:no-flag t)
|
:no-flag t)
|
||||||
(fg42/cmake-cube)
|
(fg42/cmake-cube)
|
||||||
|
(fg42/ninja-cube)
|
||||||
(add-to-list 'auto-mode-alist '("\\.h\\'" . c++-mode))
|
(add-to-list 'auto-mode-alist '("\\.h\\'" . c++-mode))
|
||||||
(add-hook 'c++-mode-hook (lambda ()
|
(add-hook 'c++-mode-hook (lambda ()
|
||||||
(lsp)
|
(lsp)
|
||||||
|
|
|
@ -0,0 +1,80 @@
|
||||||
|
;;; MeissaCube --- Meissa client for FG42 -*- lexical-binding: t; -*-
|
||||||
|
;;
|
||||||
|
;; Copyright (c) 2010-2022 Sameer Rahmani & Contributors
|
||||||
|
;;
|
||||||
|
;; Author: Sameer Rahmani <lxsameer@gnu.org>
|
||||||
|
;; URL: https://ziglab.com/FG42/FG42
|
||||||
|
;; Version: 3.0.0
|
||||||
|
;;
|
||||||
|
;; This program is free software; you can redistribute it and/or modify
|
||||||
|
;; it under the terms of the GNU General Public License as published by
|
||||||
|
;; the Free Software Foundation, either version 3 of the License, or
|
||||||
|
;; (at your option) any later version.
|
||||||
|
;;
|
||||||
|
;; This program is distributed in the hope that it will be useful,
|
||||||
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
;; GNU General Public License for more details.
|
||||||
|
;;
|
||||||
|
;; You should have received a copy of the GNU General Public License
|
||||||
|
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
;;
|
||||||
|
;;; Commentary:
|
||||||
|
;;; Code:
|
||||||
|
(require 'fpkg)
|
||||||
|
(require 'fg42/cube)
|
||||||
|
(require 'fg42/utils)
|
||||||
|
(require 'fg42/x)
|
||||||
|
|
||||||
|
(defcube fg42/meissa-cube
|
||||||
|
"Integrate FG42 with Meissa"
|
||||||
|
(:title "Meissa cube"
|
||||||
|
:flag-default t
|
||||||
|
:flag meissa)
|
||||||
|
|
||||||
|
(fpkg/use msgpack)
|
||||||
|
|
||||||
|
(autoload 'msgpack-encode "msgpack")
|
||||||
|
(let ((host (or (plist-get fg42/meissa-cube-params :host) "127.0.0.1"))
|
||||||
|
(port (or (plist-get fg42/meissa-cube-params :port) "6666")))
|
||||||
|
|
||||||
|
(defun fg42/meissa-sentinel (process event)
|
||||||
|
(message "[Meissa] %s: %s" process event))
|
||||||
|
|
||||||
|
(defun fg42/meissa-send-command (command payload cb)
|
||||||
|
(let* ((encoded-command (msgpack-encode `((command . ,command) (payload . ,payload))))
|
||||||
|
(decoded-response nil)
|
||||||
|
(process (make-network-process :name "meissa-client"
|
||||||
|
:buffer "*Meissa*"
|
||||||
|
:host host
|
||||||
|
:service port
|
||||||
|
:family 'ipv4
|
||||||
|
:coding 'binary
|
||||||
|
:filter (lambda (_process data)
|
||||||
|
(setq decoded-response
|
||||||
|
(msgpack-read-from-string data)))
|
||||||
|
;;(lambda (_process _event) (delete-process process))
|
||||||
|
:sentinel #'fg42/meissa-sentinel)))
|
||||||
|
(process-send-string process encoded-command)
|
||||||
|
(setq command-response-timer
|
||||||
|
(run-with-timer 0 nil
|
||||||
|
(lambda (cb)
|
||||||
|
(while (not decoded-response)
|
||||||
|
(accept-process-output process))
|
||||||
|
(funcall cb decoded-response))
|
||||||
|
cb))))
|
||||||
|
|
||||||
|
|
||||||
|
(defun fg42/meissa-process-response (response)
|
||||||
|
(message "[Meissa]: %s" response))
|
||||||
|
|
||||||
|
(defun fg42/meissa-speech (txt)
|
||||||
|
(fg42/meissa-send-command "enqueue" `((text . ,txt)) #'fg42/meissa-process-response))
|
||||||
|
|
||||||
|
(defun read-this-for-me ()
|
||||||
|
(interactive)
|
||||||
|
(fg42/meissa-speech (fg42/get-x11-selection-text)))))
|
||||||
|
|
||||||
|
|
||||||
|
(provide 'cubes/meissa)
|
||||||
|
;;; meissa.el ends here
|
|
@ -99,6 +99,16 @@ interactive `pyvenv-workon' function before `lsp'"
|
||||||
(require 'lsp-pyright)
|
(require 'lsp-pyright)
|
||||||
(lsp)))))
|
(lsp)))))
|
||||||
|
|
||||||
|
(defcube fg42/poetry-cube
|
||||||
|
"Poetry support for FG42. To use it, just use `M-x poetry'."
|
||||||
|
(:title "Python cube"
|
||||||
|
:flag poetry
|
||||||
|
:flag-default t)
|
||||||
|
(fpkg/use poetry
|
||||||
|
:config
|
||||||
|
(poetry-tracking-mode 1)))
|
||||||
|
|
||||||
|
|
||||||
(defcube fg42/python-cube
|
(defcube fg42/python-cube
|
||||||
"Python support cube."
|
"Python support cube."
|
||||||
(:title "Python cube"
|
(:title "Python cube"
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
;;; FG42 --- The mighty editor for the emacsians -*- lexical-binding: t; -*-
|
||||||
|
;;
|
||||||
|
;; Copyright (c) 2010-2022 Sameer Rahmani <lxsameer@gnu.org>
|
||||||
|
;;
|
||||||
|
;; Author: Sameer Rahmani <lxsameer@gnu.org>
|
||||||
|
;; URL: https://devheroes.codes/FG42/FG42
|
||||||
|
;; Version: 3.0.0
|
||||||
|
;;
|
||||||
|
;; This program is free software; you can redistribute it and/or modify
|
||||||
|
;; it under the terms of the GNU General Public License as published by
|
||||||
|
;; the Free Software Foundation, either version 3 of the License, or
|
||||||
|
;; (at your option) any later version.
|
||||||
|
;;
|
||||||
|
;; This program is distributed in the hope that it will be useful,
|
||||||
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
;; GNU General Public License for more details.
|
||||||
|
;;
|
||||||
|
;; You should have received a copy of the GNU General Public License
|
||||||
|
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
;;
|
||||||
|
;;; Commentary:
|
||||||
|
;;; Code:
|
||||||
|
|
||||||
|
(defun fg42/get-x11-selection-text ()
|
||||||
|
"Return the X11 selection paste text."
|
||||||
|
(interactive)
|
||||||
|
(x-get-selection 'PRIMARY))
|
||||||
|
|
||||||
|
(provide 'fg42/x)
|
||||||
|
;;; x.el ends here
|
Loading…
Reference in New Issue