about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2021-08-07 15:14:27 -0500
committerCase Duckworth2021-08-07 15:14:27 -0500
commit6619e7067eb40e15e501f84c03f205c4634ee0a2 (patch)
treec08c91564061f7647dc0b2ea458ca3af0bb67ecf
parentAdd C-g to quit re-builder (diff)
parentMerge branch 'main' of tildegit.org:acdw/emacs (diff)
downloademacs-6619e7067eb40e15e501f84c03f205c4634ee0a2.tar.gz
emacs-6619e7067eb40e15e501f84c03f205c4634ee0a2.zip
Merge branch 'main' of https://tildegit.org/acdw/emacs
-rw-r--r--init.el11
-rw-r--r--lisp/acdw-modeline.el6
-rw-r--r--lisp/acdw-org.el36
-rw-r--r--lisp/acdw.el9
4 files changed, 54 insertions, 8 deletions
diff --git a/init.el b/init.el index eb4d635..f3851f8 100644 --- a/init.el +++ b/init.el
@@ -133,6 +133,7 @@
133 'browse-url-mpv 133 'browse-url-mpv
134 'eww-browse-url)) 134 'eww-browse-url))
135 ("google\\.com" . browse-url-default-browser) 135 ("google\\.com" . browse-url-default-browser)
136 ("\\(twitter\\.com\\|t\\.co\\)" . acdw/eww-browse-twitter-url)
136 ("." . eww-browse-url))) 137 ("." . eww-browse-url)))
137 138
138 ;; Buttonize gemini:// links. 139 ;; Buttonize gemini:// links.
@@ -320,7 +321,7 @@
320 erc-kill-queries-on-quit t 321 erc-kill-queries-on-quit t
321 erc-kill-server-buffer-on-quit t 322 erc-kill-server-buffer-on-quit t
322 erc-nick "acdw" 323 erc-nick "acdw"
323 erc-nick-truncate (- erc-fill-static-center 2) 324 erc-nick-truncate (- erc-fill-static-center 1)
324 erc-prompt (lambda () (acdw-erc/prompt)) 325 erc-prompt (lambda () (acdw-erc/prompt))
325 erc-prompt-for-password nil ; use ~/.authinfo 326 erc-prompt-for-password nil ; use ~/.authinfo
326 erc-rename-buffers t 327 erc-rename-buffers t
@@ -1167,7 +1168,8 @@ if ripgrep is installed, otherwise `consult-grep'."
1167 "<S-return>" acdw-org/org-table-copy-down 1168 "<S-return>" acdw-org/org-table-copy-down
1168 "M-SPC M-SPC" insert-zero-width-space 1169 "M-SPC M-SPC" insert-zero-width-space
1169 "C-c C-l" org-insert-link-dwim 1170 "C-c C-l" org-insert-link-dwim
1170 "M-w" kill-ring-save-unfilled) 1171 "M-w" kill-ring-save-unfilled
1172 "M-=" acdw-org/count-words-stupidly)
1171 1173
1172 (with-eval-after-load 'org-export 1174 (with-eval-after-load 'org-export
1173 (add-to-list 'org-export-filter-final-output-functions 1175 (add-to-list 'org-export-filter-final-output-functions
@@ -1216,9 +1218,8 @@ if ripgrep is installed, otherwise `consult-grep'."
1216 1218
1217(setup (:straight simple-modeline) 1219(setup (:straight simple-modeline)
1218 (setup (:straight minions)) 1220 (setup (:straight minions))
1221 (require 'acdw-modeline)
1219 (:option 1222 (:option
1220 ;; `acdw-org/count-words' is too slow to use in the modeline.
1221 ;; (prepend acdw-modeline/word-count-modes) '(org-mode . acdw-org/count-words)
1222 simple-modeline-segments '((acdw-modeline/modified 1223 simple-modeline-segments '((acdw-modeline/modified
1223 acdw-modeline/buffer-name 1224 acdw-modeline/buffer-name
1224 acdw-modeline/vc-branch 1225 acdw-modeline/vc-branch
@@ -1232,8 +1233,6 @@ if ripgrep is installed, otherwise `consult-grep'."
1232 acdw-modeline/winum 1233 acdw-modeline/winum
1233 acdw-modeline/minions 1234 acdw-modeline/minions
1234 simple-modeline-segment-major-mode))) 1235 simple-modeline-segment-major-mode)))
1235
1236 (require 'acdw-modeline)
1237 (simple-modeline-mode +1)) 1236 (simple-modeline-mode +1))
1238 1237
1239(setup (:straight sly) 1238(setup (:straight sly)
diff --git a/lisp/acdw-modeline.el b/lisp/acdw-modeline.el index ccc07cb..6131484 100644 --- a/lisp/acdw-modeline.el +++ b/lisp/acdw-modeline.el
@@ -32,7 +32,9 @@
32 32
33(defun acdw-modeline/erc () 33(defun acdw-modeline/erc ()
34 "ERC indicator for the modeline." 34 "ERC indicator for the modeline."
35 (when (boundp 'erc-modified-channels-object) 35 (when (and (boundp 'erc-modified-channels-object)
36 (not (bound-and-true-p org-clock-current-task))
37 )
36 (format-mode-line erc-modified-channels-object))) 38 (format-mode-line erc-modified-channels-object)))
37 39
38(defun acdw-modeline/god-mode-indicator () 40(defun acdw-modeline/god-mode-indicator ()
@@ -116,6 +118,6 @@ Uses `acdw-modeline/word-count-modes' to determine which function to use."
116 #'count-words)) 118 #'count-words))
117 (min (if (region-active-p) (region-beginning) (point-min))) 119 (min (if (region-active-p) (region-beginning) (point-min)))
118 (max (if (region-active-p) (region-end) (point-max)))) 120 (max (if (region-active-p) (region-end) (point-max))))
119 (format "%dW" (funcall fn min max))))) 121 (format " %dW" (funcall fn min max)))))
120 122
121(provide 'acdw-modeline) 123(provide 'acdw-modeline)
diff --git a/lisp/acdw-org.el b/lisp/acdw-org.el index 41073a9..6a11c4d 100644 --- a/lisp/acdw-org.el +++ b/lisp/acdw-org.el
@@ -304,6 +304,42 @@ the deletion might narrow the column."
304 (message "%d words in buffer" 304 (message "%d words in buffer"
305 (acdw-org/count-words (point-min) (point-max)))))) 305 (acdw-org/count-words (point-min) (point-max))))))
306 306
307;; This isn't the best code, but it'll do.
308(defun acdw-org/count-words-stupidly (start end)
309 "Count words between START and END, ignoring a lot."
310 (interactive (list nil nil))
311 (cond ((not (called-interactively-p 'any))
312 (let ((words 0))
313 (save-excursion
314 (save-restriction
315 (narrow-to-region start end)
316 (goto-char (point-min))
317 (while (< (point) (point-max))
318 (cond
319 ;; Ignore comments
320 ((or (org-at-comment-p)
321 (org-in-commented-heading-p))
322 (forward-line))
323 ;; Ignore headings
324 ((or (org-at-heading-p))
325 (forward-line))
326 ;; Ignore drawers
327 ((or (looking-at org-drawer-regexp)
328 (looking-at org-clock-drawer-re))
329 (search-forward ":END:"))
330 ;; Count everything else
331 (t (setq words (1+ words))
332 (forward-word-strictly))))))
333 words))
334 ((use-region-p)
335 (message "%d words in region"
336 (acdw-org/count-words-stupidly (region-beginning)
337 (region-end))))
338 (t
339 (message "%d words in buffer"
340 (acdw-org/count-words-stupidly (point-min)
341 (point-max))))))
342
307 343
308;;; Zero-width spaces 344;;; Zero-width spaces
309;; https://blog.tecosaur.com/tmio/2021-05-31-async.html#easy-zero-width 345;; https://blog.tecosaur.com/tmio/2021-05-31-async.html#easy-zero-width
diff --git a/lisp/acdw.el b/lisp/acdw.el index 9d8c489..be12dd6 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el
@@ -497,6 +497,15 @@ Then, build `browse-url-button-regexp' with the new protocol."
497 (add-to-list 'acdw/button-protocols proto) 497 (add-to-list 'acdw/button-protocols proto)
498 (setq-default browse-url-button-regexp (acdw/build-button-url-regexp))) 498 (setq-default browse-url-button-regexp (acdw/build-button-url-regexp)))
499 499
500;;; Browse-URL tweaks
501
502;; convert twitter.com to nitter
503(defun acdw/eww-browse-twitter-url (url &rest args)
504 "Browse a Twitter.com URL using Nitter."
505 (let* ((nitter "nitter.snopyta.org")
506 (url (replace-regexp-in-string "twitter\\.com" nitter url)))
507 (eww-browse-url url args)))
508
500 509
501;;; Recentf renaming with dired 510;;; Recentf renaming with dired
502;; from ... somewhere. 'rjs', apparently? 511;; from ... somewhere. 'rjs', apparently?