;;; -*- lexical-binding: t -*- ;; ;; this file: ;; https://dataswamp.org/~incal/emacs-init/string.el ;; ;; _-~~~~~~~~~~~~-._ ;; :;-· ` `-. `·- ;; :;, R. I. P ·: ;; ;;_.· -._ .: ;; :,^'^^^^^^^^^^^^^-: ;; :;,` `- `-._.: ;; _ - :· e-m-a-c-s ·: ;; _ :; d-e-v-e-l : - _ ;; - :; · -`: _ ;; _ _ :; haters flamers : - ;; _ :,· ; - ;; - :· ` hypotenuse .·: - _ ;; _ - :'. was here ,; - - ;; _____.:`·.___________..;:______ ;; ```^`^`^`^`^`^`^`^`^`^`^`^^`` (defun sign (label &optional no-insert) (interactive "sLabel: \nP") (let*((vertical "|") (horizontal ?-) (corner "+") (mid (format "%s %s %s" vertical label vertical)) (len (length mid)) (top (format "%s%s%s" corner (make-string (- len 2) horizontal) corner)) (sgn (format "%s\n%s\n%s\n" top mid top)) ) (if no-insert sgn (insert sgn) ))) ;; +---------------------+ ;; | This is not a bluff | ;; +---------------------+ (defun hline (&optional char) (interactive "P") (let ((len (- (window-width) (or (current-column) 0) 1)) (c (or (and (listp char) (car char)) (and (numberp char) char) ?-) )) (insert (make-string len c)) )) (defalias 'hl #'hline) (when nil (hline)---------------------------------------------------------------------- (hline 42)******************************************************************* (hline ?+)+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ M-x hline RET---------------------------------------------------------------- C-u C-u C-u M-x hline RET@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ C-u 59 M-x hline RET;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ) (defun string-data-p (str) (and (stringp str) (not (string= str "")) str) ) (provide 'string)