summary refs log tree commit diff stats
path: root/lisp
diff options
context:
space:
mode:
authorCase Duckworth2021-08-07 15:14:27 -0500
committerCase Duckworth2021-08-07 15:14:27 -0500
commit6619e7067eb40e15e501f84c03f205c4634ee0a2 (patch)
treec08c91564061f7647dc0b2ea458ca3af0bb67ecf /lisp
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
Diffstat (limited to 'lisp')
-rw-r--r--lisp/acdw-modeline.el6
-rw-r--r--lisp/acdw-org.el36
-rw-r--r--lisp/acdw.el9
3 files changed, 49 insertions, 2 deletions
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?