73 lines
2.0 KiB
EmacsLisp
73 lines
2.0 KiB
EmacsLisp
;;; FG42 --- The mighty editor for the emacsians -*- lexical-binding: t; -*-
|
|
;;
|
|
;; Copyright (c) 2010-2024 Sameer Rahmani & Contributors
|
|
;;
|
|
;; Author: Sameer Rahmani <lxsameer@gnu.org>
|
|
;; URL: https://devheroes.codes/FG42/FG42
|
|
;; Version: 4.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:
|
|
(eval-when-compile
|
|
(require 'fpkg)
|
|
(require 'fg42/config))
|
|
|
|
|
|
;; Language Servers and friends
|
|
(use! eglot
|
|
"Eglot is a minimalistic yet powerful LSP replacement
|
|
shipped with Emacs."
|
|
:commands eglot-ensure)
|
|
|
|
(use! eldoc-box
|
|
"View eldoc stuff in a frame."
|
|
:commands eldoc-box-hover-mode)
|
|
|
|
(use! markdown-mode
|
|
"Renders markdown in Emacs.")
|
|
|
|
|
|
;;;###autoload
|
|
(defun fg42/ensure-lang-server ()
|
|
"Setup the appropriate language server for the current buffer.
|
|
This function is supposed to be run using a hook.
|
|
|
|
For example:
|
|
|
|
(add-hook 'foo-mode-hook #'fg42/enruse-lang-server)
|
|
|
|
or via `use!' `:hook'."
|
|
(interactive)
|
|
;; TODO: Configure LSP here as an alternative here by looking at
|
|
;; the configs in `fg42/config'
|
|
(add-hook 'eglot-managed-mode-hook #'eldoc-box-hover-mode t)
|
|
(eglot-ensure))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
(defun fg42/lang-server-format ()
|
|
"Format the current buffer using the current language server.
|
|
This function is supposed to be run as a hook handler."
|
|
(interactive)
|
|
(cond
|
|
((and (boundp 'eglot-managed-p) (eglot-managed-p))
|
|
(eglot-format-buffer))))
|
|
|
|
|
|
(provide 'fg42/language-server)
|
|
;;; language-server.el ends here
|