X-Git-Url: http://47.100.26.94:8080/?a=blobdiff_plain;f=emacs.d%2Felisp%2Futilities.el;h=7304762f9926d7adae5c0aba2315240a94a3b0ab;hb=4e8f8c61c4be30fef35b79795a3f74eb1cfcc122;hp=3f4fcd124d7d383de1f50a61aa1fbfa613116784;hpb=9d100553ca852b46023e20c58224bf95e77405ae;p=dotfiles.git diff --git a/emacs.d/elisp/utilities.el b/emacs.d/elisp/utilities.el index 3f4fcd1..7304762 100644 --- a/emacs.d/elisp/utilities.el +++ b/emacs.d/elisp/utilities.el @@ -33,7 +33,43 @@ (delete-region (point-min) (point)) (goto-char (- (point-max) current-point)))) +(defun sd/delete-current-window () + (interactive) + (if (> (length (window-list)) 1) + (delete-window) + (message "Only one Windows now!"))) + + +(defun sd/toggle-max-windows () + "Set maximize current if there are multiple windows, if only +one window, window undo" + (interactive) + (if (equal (length (window-list)) 1) + (winner-undo) + (delete-other-windows))) + +(defun sd/kill-region-or-backward-kill-word () + "Delete the region if it exists, otherwise kill a word backward." + (interactive) + (if (region-active-p) + (kill-region (point) (mark)) + (backward-kill-word 1))) + +;; https://www.emacswiki.org/emacs/TransparentEmacs +(defun sd/transparency (value) + "Sets the transparency of the frame window with a value from 0 to 100." + (interactive "nTransparency Value 0 - 100 opague:(default 80) ") + (set-frame-parameter (select-frame) 'alpha value)) + +(defun sd/toggle-transparency () + "Enable or disable transparency" + (interactive) + (let ((alpha (frame-parameter nil 'alpha))) + (set-frame-parameter nil 'alpha + (if (eql alpha 80) + 100 + 80))))