58 lines
1.7 KiB
EmacsLisp
58 lines
1.7 KiB
EmacsLisp
;;; base-functions.el --- Configuración de org-mode
|
|
|
|
;; Author: kj <webmaster@outcontrol.net>
|
|
;; URL: https://git.kj2.me/kj/confi-emacs-actual
|
|
|
|
;;; Commentary:
|
|
|
|
;;; Code:
|
|
|
|
;; 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)
|
|
|
|
|
|
;; Generar archivo TAGS
|
|
(defun create-tags (dir-name)
|
|
"Create tags file in DIR-NAME."
|
|
(interactive "DDirectory: ")
|
|
(shell-command
|
|
(format "cd '%s' && ctags -f TAGS -e -R --exclude=*.min.js"
|
|
(directory-file-name (file-truename dir-name))
|
|
)
|
|
)
|
|
(message "Archivo TAGS generado.")
|
|
)
|
|
|
|
;; Hacer emacs transparente (no funciona perfecto, pero sirve)
|
|
(defun toggle-transparency ()
|
|
"Cambia la transparencia de Emacs (es un poco useless)."
|
|
(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)
|
|
"Set the transparency VALUE of the frame window. 0=transparent/100=opaque."
|
|
(interactive "nTransparency Value 0 - 100 opaque:")
|
|
(set-frame-parameter (selected-frame) 'alpha value))
|
|
|
|
(provide 'base-functions)
|
|
;;; base-functions.el ends here.
|