88 lines
2.3 KiB
EmacsLisp
88 lines
2.3 KiB
EmacsLisp
;;; server.el --- Set up network stuff.. -*- lexical-binding: t; -*-
|
|
|
|
;; Time-stamp: <2020-03-18T14:56:59+0100>
|
|
|
|
;;; Commentary:
|
|
|
|
;;; Code:
|
|
|
|
(require 'basics/package-management)
|
|
(require 'basics/global-variables)
|
|
|
|
;; Edit remote files.
|
|
(unless slow-computer
|
|
(use-package tramp
|
|
:straight nil
|
|
:defer 5
|
|
|
|
:custom
|
|
(tramp-use-ssh-controlmaster-options nil) ; Don't override SSH config.
|
|
(tramp-default-method "ssh") ; ssh is faster than scp and supports ports.
|
|
(tramp-password-prompt-regexp ; Add verification code support.
|
|
(concat
|
|
"^.*"
|
|
(regexp-opt
|
|
'("passphrase" "Passphrase"
|
|
"password" "Password"
|
|
"Verification code")
|
|
t)
|
|
".*:\0? *"))
|
|
(tramp-connection-timeout 20)
|
|
;; Auto-save locally.
|
|
(tramp-auto-save-directory (concat user-emacs-directory "backups/"))
|
|
|
|
:config
|
|
;; Respect remote PATH.
|
|
(add-to-list 'tramp-remote-path 'tramp-own-remote-path)
|
|
)
|
|
) ; unless slow-computer.
|
|
|
|
;; Run server if:
|
|
;; - Our EUID is not 0,
|
|
;; - We are not logged in via SSH,
|
|
;; - It is not already running.
|
|
(unless (equal (user-real-uid) 0)
|
|
(unless (getenv "SSH_CONNECTION")
|
|
(use-package server
|
|
:defer 5
|
|
:functions (server-running-p)
|
|
|
|
:init
|
|
(setq server-use-tcp t
|
|
server-port 51313
|
|
server-auth-key ; 64 chars, saved in ~/.emacs.d/server/server.
|
|
"phahw2ohVoh0oopheish7IVie9desh8aequeenei3uo8wahShe%thuadaeNa4ieh")
|
|
|
|
:config
|
|
(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.
|
|
;; https://addons.mozilla.org/en-US/firefox/addon/ghosttext/
|
|
(use-package atomic-chrome
|
|
:defer 5
|
|
:config
|
|
(atomic-chrome-start-server)
|
|
|
|
:custom
|
|
;; “url” is actually the hostname.
|
|
(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 () (setq-local fill-column 400)))
|
|
)
|
|
))
|
|
|
|
(provide 'net/server)
|
|
;;; server.el ends here
|