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-irc.el | 12 ------------ lisp/acdw-modeline.el | 12 ++++++++++-- lisp/acdw.el | 33 ++++++++++++++++++++++++++------- 3 files changed, 36 insertions(+), 21 deletions(-) (limited to 'lisp') diff --git a/lisp/acdw-irc.el b/lisp/acdw-irc.el index 3755441..b4b75ec 100644 --- a/lisp/acdw-irc.el +++ b/lisp/acdw-irc.el @@ -45,18 +45,6 @@ Stolen from s.el." (setq num (1- num))) (apply 'concat ss)))) -(if (fboundp 's-truncate) - (defalias 'truncate-string 's-truncate) - (defun truncate-string (len s &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 s) len) - (format "%s%s" (substring s 0 (- len (length ellipsis))) ellipsis) - s))) - ;;; IRC stuff diff --git a/lisp/acdw-modeline.el b/lisp/acdw-modeline.el index 5aa0a18..6e5afb8 100644 --- a/lisp/acdw-modeline.el +++ b/lisp/acdw-modeline.el @@ -33,12 +33,16 @@ Otherwise, cdr should be a function that takes two points (see `count-words')." (defun acdw-modeline/buffer-name () ; gonsie "Display the buffer name in a face reflecting its modified status." - (propertize " %b " + (propertize (concat " " + (truncate-string (/ (window-total-width) 2) + (buffer-name) "~") + " ") 'face (if (buffer-modified-p) 'font-lock-warning-face 'font-lock-type-face) - 'help-echo (buffer-file-name))) + 'help-echo (or (buffer-file-name) + (buffer-name)))) (defun acdw-modeline/erc () "ERC indicator for the modeline." @@ -151,6 +155,10 @@ is, if point < mark." (region-bounds)))) 'font-lock-face 'font-lock-variable-name-face)))) +(defun acdw-modeline/reading-mode () + "Display an indicator if currently in reading mode, mine or EWW's." + (concat (if reading-mode "R" "") (if eww-readable-p "w" ""))) + (defun acdw-modeline/text-scale () "Display the text scaling from the modeline, if scaled." ;; adapted from https://github.com/seagle0128/doom-modeline 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