summary refs log tree commit diff stats
path: root/lisp/acdw.el
diff options
context:
space:
mode:
authorCase Duckworth2021-08-16 22:48:29 -0500
committerCase Duckworth2021-08-16 22:48:29 -0500
commita6fd6508c9f853df9f0a61079f2268cd88e3d5f7 (patch)
tree1e3eb323b6f44ed16f09a36e88624289080d7eef /lisp/acdw.el
parentChange work font to Inter (diff)
downloademacs-a6fd6508c9f853df9f0a61079f2268cd88e3d5f7.tar.gz
emacs-a6fd6508c9f853df9f0a61079f2268cd88e3d5f7.zip
Break out functionality into other files
Diffstat (limited to 'lisp/acdw.el')
-rw-r--r--lisp/acdw.el79
1 files changed, 3 insertions, 76 deletions
diff --git a/lisp/acdw.el b/lisp/acdw.el index 2aa6c1f..8cbe16d 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el
@@ -318,7 +318,9 @@ With a prefix argument, run git pull on the repo first."
318 (insert s) 318 (insert s)
319 (let ((sentence-end-double-space nil)) 319 (let ((sentence-end-double-space nil))
320 (unfill-region (point-min) (point-max))) 320 (unfill-region (point-min) (point-max)))
321 (copy-region-as-kill (point-min) (point-max))))) 321 (copy-region-as-kill (point-min) (point-max))
322 (when (called-interactively-p 'interactive)
323 (indicate-copied-region)))))
322 324
323(defun acdw/dir (&optional file make-directory) 325(defun acdw/dir (&optional file make-directory)
324 "Place Emacs files in one place. 326 "Place Emacs files in one place.
@@ -443,81 +445,6 @@ It's called 'require-private' for historical reasons."
443 :noerror :nomessage)) 445 :noerror :nomessage))
444 446
445 447
446;;; URL regexp
447;; really, I just want to add gemini:// protocol, but I'm going to do some
448;; reverse-engineering here.
449
450(defvar acdw/button-protocols '("http"
451 "https"
452 "shttp"
453 "shttps"
454 "ftp"
455 "file"
456 "gopher"
457 "nntp"
458 "news"
459 "telnet"
460 "wais"
461 "mailto"
462 "info")
463 "The list of protocols to splice into `browse-url-button-regexp'.")
464
465(defun acdw/build-button-url-regexp ()
466 "Build `browse-url-button-regexp' from `acdw/button-protocols'.
467I used `xr' (not included in Emacs) to get the RX form of the
468default, so I can easily splice the list into it. THIS IS
469BRITTLE AF!!!"
470 (rx-to-string ; thanks wgreenhouse!
471 `(seq word-boundary
472 (group
473 (group
474 (or "www."
475 (seq
476 (group (or ,@acdw/button-protocols))
477 ":")))
478 (opt
479 (group "//"
480 (one-or-more
481 (any "0-9a-z" "._-"))
482 ":"
483 (zero-or-more
484 (any "0-9"))))
485 (or
486 (seq
487 (one-or-more
488 (any "0-9a-z" "!#$%&*+,./:;=?@\\_~-" word))
489 "("
490 (one-or-more
491 (any "0-9a-z" "!#$%&*+,./:;=?@\\_~-" word))
492 (zero-or-more
493 (any "0-9a-z" "#$%&*+/=@\\_~-" word))
494 ")"
495 (opt
496 (one-or-more
497 (any "0-9a-z" "!#$%&*+,./:;=?@\\_~-" word))
498 (any "0-9a-z" "#$%&*+/=@\\_~-" word)))
499 (seq
500 (one-or-more
501 (any "0-9a-z" "!#$%&*+,./:;=?@\\_~-" word))
502 (any "0-9a-z" "#$%&*+/=@\\_~-" word)))))))
503
504(defun acdw/add-button-url-regexp-protocol (proto)
505 "Add PROTO to `browse-url-button-regexp'
506First, add PROTO to `acdw/button-protocols'.
507Then, build `browse-url-button-regexp' with the new protocol."
508 (add-to-list 'acdw/button-protocols proto)
509 (setq-default browse-url-button-regexp (acdw/build-button-url-regexp)))
510
511;;; Browse-URL tweaks
512
513;; convert twitter.com to nitter
514(defun acdw/eww-browse-twitter-url (url &rest args)
515 "Browse a Twitter.com URL using Nitter."
516 (let* ((nitter "nitter.snopyta.org")
517 (url (replace-regexp-in-string "twitter\\.com" nitter url)))
518 (eww-browse-url url args)))
519
520
521;;; Recentf renaming with dired 448;;; Recentf renaming with dired
522;; from ... somewhere. 'rjs', apparently? 449;; from ... somewhere. 'rjs', apparently?
523;; I'm throwing these here because they look better here than in init.el. 450;; I'm throwing these here because they look better here than in init.el.