;;; init-base.el --- Configuración base de emacs -*- lexical-binding: t -*- ;; Author: kj ;; URL: https://git.kj2.me/kj/confi-emacs-actual ;;; Commentary: ;; Configuración general de Emacs. ;;; Code: (require 'init-functions) ;; 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) )) ;; Garbage Collector Magic Hack (use-package gcmh :diminish :hook (emacs-startup . gcmh-mode) :init (setq gcmh-idle-delay 'auto gcmh-auto-idle-delay-factor 10 gcmh-high-cons-threshold #x1000000)) ; 16MB ;; Guardar la posición del cursor en un archivo para volver allí cuando se lo vuelva a abrir. (use-package saveplace :ensure nil :hook (after-init . save-place-mode)) ;; Recentf - Guarda registro de los archivos abiertos recientemente (use-package recentf :ensure nil :bind (("C-x C-r" . recentf-open-files)) :hook (after-init . recentf-mode) :init (setq recentf-max-saved-items 300 recentf-exclude '("\\.?cache" ".cask" "url" "COMMIT_EDITMSG\\'" "bookmarks" "\\.\\(?:gz\\|gif\\|svg\\|png\\|jpe?g\\|bmp\\|xpm\\)$" "\\.?ido\\.last$" "\\.revive$" "/G?TAGS$" "/.elfeed/" "^/tmp/" "^/var/folders/.+$" "^/ssh:" "/persp-confs/" (lambda (file) (file-in-directory-p file package-user-dir)))) :config (push (expand-file-name recentf-save-file) recentf-exclude) (add-to-list 'recentf-filename-handlers #'abbreviate-file-name)) ;; Guarda el historial del minibuffer (use-package savehist :ensure nil :hook (after-init . savehist-mode) :init (setq enable-recursive-minibuffers t ; Allow commands in minibuffers history-length 1000 savehist-additional-variables '(mark-ring global-mark-ring search-ring regexp-search-ring extended-command-history) savehist-autosave-interval 300)) ;; Misc. (use-package simple :ensure nil :hook ((after-init . size-indication-mode) (text-mode . visual-line-mode)) :init (setq column-number-mode t line-number-mode t kill-whole-line t ; Kill line including '\n' (C-k) line-move-visual nil track-eol t ; Keep cursor at end of lines. Require line-move-visual is nil. set-mark-command-repeat-pop t) ; Repeating C-SPC after popping mark pops it again ;; Visualize TAB, (HARD) SPACE, NEWLINE (setq-default show-trailing-whitespace nil ; Don't show trailing whitespace by default cursor-type 'bar) ; Usar la barrita como cursor (setq show-trailing-whitespace t) (add-hook 'before-save-hook #'delete-trailing-whitespace nil t) ) ;; UTF-8 please (when (fboundp 'set-charset-priority) (set-charset-priority 'unicode)) (set-language-environment "UTF-8") (set-default-coding-systems 'utf-8) (set-buffer-file-coding-system 'utf-8) (set-clipboard-coding-system 'utf-8) (set-file-name-coding-system 'utf-8) (set-keyboard-coding-system 'utf-8) (set-next-selection-coding-system 'utf-8) (set-selection-coding-system 'utf-8) (set-terminal-coding-system 'utf-8) (setq locale-coding-system 'utf-8) (setq system-time-locale "C") ;; Misc (if (boundp 'use-short-answers) (setq use-short-answers t) (fset 'yes-or-no-p 'y-or-n-p)) (setq-default major-mode 'text-mode fill-column 80 tab-width 4 indent-tabs-mode nil) ; Permanently indent with spaces, never with TABs (setq visible-bell t inhibit-compacting-font-caches t ; Don’t compact font caches during GC delete-by-moving-to-trash t ; Deleting files go to OS's trash folder make-backup-files nil ; Forbide to make backup files auto-save-default nil ; Disable auto sav inhibit-splash-screen t uniquify-buffer-name-style 'post-forward-angle-brackets ; Show path if names are same adaptive-fill-regexp "[ t]+|[ t]*([0-9]+.|*+)[ t]*" adaptive-fill-first-line-regexp "^* *$" sentence-end "\\([。!?]\\|……\\|[.?!][]\"')}]*\\($\\|[ \t]\\)\\)[ \t\n]*" sentence-end-double-space nil word-wrap-by-category t) ;; Async (use-package async :functions (async-bytecomp-package-mode dired-async-mode) :init (async-bytecomp-package-mode 1) (dired-async-mode 1)) ;; Child frame (use-package posframe :hook (after-load-theme . posframe-delete-all) :init (defface posframe-border `((t (:inherit region))) "Face used by the `posframe' border." :group 'posframe) (defvar posframe-border-width 2 "Default posframe border width.") :config (with-no-warnings (defun my-posframe--prettify-frame (&rest _) (set-face-background 'fringe nil posframe--frame)) (advice-add #'posframe--create-posframe :after #'my-posframe--prettify-frame) (defun posframe-poshandler-frame-center-near-bottom (info) (cons (/ (- (plist-get info :parent-frame-width) (plist-get info :posframe-width)) 2) (/ (+ (plist-get info :parent-frame-height) (* 2 (plist-get info :font-height))) 2))))) (provide 'init-base) ;;; init-base.el ends here