Basic common setup with:
* Disable all GUI * Install use-package * Configure some builtin packages
This commit is contained in:
parent
3ebb88ee1f
commit
5c56ab7a84
40
config/common/common.el
Normal file
40
config/common/common.el
Normal file
|
@ -0,0 +1,40 @@
|
|||
;;; common.el --- base configuration
|
||||
;;; COMMENTARY:
|
||||
;;; Code:
|
||||
|
||||
(require 'packages-config)
|
||||
|
||||
(defun start-server-on-unix ()
|
||||
"If OS is Linux or MacOS start server."
|
||||
(defun system-is-linux()
|
||||
(string-equal system-type "gnu/linux"))
|
||||
|
||||
(defun system-is-darwin()
|
||||
(string-equal system-type "darwin"))
|
||||
|
||||
;; Start Emacs as server. Linux and MacOS support
|
||||
(when (or (system-is-linux) (system-is-darwin))
|
||||
(require 'server)
|
||||
(message "Run as server.")
|
||||
(unless (server-running-p)
|
||||
(server-start))))
|
||||
|
||||
(defun use-package-setup ()
|
||||
"Configure MELPA and install use-package."
|
||||
;; Repo configuration
|
||||
(configure-repos)
|
||||
|
||||
;; Install use-package
|
||||
(when (not (require 'use-package nil 'noerror))
|
||||
(and (message "Installing ")
|
||||
(package-install 'use-package))))
|
||||
|
||||
(defun common-setup ()
|
||||
"Setup base GNU Emacs configuration."
|
||||
(start-server-on-unix)
|
||||
(use-package-setup)
|
||||
(basic-setup))
|
||||
|
||||
(provide 'common)
|
||||
|
||||
;;; common.el ends here
|
82
config/common/packages-config.el
Normal file
82
config/common/packages-config.el
Normal file
|
@ -0,0 +1,82 @@
|
|||
;;; packages-config.el --- base configuration
|
||||
;;; COMMENTARY:
|
||||
;;; Code:
|
||||
|
||||
(require 'package)
|
||||
|
||||
(defun configure-repos ()
|
||||
"Set MELPA and ELPA repositories."
|
||||
(let* ((no-ssl (and (memq system-type '(windows-nt ms-dos))
|
||||
(not (gnutls-available-p))))
|
||||
(url (concat (if no-ssl "http" "https") "://melpa.org/packages/")))
|
||||
(add-to-list 'package-archives (cons "melpa" url) t))
|
||||
(when (< emacs-major-version 24)
|
||||
;; For important compatibility libraries like cl-lib
|
||||
(add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/")))
|
||||
(package-initialize))
|
||||
|
||||
(defun basic-setup ()
|
||||
"Configure builtin and other minimum of packages."
|
||||
|
||||
;; Disable backup
|
||||
(setq make-backup-files nil)
|
||||
|
||||
;; Disable GUI
|
||||
(tooltip-mode -1)
|
||||
(menu-bar-mode -1)
|
||||
(tool-bar-mode -1)
|
||||
(scroll-bar-mode -1)
|
||||
(setq use-dialog-box nil)
|
||||
(setq redisplay-dont-pause t)
|
||||
|
||||
;; Disable ring
|
||||
(setq ring-bell-function 'ignore)
|
||||
|
||||
;; Highlith cursor
|
||||
(use-package beacon
|
||||
:config
|
||||
;; Set cursor
|
||||
(setq cursor-type 'bar)
|
||||
(beacon-mode 1))
|
||||
|
||||
;; Dired
|
||||
(use-package dired
|
||||
:init
|
||||
:config
|
||||
(setq dired-recursive-deletes 'top))
|
||||
|
||||
;; Imenu
|
||||
(use-package imenu
|
||||
:bind (("<f4>" . imenu))
|
||||
:init
|
||||
:config
|
||||
(setq imenu-autorescan t)
|
||||
(setq imenu-use-popup-menu t))
|
||||
|
||||
;; Display name of teh buffer
|
||||
(setq frame-title-format "GNU Emacs: %b")
|
||||
|
||||
;; Disable startup screen
|
||||
(setq inhibit-splash-screen t)
|
||||
(setq inhibit-startup-message t)
|
||||
|
||||
;; Show-paren-mode settings
|
||||
(show-paren-mode t)
|
||||
(setq show-paren-style 'expression)
|
||||
|
||||
;; Electric-modes settings
|
||||
(electric-pair-mode 1)
|
||||
(electric-indent-mode 1)
|
||||
|
||||
;; Delete selection
|
||||
(delete-selection-mode t)
|
||||
|
||||
;; Regexp search
|
||||
(global-set-key (kbd "C-s") #'isearch-forward-regexp)
|
||||
(global-set-key (kbd "C-r") #'isearch-backward-regexp)
|
||||
(global-set-key (kbd "C-M-s") #'isearch-forward)
|
||||
(global-set-key (kbd "C-M-r") #'isearch-backward))
|
||||
|
||||
(provide 'packages-config)
|
||||
|
||||
;;; packages-config.el ends here
|
Loading…
Reference in New Issue
Block a user