2019-11-04 20:42:06 +01:00
|
|
|
;;; server.el --- Set up network stuff.. -*- lexical-binding: t; -*-
|
2019-10-14 17:38:14 +02:00
|
|
|
|
2020-04-25 17:37:23 +02:00
|
|
|
;; Time-stamp: <2020-04-25T17:36:34+0200>
|
2019-10-14 17:38:14 +02:00
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
2020-03-18 15:00:17 +01:00
|
|
|
(require 'basics/package-management)
|
2019-10-14 17:38:14 +02:00
|
|
|
(require 'basics/global-variables)
|
|
|
|
|
|
|
|
;; Edit remote files.
|
|
|
|
(unless slow-computer
|
|
|
|
(use-package tramp
|
2020-03-15 23:38:06 +01:00
|
|
|
:straight nil
|
2020-04-18 03:12:10 +02:00
|
|
|
:defer 2
|
2020-02-18 16:14:08 +01:00
|
|
|
|
2019-10-14 17:38:14 +02:00
|
|
|
: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? *"))
|
2020-01-01 03:33:02 +01:00
|
|
|
(tramp-connection-timeout 20)
|
2020-02-19 22:26:43 +01:00
|
|
|
;; Auto-save locally.
|
|
|
|
(tramp-auto-save-directory (concat user-emacs-directory "backups/"))
|
2019-10-14 17:38:14 +02:00
|
|
|
|
|
|
|
: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
|
2020-04-18 03:12:10 +02:00
|
|
|
:defer 2
|
2019-10-14 17:38:14 +02:00
|
|
|
: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))
|
|
|
|
)
|
|
|
|
|
2020-02-18 16:14:08 +01:00
|
|
|
;; 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
|
2020-04-18 03:12:10 +02:00
|
|
|
:defer 2
|
2020-02-18 16:14:08 +01:00
|
|
|
:config
|
|
|
|
(atomic-chrome-start-server)
|
2020-01-01 05:03:23 +01:00
|
|
|
|
2020-02-18 16:14:08 +01:00
|
|
|
:custom
|
|
|
|
;; “url” is actually the hostname.
|
|
|
|
(atomic-chrome-url-major-mode-alist
|
|
|
|
'(
|
|
|
|
("^likeable\\.space$" . markdown-mode)
|
2020-02-27 06:08:54 +01:00
|
|
|
("^schlomp\\.space$" . gfm-mode)
|
2020-04-25 17:37:23 +02:00
|
|
|
;; ("^wiki\\.gentoo\\.org$" . mediawiki-mode)
|
2020-02-27 06:08:54 +01:00
|
|
|
("^github\\.com$" . gfm-mode)
|
|
|
|
("^gitlab\\.com$" . gfm-mode)
|
|
|
|
("^gitlab\\.gnome\\.org$" . gfm-mode)
|
2020-02-18 16:14:08 +01:00
|
|
|
))
|
|
|
|
(atomic-chrome-buffer-open-style 'frame)
|
2020-01-22 03:38:26 +01:00
|
|
|
|
2020-02-18 16:14:08 +01:00
|
|
|
:hook
|
|
|
|
(atomic-chrome-edit-mode . (lambda () (setq-local fill-column 400)))
|
|
|
|
)
|
2019-10-14 17:38:14 +02:00
|
|
|
))
|
|
|
|
|
2019-11-04 20:42:06 +01:00
|
|
|
(provide 'net/server)
|
|
|
|
;;; server.el ends here
|