150 lines
5.5 KiB
EmacsLisp
150 lines
5.5 KiB
EmacsLisp
;;; init-base.el --- Configuración base de emacs -*- lexical-binding: t -*-
|
|
|
|
;; Author: kj <webmaster@outcontrol.net>
|
|
;; URL: https://git.kj2.me/kj/confi-emacs-actual
|
|
|
|
;;; Commentary:
|
|
|
|
;; Configuración base de Emacs, no incluye extensiones,
|
|
;; pero si el theme y los fonts.
|
|
|
|
;;; Code:
|
|
|
|
;; Native compilation
|
|
(when (and (fboundp 'native-comp-available-p)
|
|
(native-comp-available-p))
|
|
(progn
|
|
(setq native-comp-async-report-warnings-errors nil)
|
|
(setq comp-deferred-compilation t)
|
|
(setq package-native-compile t)
|
|
))
|
|
|
|
;; Instalar straight.el (reemplpazando package.el)
|
|
(defvar bootstrap-version)
|
|
(let ((bootstrap-file
|
|
(expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
|
|
(bootstrap-version 5))
|
|
(unless (file-exists-p bootstrap-file)
|
|
(with-current-buffer
|
|
(url-retrieve-synchronously
|
|
"https://raw.githubusercontent.com/radian-software/straight.el/master/install.el"
|
|
'silent 'inhibit-cookies)
|
|
(goto-char (point-max))
|
|
(eval-print-last-sexp)))
|
|
(load bootstrap-file nil 'nomessage))
|
|
|
|
;; Initialize package sources
|
|
;; (require 'package)
|
|
|
|
;; (setq package-archives '(("melpa" . "https://melpa.org/packages/")
|
|
;; ("org" . "https://orgmode.org/elpa/")
|
|
;; ("elpa" . "https://elpa.gnu.org/packages/")))
|
|
|
|
;; (package-initialize)
|
|
|
|
;; Actualizar repositorios si aún no esta actualizados
|
|
;; (unless package-archive-contents
|
|
;; (package-refresh-contents))
|
|
|
|
;; Instalar use-package si no está instalado
|
|
(straight-use-package 'use-package)
|
|
(setq use-package-always-ensure t)
|
|
|
|
;; Theme
|
|
(use-package dracula-theme
|
|
:straight t
|
|
:config
|
|
(load-theme 'dracula t)
|
|
(set-face-attribute 'default nil :font "Fira Code Retina" :height 112) ; Font
|
|
)
|
|
|
|
;; Instalar use-package en caso de no tenerlo
|
|
;;(unless (package-installed-p 'use-package)
|
|
;; (package-install 'use-package))
|
|
|
|
(defconst private-dir (expand-file-name "private" user-emacs-directory))
|
|
(defconst temp-dir (format "%s/cache" private-dir)
|
|
"Hostname-based elisp temp directories.")
|
|
|
|
;; UTF-8 please
|
|
(set-charset-priority 'unicode)
|
|
(setq locale-coding-system 'utf-8) ; pretty
|
|
(set-terminal-coding-system 'utf-8) ; pretty
|
|
(set-keyboard-coding-system 'utf-8) ; pretty
|
|
(set-selection-coding-system 'utf-8) ; please
|
|
(prefer-coding-system 'utf-8) ; with sugar on top
|
|
(setq default-process-coding-system '(utf-8-unix . utf-8-unix))
|
|
|
|
;; Emacs customizations
|
|
(menu-bar-mode 0) ; Quitar menús.
|
|
(tool-bar-mode 0) ; Quitar toolbar.
|
|
(scroll-bar-mode -1) ; Quitar scrollbar.
|
|
(tooltip-mode -1) ; Disable tooltips.
|
|
(global-display-line-numbers-mode) ; Mostar número de línea.
|
|
(show-paren-mode 1) ; Habilitar resaltado de brackets.
|
|
;;(cua-mode t) ; Usar CTRL+X, CTRL+C, CTRL+V y CTRL+Z para cortar, copiar, pegar y deshacer.
|
|
|
|
(setq-default
|
|
cursor-type 'bar ; Usar la barrita como cursor
|
|
cursor-in-non-selected-windows nil ; Desaparecer el cursor en frames no activos.
|
|
indent-tabs-mode nil ; Cambiar tabs por espacios.
|
|
inhibit-startup-message t ; Eliminar el mensaje de inicio.
|
|
)
|
|
(setq
|
|
custom-file (concat private-dir "/.custom.el") ; Cabiar la ruta del código que se genera al isntalar un theme o package
|
|
ac-ignore-case nil ; Desactivar el autocapitalizado.
|
|
ac-disable-faces nil ; Auto-complete hablitado incluso entre comillas (fuente: https://bit.ly/3a9wCB4).
|
|
global-hl-line-mode 1 ; Resaltar línea actual por defecto.
|
|
tags-revert-without-query 1 ; Recargar tags (ctags) sin pedir confirmación.
|
|
)
|
|
;; Leve transparencia en emacs por defecto.
|
|
(set-frame-parameter (selected-frame) 'alpha '(98 . 98))
|
|
(add-to-list 'default-frame-alist '(alpha . (98 . 98)))
|
|
|
|
;; Backups enabled, use nil to disable
|
|
(setq
|
|
history-length 1000
|
|
backup-inhibited nil
|
|
make-backup-files nil
|
|
auto-save-default nil
|
|
auto-save-list-file-name (concat temp-dir "/autosave")
|
|
create-lockfiles nil
|
|
backup-directory-alist `((".*" . ,(concat temp-dir "/backup/")))
|
|
auto-save-file-name-transforms `((".*" ,(concat temp-dir "/auto-save-list/") t)))
|
|
|
|
;; Configuración cuando es un server
|
|
(defun setup-daemon ()
|
|
"Carga la configuración del modo daemon."
|
|
(message "Corriendo en modo daemon.")
|
|
(set-face-attribute 'default nil :font "Fira Code Retina" :height 112)
|
|
|
|
;; Set the fixed pitch face
|
|
;;(set-face-attribute 'fixed-pitch nil :font "Fira Code Retina")
|
|
|
|
;; Set the variable pitch face
|
|
;;(set-face-attribute 'variable-pitch nil :font "Cantarell" :weight 'regular)
|
|
|
|
;; Abrir primero el dashboard
|
|
(setq initial-buffer-choice (lambda () (get-buffer "*dashboard*")))
|
|
|
|
;; Cerrar buffers al cerrar emacsclient
|
|
(add-hook 'delete-frame-functions
|
|
(lambda (frame)
|
|
(mapc 'kill-buffer (delq (get-buffer "*dashboard*") (buffer-list)))
|
|
))
|
|
)
|
|
|
|
(if (daemonp)
|
|
(add-hook 'after-make-frame-functions
|
|
(lambda (frame)
|
|
(with-selected-frame frame
|
|
(setup-daemon))))
|
|
(message "Corriendo en modo normal."))
|
|
|
|
;(add-hook 'window-setup-hook 'toggle-frame-maximized t)
|
|
|
|
(load custom-file)
|
|
|
|
(provide 'init-base)
|
|
;;; init-base.el ends here
|