summary refs log tree commit diff stats
path: root/lisp
diff options
context:
space:
mode:
authorCase Duckworth2021-09-14 16:56:56 -0500
committerCase Duckworth2021-09-14 16:56:56 -0500
commit4c9d8ea075657b1c35d3b7352043725b59525a82 (patch)
tree0534d2f30c690dbe824a34474241d6b5b44bb72f /lisp
parentAdd fat-finger-exit (diff)
downloademacs-4c9d8ea075657b1c35d3b7352043725b59525a82.tar.gz
emacs-4c9d8ea075657b1c35d3b7352043725b59525a82.zip
~mehehheheh
Diffstat (limited to 'lisp')
-rw-r--r--lisp/acdw-irc.el12
-rw-r--r--lisp/acdw-modeline.el12
-rw-r--r--lisp/acdw.el33
3 files changed, 36 insertions, 21 deletions
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."
45 (setq num (1- num))) 45 (setq num (1- num)))
46 (apply 'concat ss)))) 46 (apply 'concat ss))))
47 47
48(if (fboundp 's-truncate)
49 (defalias 'truncate-string 's-truncate)
50 (defun truncate-string (len s &optional ellipsis)
51 "If STR is longer than LEN, cut it down and add ELLIPSIS to the end.
52When not specified, ELLIPSIS defaults to '...'."
53 (declare (pure t) (side-effect-free t))
54 (unless ellipsis
55 (setq ellipsis "..."))
56 (if (> (length s) len)
57 (format "%s%s" (substring s 0 (- len (length ellipsis))) ellipsis)
58 s)))
59
60 48
61;;; IRC stuff 49;;; IRC stuff
62 50
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')."
33 33
34(defun acdw-modeline/buffer-name () ; gonsie 34(defun acdw-modeline/buffer-name () ; gonsie
35 "Display the buffer name in a face reflecting its modified status." 35 "Display the buffer name in a face reflecting its modified status."
36 (propertize " %b " 36 (propertize (concat " "
37 (truncate-string (/ (window-total-width) 2)
38 (buffer-name) "~")
39 " ")
37 'face 40 'face
38 (if (buffer-modified-p) 41 (if (buffer-modified-p)
39 'font-lock-warning-face 42 'font-lock-warning-face
40 'font-lock-type-face) 43 'font-lock-type-face)
41 'help-echo (buffer-file-name))) 44 'help-echo (or (buffer-file-name)
45 (buffer-name))))
42 46
43(defun acdw-modeline/erc () 47(defun acdw-modeline/erc ()
44 "ERC indicator for the modeline." 48 "ERC indicator for the modeline."
@@ -151,6 +155,10 @@ is, if point < mark."
151 (region-bounds)))) 155 (region-bounds))))
152 'font-lock-face 'font-lock-variable-name-face)))) 156 'font-lock-face 'font-lock-variable-name-face))))
153 157
158(defun acdw-modeline/reading-mode ()
159 "Display an indicator if currently in reading mode, mine or EWW's."
160 (concat (if reading-mode "R" "") (if eww-readable-p "w" "")))
161
154(defun acdw-modeline/text-scale () 162(defun acdw-modeline/text-scale ()
155 "Display the text scaling from the modeline, if scaled." 163 "Display the text scaling from the modeline, if scaled."
156 ;; adapted from https://github.com/seagle0128/doom-modeline 164 ;; 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
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.
59When 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,16 @@ 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
635 654
636;;; Fat finger solutions 655;;; Fat finger solutions
637(defun acdw/fat-finger-exit (&optional prefix) 656(defun acdw/fat-finger-exit (&optional prefix)