From bba5214c34a3e0531ba59193e9cf3ab98cdc71ad Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Tue, 25 May 2021 17:35:40 -0500 Subject: 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. --- lisp/acdw.el | 63 ++++++++++++++++++++++++++++++------------------------------ 1 file changed, 31 insertions(+), 32 deletions(-) (limited to 'lisp') 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." I used `xr' (not included in Emacs) to get the RX form of the default, so I can easily splice the list into it. THIS IS BRITTLE AF!!!" - (rx - (seq word-boundary - (group + (rx-to-string ; thanks wgreenhouse! + `(seq word-boundary (group - (or "www." - (seq - (group - (eval (cons 'or acdw/button-protocols))) - ":"))) - (opt - (group "//" - (one-or-more - (any "0-9a-z" "._-")) - ":" - (zero-or-more - (any "0-9")))) - (or - (seq - (one-or-more - (any "0-9a-z" "!#$%&*+,./:;=?@\\_~-" word)) - "(" - (one-or-more - (any "0-9a-z" "!#$%&*+,./:;=?@\\_~-" word)) - (zero-or-more - (any "0-9a-z" "#$%&*+/=@\\_~-" word)) - ")" - (opt + (group + (or "www." + (seq + (group (or ,@acdw/button-protocols)) + ":"))) + (opt + (group "//" + (one-or-more + (any "0-9a-z" "._-")) + ":" + (zero-or-more + (any "0-9")))) + (or + (seq (one-or-more (any "0-9a-z" "!#$%&*+,./:;=?@\\_~-" word)) - (any "0-9a-z" "#$%&*+/=@\\_~-" word))) - (seq - (one-or-more - (any "0-9a-z" "!#$%&*+,./:;=?@\\_~-" word)) - (any "0-9a-z" "#$%&*+/=@\\_~-" word))))))) + "(" + (one-or-more + (any "0-9a-z" "!#$%&*+,./:;=?@\\_~-" word)) + (zero-or-more + (any "0-9a-z" "#$%&*+/=@\\_~-" word)) + ")" + (opt + (one-or-more + (any "0-9a-z" "!#$%&*+,./:;=?@\\_~-" word)) + (any "0-9a-z" "#$%&*+/=@\\_~-" word))) + (seq + (one-or-more + (any "0-9a-z" "!#$%&*+,./:;=?@\\_~-" word)) + (any "0-9a-z" "#$%&*+/=@\\_~-" word))))))) (defun acdw/add-button-url-regexp-protocol (proto) "Add PROTO to `browse-url-button-regexp' First, add PROTO to `acdw/button-protocols'. Then, build `browse-url-button-regexp' with the new protocol." (add-to-list 'acdw/button-protocols proto) - (setq browse-url-button-regexp (acdw/build-button-url-regexp))) + (setq-default browse-url-button-regexp (acdw/build-button-url-regexp))) -- cgit 1.4.1-21-gabe81