Merge branch 'main' of https://tildegit.org/acdw/emacs
This commit is contained in:
commit
6619e7067e
11
init.el
11
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.
|
||||
|
@ -320,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-rename-buffers t
|
||||
|
@ -1167,7 +1168,8 @@ if ripgrep is installed, otherwise `consult-grep'."
|
|||
"<S-return>" 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
|
||||
|
@ -1216,9 +1218,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
|
||||
|
@ -1232,8 +1233,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)
|
||||
|
|
|
@ -32,7 +32,9 @@
|
|||
|
||||
(defun acdw-modeline/erc ()
|
||||
"ERC indicator for the modeline."
|
||||
(when (boundp 'erc-modified-channels-object)
|
||||
(when (and (boundp 'erc-modified-channels-object)
|
||||
(not (bound-and-true-p org-clock-current-task))
|
||||
)
|
||||
(format-mode-line erc-modified-channels-object)))
|
||||
|
||||
(defun acdw-modeline/god-mode-indicator ()
|
||||
|
@ -116,6 +118,6 @@ Uses `acdw-modeline/word-count-modes' to determine which function to use."
|
|||
#'count-words))
|
||||
(min (if (region-active-p) (region-beginning) (point-min)))
|
||||
(max (if (region-active-p) (region-end) (point-max))))
|
||||
(format "%dW" (funcall fn min max)))))
|
||||
(format " %dW" (funcall fn min max)))))
|
||||
|
||||
(provide 'acdw-modeline)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -497,6 +497,15 @@ Then, build `browse-url-button-regexp' with the new protocol."
|
|||
(add-to-list 'acdw/button-protocols proto)
|
||||
(setq-default browse-url-button-regexp (acdw/build-button-url-regexp)))
|
||||
|
||||
;;; Browse-URL tweaks
|
||||
|
||||
;; convert twitter.com to nitter
|
||||
(defun acdw/eww-browse-twitter-url (url &rest args)
|
||||
"Browse a Twitter.com URL using Nitter."
|
||||
(let* ((nitter "nitter.snopyta.org")
|
||||
(url (replace-regexp-in-string "twitter\\.com" nitter url)))
|
||||
(eww-browse-url url args)))
|
||||
|
||||
|
||||
;;; Recentf renaming with dired
|
||||
;; from ... somewhere. 'rjs', apparently?
|
||||
|
|
Loading…
Reference in New Issue