Emacs: Refactor init.d/net/

This commit is contained in:
tastytea 2020-05-27 04:21:20 +02:00
parent 9673849925
commit 7127a14006
2 changed files with 48 additions and 75 deletions

View File

@ -1,6 +1,6 @@
;;; client.el --- Network clients. -*- lexical-binding: t; -*- ;;; client.el --- Network clients. -*- lexical-binding: t; -*-
;; Time-stamp: <2020-05-26T06:13:03+0200> ;; Time-stamp: <2020-05-27T04:11:23+0200>
;;; Commentary: ;;; Commentary:
@ -10,26 +10,17 @@
;; Explore and test HTTP REST webservices. ;; Explore and test HTTP REST webservices.
(use-package restclient (use-package restclient
:mode :mode ("\\.restclient$" . restclient-mode))
("\\.restclient$" . restclient-mode)
)
;; Company completion for restclient. ;; Company completion for restclient.
(use-package company-restclient (use-package company-restclient
:after (restclient company) :after (restclient company)
:config (add-to-list 'company-backends 'company-restclient))
:config
(add-to-list 'company-backends 'company-restclient)
)
(use-package webpaste (use-package webpaste
:commands (webpaste-paste-region webpaste-paste-buffer) :commands (webpaste-paste-region webpaste-paste-buffer)
:custom (webpaste-provider-priority '("dpaste.org" "dpaste.com"))
:custom :config (add-to-list
(webpaste-provider-priority '("dpaste.org" "dpaste.com"))
:config
(add-to-list
'webpaste-providers-alist 'webpaste-providers-alist
'("dpaste.org" '("dpaste.org"
:uri "https://dpaste.org/api/" :uri "https://dpaste.org/api/"
@ -37,8 +28,7 @@
:post-field "content" :post-field "content"
:post-lang-field-name "lexer" :post-lang-field-name "lexer"
:lang-overrides ((emacs-lisp-mode . "clojure")) :lang-overrides ((emacs-lisp-mode . "clojure"))
:success-lambda webpaste--providers-success-returned-string)) :success-lambda webpaste--providers-success-returned-string)))
)
;; Gemini and Gopher client. ;; Gemini and Gopher client.
(use-package elpher) (use-package elpher)

View File

@ -1,6 +1,6 @@
;;; server.el --- Set up network stuff.. -*- lexical-binding: t; -*- ;;; server.el --- Set up network stuff.. -*- lexical-binding: t; -*-
;; Time-stamp: <2020-05-09T17:51:29+0200> ;; Time-stamp: <2020-05-27T04:21:10+0200>
;;; Commentary: ;;; Commentary:
@ -14,11 +14,10 @@
(use-package tramp (use-package tramp
:straight nil ; Use built-in version. :straight nil ; Use built-in version.
:defer 2 :defer 2
:custom ((tramp-use-ssh-controlmaster-options nil
:custom "Don't override SSH config.")
(tramp-use-ssh-controlmaster-options nil) ; Don't override SSH config. (tramp-default-method "ssh" "Faster than scp and supports ports.")
(tramp-default-method "ssh") ; ssh is faster than scp and supports ports. (tramp-password-prompt-regexp
(tramp-password-prompt-regexp ; Add verification code support.
(concat (concat
"^.*" "^.*"
(regexp-opt (regexp-opt
@ -26,15 +25,12 @@
"password" "Password" "password" "Password"
"Verification code") "Verification code")
t) t)
".*:\0? *")) ".*:\0? *") "Add verification code support.")
(tramp-connection-timeout 20) (tramp-connection-timeout 20)
;; Auto-save locally. (tramp-auto-save-directory
(tramp-auto-save-directory (concat user-emacs-directory "backups/")) (concat user-emacs-directory "backups/") "Auto-save locally."))
:config (add-to-list
:config 'tramp-remote-path 'tramp-own-remote-path)) ; Respect remote PATH.
;; Respect remote PATH.
(add-to-list 'tramp-remote-path 'tramp-own-remote-path)
)
) ; unless slow-computer. ) ; unless slow-computer.
;; Run server if: ;; Run server if:
@ -46,42 +42,29 @@
(use-package server (use-package server
:defer 2 :defer 2
:functions (server-running-p) :functions (server-running-p)
:init (setq
:init server-use-tcp t
(setq server-use-tcp t
server-port 51313 server-port 51313
server-auth-key ; 64 chars, saved in ~/.emacs.d/server/server. server-auth-key ; 64 chars, saved in ~/.emacs.d/server/server.
"phahw2ohVoh0oopheish7IVie9desh8aequeenei3uo8wahShe%thuadaeNa4ieh") "phahw2ohVoh0oopheish7IVie9desh8aequeenei3uo8wahShe%thuadaeNa4ieh")
:config (unless (eq (server-running-p) t)
:config (server-start)))
(unless (eq (server-running-p) t) ; Run server if not t.
(server-start))
)
;; Server for Firefox-extension that allows to use Emacs to edit textareas. ;; Server for Firefox-extension that allows to use Emacs to edit textareas.
;; https://addons.mozilla.org/en-US/firefox/addon/ghosttext/ ;; https://addons.mozilla.org/en-US/firefox/addon/ghosttext/
(use-package atomic-chrome (use-package atomic-chrome
:defer 2 :defer 2
:config :config (atomic-chrome-start-server)
(atomic-chrome-start-server)
:custom
;; “url” is actually the hostname. ;; “url” is actually the hostname.
(atomic-chrome-url-major-mode-alist :custom ((atomic-chrome-url-major-mode-alist
'( '(("^likeable\\.space$" . markdown-mode)
("^likeable\\.space$" . markdown-mode)
("^schlomp\\.space$" . gfm-mode) ("^schlomp\\.space$" . gfm-mode)
;; ("^wiki\\.gentoo\\.org$" . mediawiki-mode) ;; ("^wiki\\.gentoo\\.org$" . mediawiki-mode)
("^github\\.com$" . gfm-mode) ("^github\\.com$" . gfm-mode)
("^gitlab\\.com$" . gfm-mode) ("^gitlab\\.com$" . gfm-mode)
("^gitlab\\.gnome\\.org$" . gfm-mode) ("^gitlab\\.gnome\\.org$" . gfm-mode)))
)) (atomic-chrome-buffer-open-style 'frame))
(atomic-chrome-buffer-open-style 'frame) :hook (atomic-chrome-edit-mode . (lambda () (setq-fill-column 400))))))
:hook
(atomic-chrome-edit-mode . (lambda () (setq-local fill-column 400)))
)
))
(provide 'net/server) (provide 'net/server)
;;; server.el ends here ;;; server.el ends here