confi-emacs-actual/configs/base-functions.el

51 lines
1.6 KiB
EmacsLisp
Raw Normal View History

;;; base-functions.el --- Configuración de org-mode -*- lexical-binding: t -*-
2022-05-05 08:08:01 +02:00
;; Author: kj <webmaster@outcontrol.net>
;; URL: https://git.kj2.me/kj/confi-emacs-actual
;;; Commentary:
;;; Code:
2022-03-30 01:21:13 +02:00
;; Buscar el texto actualmente seleccionado
(defun kj-isearch-with-region ()
"Use region as the isearch text."
(when mark-active
(let ((region (funcall region-extract-function nil)))
(deactivate-mark)
(isearch-push-state)
(isearch-yank-string region))))
(add-hook 'isearch-mode-hook #'kj-isearch-with-region)
;; Borrar espacios, tabs y saltos de línea innecesarios al guardar
(add-hook 'before-save-hook 'delete-trailing-whitespace)
;; Hacer emacs transparente (no funciona perfecto, pero sirve)
(defun toggle-transparency ()
2022-05-05 08:08:01 +02:00
"Cambia la transparencia de Emacs (es un poco useless)."
2022-03-30 01:21:13 +02:00
(interactive)
(let ((alpha (frame-parameter nil 'alpha)))
(set-frame-parameter
nil 'alpha
(if (eql (cond ((numberp alpha) alpha)
((numberp (cdr alpha)) (cdr alpha))
;; Also handle undocumented (<active> <inactive>) form.
((numberp (cadr alpha)) (cadr alpha)))
100)
'(60 . 60) '(100 . 100)))))
(defun transparency (value)
2022-05-05 08:08:01 +02:00
"Set the transparency VALUE of the frame window. 0=transparent/100=opaque."
2022-03-30 01:21:13 +02:00
(interactive "nTransparency Value 0 - 100 opaque:")
(set-frame-parameter (selected-frame) 'alpha value))
2022-05-05 08:08:01 +02:00
(defun icon-displayable-p ()
"Return non-nil if icons are displayable."
(and (display-graphic-p) (daemonp)
(or (featurep 'all-the-icons)
(require 'all-the-icons nil t))))
2022-05-05 08:08:01 +02:00
(provide 'base-functions)
;;; base-functions.el ends here.