From 4c9d8ea075657b1c35d3b7352043725b59525a82 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Tue, 14 Sep 2021 16:56:56 -0500 Subject: ~mehehheheh --- lisp/acdw.el | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) (limited to 'lisp/acdw.el') diff --git a/lisp/acdw.el b/lisp/acdw.el index b8a1906..0790f2e 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el @@ -54,6 +54,16 @@ ARG). When called with multiple arguments or a list, it returns ;; I don't prefix these because ... reasons. Honestly I probably should prefix ;; them. +(defun truncate-string (len str &optional ellipsis) + "If STR is longer than LEN, cut it down and add ELLIPSIS to the end. +When not specified, ELLIPSIS defaults to '...'." + (declare (pure t) (side-effect-free t)) + (unless ellipsis + (setq ellipsis "...")) + (if (> (length str) len) + (format "%s%s" (substring str 0 (- len (length ellipsis))) ellipsis) + str)) + ;; Why isn't this a thing??? (defmacro fbound-and-true-p (func) "Return the value of function FUNC if it is bound, else nil." @@ -366,10 +376,15 @@ first." (goto-char (point-min)) (kill-line) (insert extracted-heading)) - (replace-regexp org-property-drawer-re "") ;Delete properties - (replace-regexp org-logbook-drawer-re "") ;Delete logbook + ;; Delete property drawers + (replace-regexp org-property-drawer-re "") + ;; Delete logbook drawers + (replace-regexp org-logbook-drawer-re "") + ;; Replace list items with their contents, paragraphed (replace-regexp org-list-full-item-re " \4") + ;; Delete comment lines + (replace-regexp (concat org-comment-regexp ".*$") "") ;; Re-fill text for clipboard (unfill-region (point-min) (point-max)) (flush-lines "^$" (point-min) (point-max))) @@ -626,12 +641,16 @@ This function is internal. Use `acdw/make-password-fetcher' instead." (setq-local blink-matching-paren nil show-paren-mode nil))) -;;; uh -(defun 💩 (n) - "💩 x N" + +;;; 💩 +(defun 💩 (&optional n) + "💩 x N." (interactive "p") - (dotimes (or n 1) - (insert "💩"))) + (let ((n (or n 1))) + (while (> n 0) + (insert "💩") + (setq n (1- n))))) + ;;; Fat finger solutions (defun acdw/fat-finger-exit (&optional prefix) -- cgit 1.4.1-21-gabe81