From 025278a1e180e86f3aade20242e4ac1cdc1a2f13 Mon Sep 17 00:00:00 2001 From: SqrtMinusOne Date: Tue, 22 Mar 2022 11:14:12 +0300 Subject: [PATCH] feat(emacs): web-mode padding & editorconfig; restclient --- .emacs.d/init.el | 12 ++++++++++-- Emacs.org | 19 +++++++++++++++++-- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/.emacs.d/init.el b/.emacs.d/init.el index 0894da2..3a5e34d 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -1504,11 +1504,12 @@ Returns ( . ) or nil." (add-hook 'web-mode-hook #'my/web-mode-lsp) -(defun my/web-mode-vue-setup () +(defun my/web-mode-vue-setup (&rest _) (when (string-match-p (rx ".vue" eos) (buffer-name)) (setq-local web-mode-script-padding 0))) (add-hook 'web-mode-hook 'my/web-mode-vue-setup) +(add-hook 'editorconfig-after-apply-functions 'my/web-mode-vue-setup) (add-hook 'scss-mode-hook #'smartparens-mode) (add-hook 'scss-mode-hook #'hs-minor-mode) @@ -2530,11 +2531,18 @@ Returns ( . ) or nil." (f-write (plist-get (car (cdr elem)) :value) 'utf-8 temp-file-path) (start-process "org-html-preview" nil "xdg-open" temp-file-path)))))) +(use-package restclient + :straight t) + +(use-package ob-restclient + :after (org restclient) + :straight t) + (use-package ob-async :straight t :after (org) :config - (setq ob-async-no-async-languages-alist '("python" "hy" "jupyter-python" "jupyter-octave"))) + (setq ob-async-no-async-languages-alist '("python" "hy" "jupyter-python" "jupyter-octave" "restclient"))) (setq my/jupyter-runtime-folder (expand-file-name "~/.local/share/jupyter/runtime")) diff --git a/Emacs.org b/Emacs.org index 31c02e9..1b604ba 100644 --- a/Emacs.org +++ b/Emacs.org @@ -2521,11 +2521,12 @@ Hooking this up with lsp. Vue settings #+begin_src emacs-lisp -(defun my/web-mode-vue-setup () +(defun my/web-mode-vue-setup (&rest _) (when (string-match-p (rx ".vue" eos) (buffer-name)) (setq-local web-mode-script-padding 0))) (add-hook 'web-mode-hook 'my/web-mode-vue-setup) +(add-hook 'editorconfig-after-apply-functions 'my/web-mode-vue-setup) #+end_src *** SCSS #+begin_src emacs-lisp @@ -3557,6 +3558,20 @@ Open HTML in the ~begin_export~ block with xdg-open. (setq org-plantuml-exec-mode 'plantuml) (add-to-list 'org-src-lang-modes '("plantuml" . plantuml)) #+end_src +*** Restclient +[[https://github.com/pashky/restclient.el][restclient.el]] is an Emacs package to send HTTP requests. [[https://github.com/alf/ob-restclient.el][ob-restclient]] provides interaction with Org Babel. + +References: +- [[https://joseph8th.github.io/posts/wow-writing-literate-api-documentation-in-emacs-org-mode/][WOW! Writing Literate API Documentation in Emacs Org Mode]] + +#+begin_src emacs-lisp +(use-package restclient + :straight t) + +(use-package ob-restclient + :after (org restclient) + :straight t) +#+end_src *** Setup Enable languages #+begin_src emacs-lisp :tangle no :noweb-ref org-lang-setup @@ -3598,7 +3613,7 @@ Async code blocks evaluations. Jupyter blocks have a built-in async, so they are :straight t :after (org) :config - (setq ob-async-no-async-languages-alist '("python" "hy" "jupyter-python" "jupyter-octave"))) + (setq ob-async-no-async-languages-alist '("python" "hy" "jupyter-python" "jupyter-octave" "restclient"))) #+end_src *** Managing Jupyter kernels Functions for managing local Jupyter kernels.