IMPORTANT NOTICE: Devheroes public code hosting will shut down at 1st of March 2023. Due to some difficulties, we have to shut down the instance. Since codeberg.org is pretty mature and welcoming, We highly recommend you to move your code there. Please be advised that on 1st of March, your data will be removed. Thanks for your time with us, and may the source be with you.

Browse Source

Add the Poc for Rigel support

ep6
Sameer Rahmani 10 months ago
parent
commit
699bc88830
  1. 71
      core/cubes/rigel.el

71
core/cubes/rigel.el

@ -0,0 +1,71 @@ @@ -0,0 +1,71 @@
;;; RigelCube --- Rigel client for FG42 -*- lexical-binding: t; -*-
;;
;; Copyright (c) 2010-2021 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)
(defcube fg42/rigel-cube
"This is a [Rigel](https://devheroes.codes/lxsameer/Orion/src/branch/master/rigel)
for *FG42*. Refer to *Rigel* docs to set it up.
This cube exposes few functions that interact with regel. Checkout the docstrings of
functions in `fg42/rigel/` namespace. For example `fg42/rigel/read` function."
(:title "rigel Cube"
:flag rigel
:flag-default t)
(defun fg42/rigel/-sentinel (process event)
(message "[Rigel] %s" event))
(defun fg42/rigel/read (txt)
(interactive "sRead: ")
(let ((proc (make-network-process
:name "rigel-client"
:type nil
:server nil
:host (or (plist-get fg42/rigel-cube-params :host) "127.0.0.1")
:service (or (plist-get fg42/rigel-cube-params :port) "6666")
:nowait t
:buffer (get-buffer-create "*rigel*")
:sentinel 'fg42/rigel/-sentinel
)))
(process-send-string proc txt)
(process-send-eof proc)
(stop-process proc)))
(defun fg42/rigel/read-region (beg end)
(interactive (if (use-region-p)
(list (region-beginning) (region-end))
(list nil nil)))
(fg42/rigel/read
(if (and beg end) (buffer-substring-no-properties beg end) "")))
(defun fg42/rigel/read-clipboard ()
(interactive)
(fg42/rigel/read
(or (current-kill 0) ""))))
(provide 'cubes/rigel)
;;; rigel.el ends here
Loading…
Cancel
Save