From 4f72e23f72f9712999b8f629a4c62d6f78b65d3b Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Sat, 7 Aug 2021 15:05:16 -0500 Subject: Add twitter.com URL handling TODO: This could be smarter, e.g. not going to nitter if twitter.com/t.co is part of the URL query. --- init.el | 1 + 1 file changed, 1 insertion(+) (limited to 'init.el') diff --git a/init.el b/init.el index f31da5d..a4d8535 100644 --- a/init.el +++ b/init.el @@ -133,6 +133,7 @@ 'browse-url-mpv 'eww-browse-url)) ("google\\.com" . browse-url-default-browser) + ("\\(twitter\\.com\\|t\\.co\\)" . acdw/eww-browse-twitter-url) ("." . eww-browse-url))) ;; Buttonize gemini:// links. -- cgit 1.4.1-21-gabe81 From 87bdfcf43a0c39195319168461d69f8e74891193 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Sat, 7 Aug 2021 15:06:19 -0500 Subject: Truncate less of ERC nick --- init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'init.el') diff --git a/init.el b/init.el index a4d8535..afd58ad 100644 --- a/init.el +++ b/init.el @@ -321,7 +321,7 @@ erc-kill-queries-on-quit t erc-kill-server-buffer-on-quit t erc-nick "acdw" - erc-nick-truncate (- erc-fill-static-center 2) + erc-nick-truncate (- erc-fill-static-center 1) erc-prompt (lambda () (acdw-erc/prompt)) erc-prompt-for-password nil ; use ~/.authinfo erc/servers -- cgit 1.4.1-21-gabe81 From 41b48c481471406470268209220019a4c3331a3f Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Sat, 7 Aug 2021 15:07:04 -0500 Subject: Add `acdw-org/count-words-stupidly' To count words in an Org-mode buffer, disregarding headings and drawers completely. --- init.el | 3 ++- lisp/acdw-org.el | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) (limited to 'init.el') diff --git a/init.el b/init.el index afd58ad..880986a 100644 --- a/init.el +++ b/init.el @@ -1161,7 +1161,8 @@ if ripgrep is installed, otherwise `consult-grep'." "" acdw-org/org-table-copy-down "M-SPC M-SPC" insert-zero-width-space "C-c C-l" org-insert-link-dwim - "M-w" kill-ring-save-unfilled) + "M-w" kill-ring-save-unfilled + "M-=" acdw-org/count-words-stupidly) (with-eval-after-load 'org-export (add-to-list 'org-export-filter-final-output-functions 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." (message "%d words in buffer" (acdw-org/count-words (point-min) (point-max)))))) +;; This isn't the best code, but it'll do. +(defun acdw-org/count-words-stupidly (start end) + "Count words between START and END, ignoring a lot." + (interactive (list nil nil)) + (cond ((not (called-interactively-p 'any)) + (let ((words 0)) + (save-excursion + (save-restriction + (narrow-to-region start end) + (goto-char (point-min)) + (while (< (point) (point-max)) + (cond + ;; Ignore comments + ((or (org-at-comment-p) + (org-in-commented-heading-p)) + (forward-line)) + ;; Ignore headings + ((or (org-at-heading-p)) + (forward-line)) + ;; Ignore drawers + ((or (looking-at org-drawer-regexp) + (looking-at org-clock-drawer-re)) + (search-forward ":END:")) + ;; Count everything else + (t (setq words (1+ words)) + (forward-word-strictly)))))) + words)) + ((use-region-p) + (message "%d words in region" + (acdw-org/count-words-stupidly (region-beginning) + (region-end)))) + (t + (message "%d words in buffer" + (acdw-org/count-words-stupidly (point-min) + (point-max)))))) + ;;; Zero-width spaces ;; https://blog.tecosaur.com/tmio/2021-05-31-async.html#easy-zero-width -- cgit 1.4.1-21-gabe81 From f53bc679135fb9bca30fcb5fed57e05042360594 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Sat, 7 Aug 2021 15:08:01 -0500 Subject: Change acdw-modeline requirement location --- init.el | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'init.el') diff --git a/init.el b/init.el index 880986a..d226d77 100644 --- a/init.el +++ b/init.el @@ -1211,9 +1211,8 @@ if ripgrep is installed, otherwise `consult-grep'." (setup (:straight simple-modeline) (setup (:straight minions)) + (require 'acdw-modeline) (:option - ;; `acdw-org/count-words' is too slow to use in the modeline. - ;; (prepend acdw-modeline/word-count-modes) '(org-mode . acdw-org/count-words) simple-modeline-segments '((acdw-modeline/modified acdw-modeline/buffer-name acdw-modeline/vc-branch @@ -1227,8 +1226,6 @@ if ripgrep is installed, otherwise `consult-grep'." acdw-modeline/winum acdw-modeline/minions simple-modeline-segment-major-mode))) - - (require 'acdw-modeline) (simple-modeline-mode +1)) (setup (:straight sly) -- cgit 1.4.1-21-gabe81