diff options
-rw-r--r-- | init.el | 11 | ||||
-rw-r--r-- | lisp/acdw-modeline.el | 6 | ||||
-rw-r--r-- | lisp/acdw-org.el | 36 | ||||
-rw-r--r-- | lisp/acdw.el | 9 |
4 files changed, 54 insertions, 8 deletions
diff --git a/init.el b/init.el index d4ca71b..26474b8 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 |
@@ -1163,7 +1164,8 @@ if ripgrep is installed, otherwise `consult-grep'." | |||
1163 | "<S-return>" acdw-org/org-table-copy-down | 1164 | "<S-return>" acdw-org/org-table-copy-down |
1164 | "M-SPC M-SPC" insert-zero-width-space | 1165 | "M-SPC M-SPC" insert-zero-width-space |
1165 | "C-c C-l" org-insert-link-dwim | 1166 | "C-c C-l" org-insert-link-dwim |
1166 | "M-w" kill-ring-save-unfilled) | 1167 | "M-w" kill-ring-save-unfilled |
1168 | "M-=" acdw-org/count-words-stupidly) | ||
1167 | 1169 | ||
1168 | (with-eval-after-load 'org-export | 1170 | (with-eval-after-load 'org-export |
1169 | (add-to-list 'org-export-filter-final-output-functions | 1171 | (add-to-list 'org-export-filter-final-output-functions |
@@ -1212,9 +1214,8 @@ if ripgrep is installed, otherwise `consult-grep'." | |||
1212 | 1214 | ||
1213 | (setup (:straight simple-modeline) | 1215 | (setup (:straight simple-modeline) |
1214 | (setup (:straight minions)) | 1216 | (setup (:straight minions)) |
1217 | (require 'acdw-modeline) | ||
1215 | (:option | 1218 | (:option |
1216 | ;; `acdw-org/count-words' is too slow to use in the modeline. | ||
1217 | ;; (prepend acdw-modeline/word-count-modes) '(org-mode . acdw-org/count-words) | ||
1218 | simple-modeline-segments '((acdw-modeline/modified | 1219 | simple-modeline-segments '((acdw-modeline/modified |
1219 | acdw-modeline/buffer-name | 1220 | acdw-modeline/buffer-name |
1220 | acdw-modeline/vc-branch | 1221 | acdw-modeline/vc-branch |
@@ -1228,8 +1229,6 @@ if ripgrep is installed, otherwise `consult-grep'." | |||
1228 | acdw-modeline/winum | 1229 | acdw-modeline/winum |
1229 | acdw-modeline/minions | 1230 | acdw-modeline/minions |
1230 | simple-modeline-segment-major-mode))) | 1231 | simple-modeline-segment-major-mode))) |
1231 | |||
1232 | (require 'acdw-modeline) | ||
1233 | (simple-modeline-mode +1)) | 1232 | (simple-modeline-mode +1)) |
1234 | 1233 | ||
1235 | (setup (:straight sly) | 1234 | (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? |