Rename personal functions

This commit is contained in:
Marcus Kammer 2022-08-24 19:34:56 +02:00
parent 8887ed4cba
commit 104dc5ee94
Signed by: marcuskammer
GPG key ID: C374817BE285268F

View file

@ -1,66 +1,3 @@
;; (defun mk-show-modeline ()
;; (interactive)
;; (setq mode-line-format
;; '(("-" mode-line-mule-info
;; mode-line-modified
;; mode-line-frame-identification
;; mode-line-buffer-identification " "
;; mode-line-position
;; mode-line-modes
;; (which-func-mode
;; ("" which-func-format "--"))
;; (global-mode-string
;; ("--" global-mode-string)) "-%-")))
;; (defvar mode-line-format-current
;; (symbol-value 'mode-line-format)))
;; (defun mk-hide-modeline ()
;; (interactive)
;; (setq mode-line-format nil))
;; (defun mk-write-mode-enable ()
;; (setq olivetti-body-width 73)
;; (olivetti-mode)
;; (mk-hide-modeline))
;; (defun mk-write-mode-disable ()
;; (olivetti-mode)
;; (mk-show-modeline))
(defun me/split-windows-horizontal (count-windows)
"Split windows horizontal by equal width."
(interactive "nHow many splits? ")
(delete-other-windows)
(let ((width (/ (window-total-width) count-windows)))
(dotimes (i (1- count-windows))
(split-window-right (- width)))))
(defun me/split-windows-vertical (count-windows)
"Split windows vertical by equal width."
(interactive "nHow many splits? ")
(delete-other-windows)
(let ((height (/ (window-total-height) count-windows)))
(dotimes (i (1- count-windows))
(split-window-below (- height)))))
(defun me/split-h3 ()
(interactive)
(me/split-windows-horizontal 3))
(defun me/split-v3 ()
(interactive)
(me/split-windows-vertical 3))
;; Set transparency of emacs
(defun transparency (value)
"Sets the transparency of the frame window. 0=transparent/100=opaque"
(interactive "nTransparency Value 0 - 100 opaque: ")
(set-frame-parameter (selected-frame) 'alpha value))
;; (if (display-graphic-p)
;; (add-hook 'after-init-hook (lambda () (org-agenda-list) (me/split-h3)))
;; (org-agenda-list))
(defvar mk/useful-websites (defvar mk/useful-websites
'(("https://regexr.com/" regex debug) '(("https://regexr.com/" regex debug)
("https://regex101.com/" regex debug) ("https://regex101.com/" regex debug)
@ -90,22 +27,86 @@
("<.+>" "matching html") ("<.+>" "matching html")
("<\/?(?:p|a|b|img)(?: \/)?>" "matchig specific tags"))) ("<\/?(?:p|a|b|img)(?: \/)?>" "matchig specific tags")))
(defun me/list-files (folder suffix) ;; (defun mk-show-modeline ()
;; (interactive)
;; (setq mode-line-format
;; '(("-" mode-line-mule-info
;; mode-line-modified
;; mode-line-frame-identification
;; mode-line-buffer-identification " "
;; mode-line-position
;; mode-line-modes
;; (which-func-mode
;; ("" which-func-format "--"))
;; (global-mode-string
;; ("--" global-mode-string)) "-%-")))
;; (defvar mode-line-format-current
;; (symbol-value 'mode-line-format)))
;; (defun mk-hide-modeline ()
;; (interactive)
;; (setq mode-line-format nil))
;; (defun mk-write-mode-enable ()
;; (setq olivetti-body-width 73)
;; (olivetti-mode)
;; (mk-hide-modeline))
;; (defun mk-write-mode-disable ()
;; (olivetti-mode)
;; (mk-show-modeline))
(defun mk/split-windows-horizontal (count-windows)
"Split windows horizontal by equal width."
(interactive "nHow many splits? ")
(delete-other-windows)
(let ((width (/ (window-total-width) count-windows)))
(dotimes (i (1- count-windows))
(split-window-right (- width)))))
(defun mk/split-windows-vertical (count-windows)
"Split windows vertical by equal width."
(interactive "nHow many splits? ")
(delete-other-windows)
(let ((height (/ (window-total-height) count-windows)))
(dotimes (i (1- count-windows))
(split-window-below (- height)))))
(defun mk/split-h3 ()
(interactive)
(mk/split-windows-horizontal 3))
(defun mk/split-v3 ()
(interactive)
(mk/split-windows-vertical 3))
;; Set transparency of emacs
(defun transparency (value)
"Sets the transparency of the frame window. 0=transparent/100=opaque"
(interactive "nTransparency Value 0 - 100 opaque: ")
(set-frame-parameter (selected-frame) 'alpha value))
(defun mk/show-agenda-list ()
(if (display-graphic-p)
(add-hook 'after-init-hook (lambda () (org-agenda-list) (me/split-h3)))
(org-agenda-list)))
(defun mk/list-files (folder suffix)
(let ((regexp (concat "\\." suffix "$"))) (let ((regexp (concat "\\." suffix "$")))
(directory-files folder nil regexp))) (directory-files folder nil regexp)))
(defun me/build-file-suffix ()) (defun mk/build-file-suffix ())
(defun me/copy-files (src-dir dst-dir suffix) (defun mk/copy-files (src-dir dst-dir suffix)
(let ((src-files '()) (let ((src-files '())
(src-dir (expand-file-name src-dir)) (src-dir (expand-file-name src-dir))
(dst-dir (expand-file-name dst-dir))) (dst-dir (expand-file-name dst-dir)))
(dolist (file (me/list-files src-dir suffix) src-files) (dolist (file (mk/list-files src-dir suffix) src-files)
(let ((src-file (expand-file-name (concat src-dir "/" file))) (let ((src-file (expand-file-name (concat src-dir "/" file)))
(dst-file (expand-file-name (concat dst-dir "/" file)))) (dst-file (expand-file-name (concat dst-dir "/" file))))
(add-to-list 'src-files src-file) (add-to-list 'src-files src-file)
(copy-file src-file dst-file t))))) (copy-file src-file dst-file t)))))
(defun me/delete-files (lst) (defun mk/delete-files (lst)
(dolist (file lst) (dolist (file lst)
(delete-file file t))) (delete-file file t)))