emacs.d/bundle/bundle--mk.el
2022-05-20 09:31:23 +02:00

90 lines
3.3 KiB
EmacsLisp

;; (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
'(("https://regexr.com/" regex debug)
("https://regex101.com/" regex debug)
("https://www.regextester.com/" regex debug)
("https://extendsclass.com/regex-tester.html#python" regex debug)))
(defvar mk/mirror-website
"Locally mirror a website using `wget -mkEpnp <ur>`")
(defvar mk/useful-regex
'(("[\w\s]+:" "match any word or space that precede the :")
("\[.*\]" "search for anything in square brackets")
("[A-Za-z]+" "upper and lowercase english alphabet")
("[0-9]" "numbers from 0 to 9")
("[A-Za-z\-\.]" "upper and lowercase english alphabet, - and .")
("(a-z)" "a, - and z")
("(\s+|,)" "spaces or a comma")
("#\w+" "find hashtags")
("([@|#]\w+)" "matches both mentions (@) and hashtags")
("(^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$)" "email regex")
("-?\d+(\.\d*)?" "matching decimal numbers")
("(?:http|https|ftp|mailto|file|data|irc):\/\/[A-Za-z0-9\-]{0,63}(\.[A-Za-z0-9\-]{0,63})+(:\d{1,4})?\/*(\/*[A-Za-z0-9\-._]+\/*)*(\?.*)?(#.*)?" "matching urls")
("^\d{4}/(0[1-9]|1[0-2])/(0[1-9]|[12][0-9]|3[01])$" "matching dates yyyy/mm/dd")
("^(0[1-9]|1[0-2])/(0[1-9]|[12][0-9]|3[01])/\d{4}$" "matching dates mm/dd/yyyy")
("^(0[1-9]|[12][0-9]|3[01])/(0[1-9]|1[0-2])/\d{4}$" "matching dates dd/mm/yyyy")
("<.+>" "matching html")
("<\/?(?:p|a|b|img)(?: \/)?>" "matchig specific tags")))