summary refs log tree commit diff stats
path: root/lisp/acdw.el
diff options
context:
space:
mode:
authorCase Duckworth2021-05-25 17:35:40 -0500
committerCase Duckworth2021-05-25 17:35:40 -0500
commitbba5214c34a3e0531ba59193e9cf3ab98cdc71ad (patch)
tree45ecee55a097640cc956844d42d933f64bd14bb6 /lisp/acdw.el
parentAdd moar channels (diff)
downloademacs-bba5214c34a3e0531ba59193e9cf3ab98cdc71ad.tar.gz
emacs-bba5214c34a3e0531ba59193e9cf3ab98cdc71ad.zip
Fix `acdw/build-button-url-regexp' to rebuild on call
`rx' builds the regexp at compile time -- I need it to be built at runtime.
`rx-to-string' takes care of that for me.
Diffstat (limited to 'lisp/acdw.el')
-rw-r--r--lisp/acdw.el63
1 files changed, 31 insertions, 32 deletions
diff --git a/lisp/acdw.el b/lisp/acdw.el index d806138..d043aad 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el
@@ -433,47 +433,46 @@ Prompt only if there are unsaved changes."
433I used `xr' (not included in Emacs) to get the RX form of the 433I used `xr' (not included in Emacs) to get the RX form of the
434default, so I can easily splice the list into it. THIS IS 434default, so I can easily splice the list into it. THIS IS
435BRITTLE AF!!!" 435BRITTLE AF!!!"
436 (rx 436 (rx-to-string ; thanks wgreenhouse!
437 (seq word-boundary 437 `(seq word-boundary
438 (group
439 (group 438 (group
440 (or "www." 439 (group
441 (seq 440 (or "www."
442 (group 441 (seq
443 (eval (cons 'or acdw/button-protocols))) 442 (group (or ,@acdw/button-protocols))
444 ":"))) 443 ":")))
445 (opt 444 (opt
446 (group "//" 445 (group "//"
447 (one-or-more 446 (one-or-more
448 (any "0-9a-z" "._-")) 447 (any "0-9a-z" "._-"))
449 ":" 448 ":"
450 (zero-or-more 449 (zero-or-more
451 (any "0-9")))) 450 (any "0-9"))))
452 (or 451 (or
453 (seq 452 (seq
454 (one-or-more
455 (any "0-9a-z" "!#$%&*+,./:;=?@\\_~-" word))
456 "("
457 (one-or-more
458 (any "0-9a-z" "!#$%&*+,./:;=?@\\_~-" word))
459 (zero-or-more
460 (any "0-9a-z" "#$%&*+/=@\\_~-" word))
461 ")"
462 (opt
463 (one-or-more 453 (one-or-more
464 (any "0-9a-z" "!#$%&*+,./:;=?@\\_~-" word)) 454 (any "0-9a-z" "!#$%&*+,./:;=?@\\_~-" word))
465 (any "0-9a-z" "#$%&*+/=@\\_~-" word))) 455 "("
466 (seq 456 (one-or-more
467 (one-or-more 457 (any "0-9a-z" "!#$%&*+,./:;=?@\\_~-" word))
468 (any "0-9a-z" "!#$%&*+,./:;=?@\\_~-" word)) 458 (zero-or-more
469 (any "0-9a-z" "#$%&*+/=@\\_~-" word))))))) 459 (any "0-9a-z" "#$%&*+/=@\\_~-" word))
460 ")"
461 (opt
462 (one-or-more
463 (any "0-9a-z" "!#$%&*+,./:;=?@\\_~-" word))
464 (any "0-9a-z" "#$%&*+/=@\\_~-" word)))
465 (seq
466 (one-or-more
467 (any "0-9a-z" "!#$%&*+,./:;=?@\\_~-" word))
468 (any "0-9a-z" "#$%&*+/=@\\_~-" word)))))))
470 469
471(defun acdw/add-button-url-regexp-protocol (proto) 470(defun acdw/add-button-url-regexp-protocol (proto)
472 "Add PROTO to `browse-url-button-regexp' 471 "Add PROTO to `browse-url-button-regexp'
473First, add PROTO to `acdw/button-protocols'. 472First, add PROTO to `acdw/button-protocols'.
474Then, build `browse-url-button-regexp' with the new protocol." 473Then, build `browse-url-button-regexp' with the new protocol."
475 (add-to-list 'acdw/button-protocols proto) 474 (add-to-list 'acdw/button-protocols proto)
476 (setq browse-url-button-regexp (acdw/build-button-url-regexp))) 475 (setq-default browse-url-button-regexp (acdw/build-button-url-regexp)))
477 476
478 477
479 478