diff options
Diffstat (limited to 'lisp/acdw.el')
-rw-r--r-- | lisp/acdw.el | 45 |
1 files changed, 38 insertions, 7 deletions
diff --git a/lisp/acdw.el b/lisp/acdw.el index 91381da..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 | |||
54 | ;; I don't prefix these because ... reasons. Honestly I probably should prefix | 54 | ;; I don't prefix these because ... reasons. Honestly I probably should prefix |
55 | ;; them. | 55 | ;; them. |
56 | 56 | ||
57 | (defun truncate-string (len str &optional ellipsis) | ||
58 | "If STR is longer than LEN, cut it down and add ELLIPSIS to the end. | ||
59 | When not specified, ELLIPSIS defaults to '...'." | ||
60 | (declare (pure t) (side-effect-free t)) | ||
61 | (unless ellipsis | ||
62 | (setq ellipsis "...")) | ||
63 | (if (> (length str) len) | ||
64 | (format "%s%s" (substring str 0 (- len (length ellipsis))) ellipsis) | ||
65 | str)) | ||
66 | |||
57 | ;; Why isn't this a thing??? | 67 | ;; Why isn't this a thing??? |
58 | (defmacro fbound-and-true-p (func) | 68 | (defmacro fbound-and-true-p (func) |
59 | "Return the value of function FUNC if it is bound, else nil." | 69 | "Return the value of function FUNC if it is bound, else nil." |
@@ -366,10 +376,15 @@ first." | |||
366 | (goto-char (point-min)) | 376 | (goto-char (point-min)) |
367 | (kill-line) | 377 | (kill-line) |
368 | (insert extracted-heading)) | 378 | (insert extracted-heading)) |
369 | (replace-regexp org-property-drawer-re "") ;Delete properties | 379 | ;; Delete property drawers |
370 | (replace-regexp org-logbook-drawer-re "") ;Delete logbook | 380 | (replace-regexp org-property-drawer-re "") |
381 | ;; Delete logbook drawers | ||
382 | (replace-regexp org-logbook-drawer-re "") | ||
383 | ;; Replace list items with their contents, paragraphed | ||
371 | (replace-regexp org-list-full-item-re " | 384 | (replace-regexp org-list-full-item-re " |
372 | \4") | 385 | \4") |
386 | ;; Delete comment lines | ||
387 | (replace-regexp (concat org-comment-regexp ".*$") "") | ||
373 | ;; Re-fill text for clipboard | 388 | ;; Re-fill text for clipboard |
374 | (unfill-region (point-min) (point-max)) | 389 | (unfill-region (point-min) (point-max)) |
375 | (flush-lines "^$" (point-min) (point-max))) | 390 | (flush-lines "^$" (point-min) (point-max))) |
@@ -626,12 +641,28 @@ This function is internal. Use `acdw/make-password-fetcher' instead." | |||
626 | (setq-local blink-matching-paren nil | 641 | (setq-local blink-matching-paren nil |
627 | show-paren-mode nil))) | 642 | show-paren-mode nil))) |
628 | 643 | ||
629 | ;;; uh | 644 | |
630 | (defun 💩 (n) | 645 | ;;; 💩 |
631 | "💩 x N" | 646 | (defun 💩 (&optional n) |
647 | "💩 x N." | ||
632 | (interactive "p") | 648 | (interactive "p") |
633 | (dotimes (or n 1) | 649 | (let ((n (or n 1))) |
634 | (insert "💩"))) | 650 | (while (> n 0) |
651 | (insert "💩") | ||
652 | (setq n (1- n))))) | ||
653 | |||
654 | |||
655 | ;;; Fat finger solutions | ||
656 | (defun acdw/fat-finger-exit (&optional prefix) | ||
657 | "Delete a frame, or kill Emacs with confirmation. | ||
658 | When called with PREFIX, just kill Emacs without confirmation." | ||
659 | (interactive "P") | ||
660 | (if (or prefix | ||
661 | (and (= 1 (length (frame-list))) | ||
662 | (yes-or-no-p "This is the last frame! Wanna quit?"))) | ||
663 | (kill-emacs) | ||
664 | (ignore-errors | ||
665 | (delete-frame)))) | ||
635 | 666 | ||
636 | (provide 'acdw) | 667 | (provide 'acdw) |
637 | ;;; acdw.el ends here | 668 | ;;; acdw.el ends here |