.emacs.d/init.d/net/server.el

66 lines
2.2 KiB
EmacsLisp

;;; server.el --- Set up network stuff.. -*- lexical-binding: t; -*-
;; Time-stamp: <2020-11-30T15:48:09+0100>
;;; Commentary:
;;; Code:
(require 'basics/package-management)
(use-package tramp
:straight (:type built-in)
:defer 2
:custom ((tramp-use-ssh-controlmaster-options nil
"Don't override SSH config.")
(tramp-default-method "ssh" "Faster than scp and supports ports.")
(tramp-password-prompt-regexp
(concat
"^.*"
(regexp-opt
'("passphrase" "Passphrase"
"password" "Password"
"Verification code")
t)
".*:\0? *") "Add verification code support.")
(tramp-connection-timeout 20)
(tramp-auto-save-directory
(concat user-emacs-directory "backups/") "Auto-save locally."))
:config (add-to-list
'tramp-remote-path 'tramp-own-remote-path)) ; Respect remote PATH.
;; Run server on TCP socket if:
;; - Our EUID is not 0,
;; - We are not logged in via SSH,
;; - It is not already running.
(use-package server
:straight (:type built-in)
:defer 2
:if (not (or (equal (user-real-uid) 0)
(getenv "SSH_CONNECTION")))
:functions (server-running-p)
:init (setq server-socket-dir (concat user-emacs-directory "server"))
:config (unless (eq (server-running-p) t)
(server-start)))
;; Server for Firefox-extension that allows to use Emacs to edit textareas.
;; https://addons.mozilla.org/en-US/firefox/addon/ghosttext/
(use-package atomic-chrome
:defer 2
:if (or (executable-find "firefox")
(executable-find "firefox-bin"))
:config (atomic-chrome-start-server)
;; “url” is actually the hostname.
:custom ((atomic-chrome-url-major-mode-alist
'(("^likeable\\.space$" . markdown-mode)
("^schlomp\\.space$" . gfm-mode)
("^wiki\\.gentoo\\.org$" . mediawiki-mode)
("^github\\.com$" . gfm-mode)
("^gitlab\\.com$" . gfm-mode)
("^gitlab\\.gnome\\.org$" . gfm-mode)))
(atomic-chrome-buffer-open-style 'frame))
:hook (atomic-chrome-edit-mode . (lambda () (set-fill-column 400))))
(provide 'net/server)
;;; server.el ends here