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
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
2020-03-18 15:00:17 +01:00
|
|
|
(require 'basics/package-management)
|
2019-10-14 17:38:14 +02:00
|
|
|
|
2020-11-30 15:50:41 +01:00
|
|
|
(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.
|
2019-10-14 17:38:14 +02:00
|
|
|
|
2020-11-29 10:32:49 +01:00
|
|
|
;; Run server on TCP socket if:
|
2019-10-14 17:38:14 +02:00
|
|
|
;; - Our EUID is not 0,
|
|
|
|
;; - We are not logged in via SSH,
|
|
|
|
;; - It is not already running.
|
2020-11-29 13:41:14 +01:00
|
|
|
(use-package server
|
|
|
|
:straight (:type built-in)
|
|
|
|
:if (not (or (equal (user-real-uid) 0)
|
2020-11-29 10:32:49 +01:00
|
|
|
(getenv "SSH_CONNECTION")))
|
2020-11-29 13:41:14 +01:00
|
|
|
:functions (server-running-p)
|
2020-11-29 15:18:09 +01:00
|
|
|
:init (setq server-socket-dir (concat user-emacs-directory "server"))
|
2020-11-29 13:41:14 +01:00
|
|
|
:config (unless (eq (server-running-p) t)
|
|
|
|
(server-start)))
|
2019-10-14 17:38:14 +02:00
|
|
|
|
2020-11-29 13:41:14 +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
|
|
|
|
: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)
|
2021-05-13 03:14:03 +02:00
|
|
|
("^gitlab\\.gnome\\.org$" . gfm-mode)
|
|
|
|
("^openlibrary\\.org$" . markdown-mode)
|
|
|
|
("^bookwyrm\\.social$" . markdown-mode)))
|
2020-11-29 13:41:14 +01:00
|
|
|
(atomic-chrome-buffer-open-style 'frame))
|
|
|
|
:hook (atomic-chrome-edit-mode . (lambda () (set-fill-column 400))))
|
2019-10-14 17:38:14 +02:00
|
|
|
|
2020-12-03 21:42:55 +01:00
|
|
|
;; Read SSH/GPG agent environment variables from file.
|
2020-12-05 14:06:32 +01:00
|
|
|
(use-package keychain-environment
|
2021-07-16 09:34:56 +02:00
|
|
|
:commands (keychain-refresh-environment))
|
2020-12-03 21:42:55 +01:00
|
|
|
|
2019-11-04 20:42:06 +01:00
|
|
|
(provide 'net/server)
|
|
|
|
;;; server.el ends here
|