weechat.el
weechat.el copied to clipboard
Emacs 27: rx-form does not exist anymore preventing weechat to start
Failure on https://github.com/the-kenny/weechat.el/blob/master/weechat-color.el#L82
This is because the rx library in emacs-27 was rewritten and rx-form does not exist anymore.
So rx--translate-form can be substituted for rx-form, but.... rx--string-to-intervals then complains about (seq "b" (in "FDB_-#il"):
Debugger entered--Lisp error: (error "Invalid rx ‘any’ range: ")
signal(error ("Invalid rx ‘any’ range: "))
error("Invalid rx `any' range: %s" "")
rx--string-to-intervals("FDB_-#il")
mapcan(rx--string-to-intervals ("FDB_-#il"))
rx--parse-any(("FDB_-#il"))
rx--translate-any(nil ("FDB_-#il"))
rx--translate-form((in "FDB_-#il"))
rx--translate((in "FDB_-#il"))
mapcar(rx--translate ("b" (in "FDB_-#il")))
rx--translate-seq(("b" (in "FDB_-#il")))
rx--translate-form((seq "b" (in "FDB_-#il")))
rx--translate((seq "b" (in "FDB_-#il")))
#f(compiled-function (item) #<bytecode 0x15848d85dfed>)((seq "b" (in "FDB_-#il")))
mapcan(#f(compiled-function (item) #<bytecode 0x15848d85dfed>) ((seq "@" (= 5 digit)) (seq "F" (or (= 2 digit) (seq (in "*!/_|\1\2\3\4") (= 2 digit)) (seq "@" (= 5 digit)) (seq "@" (in "*!/_|\1\2\3\4") (= 5 digit)))) (seq "B" (or (= 2 digit) (seq "@" (= 5 digit)))) (seq "*" (or (= 2 digit) (seq (in "*!/_|\1\2\3\4") (= 2 digit)) (seq "@" (= 5 digit)) (seq "@" (in "*!/_|\1\2\3\4") (= 5 digit)) (seq (or (= 2 digit) (seq (in "*!/_|\1\2\3\4") (= 2 digit)) (seq "@" (= 5 digit)) (seq "@" (in "*!/_|\1\2\3\4") (= 5 digit))) "," (or (= 2 digit) (seq (in "*!/_|\1\2\3\4") (= 2 digit)) (seq "@" (= 5 digit)) (seq "@" (in "*!/_|\1\2\3\4") (= 5 digit)))))) (seq "b" (in "FDB_-#il")) "\34"))
rx--translate-or(((= 2 digit) (seq "@" (= 5 digit)) (seq "F" (or (= 2 digit) (seq (in "*!/_|\1\2\3\4") (= 2 digit)) (seq "@" (= 5 digit)) (seq "@" (in "*!/_|\1\2\3\4") (= 5 digit)))) (seq "B" (or (= 2 digit) (seq "@" (= 5 digit)))) (seq "*" (or (= 2 digit) (seq (in "*!/_|\1\2\3\4") (= 2 digit)) (seq "@" (= 5 digit)) (seq "@" (in "*!/_|\1\2\3\4") (= 5 digit)) (seq (or (= 2 digit) (seq (in "*!/_|\1\2\3\4") (= 2 digit)) (seq "@" (= 5 digit)) (seq "@" (in "*!/_|\1\2\3\4") (= 5 digit))) "," (or (= 2 digit) (seq (in "*!/_|\1\2\3\4") (= 2 digit)) (seq "@" (= 5 digit)) (seq "@" (in "*!/_|\1\2\3\4") (= 5 digit)))))) (seq "b" (in "FDB_-#il")) "\34"))
rx--translate-form((or (= 2 digit) (seq "@" (= 5 digit)) (seq "F" (or (= 2 digit) (seq (in "*!/_|\1\2\3\4") (= 2 digit)) (seq "@" (= 5 digit)) (seq "@" (in "*!/_|\1\2\3\4") (= 5 digit)))) (seq "B" (or (= 2 digit) (seq "@" (= 5 digit)))) (seq "*" (or (= 2 digit) (seq (in "*!/_|\1\2\3\4") (= 2 digit)) (seq "@" (= 5 digit)) (seq "@" (in "*!/_|\1\2\3\4") (= 5 digit)) (seq (or (= 2 digit) (seq (in "*!/_|\1\2\3\4") (= 2 digit)) (seq "@" (= 5 digit)) (seq "@" (in "*!/_|\1\2\3\4") (= 5 digit))) "," (or (= 2 digit) (seq (in "*!/_|\1\2\3\4") (= 2 digit)) (seq "@" (= 5 digit)) (seq "@" (in "*!/_|\1\2\3\4") (= 5 digit)))))) (seq "b" (in "FDB_-#il")) "\34"))
rx--translate((or (= 2 digit) (seq "@" (= 5 digit)) (seq "F" (or (= 2 digit) (seq (in "*!/_|\1\2\3\4") (= 2 digit)) (seq "@" (= 5 digit)) (seq "@" (in "*!/_|\1\2\3\4") (= 5 digit)))) (seq "B" (or (= 2 digit) (seq "@" (= 5 digit)))) (seq "*" (or (= 2 digit) (seq (in "*!/_|\1\2\3\4") (= 2 digit)) (seq "@" (= 5 digit)) (seq "@" (in "*!/_|\1\2\3\4") (= 5 digit)) (seq (or (= 2 digit) (seq (in "*!/_|\1\2\3\4") (= 2 digit)) (seq "@" (= 5 digit)) (seq "@" (in "*!/_|\1\2\3\4") (= 5 digit))) "," (or (= 2 digit) (seq (in "*!/_|\1\2\3\4") (= 2 digit)) (seq "@" (= 5 digit)) (seq "@" (in "*!/_|\1\2\3\4") (= 5 digit)))))) (seq "b" (in "FDB_-#il")) "\34"))
mapcar(rx--translate ("\31" (or (= 2 digit) (seq "@" (= 5 digit)) (seq "F" (or (= 2 digit) (seq (in "*!/_|\1\2\3\4") (= 2 digit)) (seq "@" (= 5 digit)) (seq "@" (in "*!/_|\1\2\3\4") (= 5 digit)))) (seq "B" (or (= 2 digit) (seq "@" (= 5 digit)))) (seq "*" (or (= 2 digit) (seq (in "*!/_|\1\2\3\4") (= 2 digit)) (seq "@" (= 5 digit)) (seq "@" (in "*!/_|\1\2\3\4") (= 5 digit)) (seq (or (= 2 digit) (seq ... ...) (seq "@" ...) (seq "@" ... ...)) "," (or (= 2 digit) (seq ... ...) (seq "@" ...) (seq "@" ... ...))))) (seq "b" (in "FDB_-#il")) "\34")))
rx--translate-seq(("\31" (or (= 2 digit) (seq "@" (= 5 digit)) (seq "F" (or (= 2 digit) (seq (in "*!/_|\1\2\3\4") (= 2 digit)) (seq "@" (= 5 digit)) (seq "@" (in "*!/_|\1\2\3\4") (= 5 digit)))) (seq "B" (or (= 2 digit) (seq "@" (= 5 digit)))) (seq "*" (or (= 2 digit) (seq (in "*!/_|\1\2\3\4") (= 2 digit)) (seq "@" (= 5 digit)) (seq "@" (in "*!/_|\1\2\3\4") (= 5 digit)) (seq (or (= 2 digit) (seq ... ...) (seq "@" ...) (seq "@" ... ...)) "," (or (= 2 digit) (seq ... ...) (seq "@" ...) (seq "@" ... ...))))) (seq "b" (in "FDB_-#il")) "\34")))
rx--translate-form((seq "\31" (or (= 2 digit) (seq "@" (= 5 digit)) (seq "F" (or (= 2 digit) (seq (in "*!/_|\1\2\3\4") (= 2 digit)) (seq "@" (= 5 digit)) (seq "@" (in "*!/_|\1\2\3\4") (= 5 digit)))) (seq "B" (or (= 2 digit) (seq "@" (= 5 digit)))) (seq "*" (or (= 2 digit) (seq (in "*!/_|\1\2\3\4") (= 2 digit)) (seq "@" (= 5 digit)) (seq "@" (in "*!/_|\1\2\3\4") (= 5 digit)) (seq (or (= 2 digit) (seq ... ...) (seq "@" ...) (seq "@" ... ...)) "," (or (= 2 digit) (seq ... ...) (seq "@" ...) (seq "@" ... ...))))) (seq "b" (in "FDB_-#il")) "\34")))
rx--translate((seq "\31" (or (= 2 digit) (seq "@" (= 5 digit)) (seq "F" (or (= 2 digit) (seq (in "*!/_|\1\2\3\4") (= 2 digit)) (seq "@" (= 5 digit)) (seq "@" (in "*!/_|\1\2\3\4") (= 5 digit)))) (seq "B" (or (= 2 digit) (seq "@" (= 5 digit)))) (seq "*" (or (= 2 digit) (seq (in "*!/_|\1\2\3\4") (= 2 digit)) (seq "@" (= 5 digit)) (seq "@" (in "*!/_|\1\2\3\4") (= 5 digit)) (seq (or (= 2 digit) (seq ... ...) (seq "@" ...) (seq "@" ... ...)) "," (or (= 2 digit) (seq ... ...) (seq "@" ...) (seq "@" ... ...))))) (seq "b" (in "FDB_-#il")) "\34")))
rx--translate-or(((seq "\31" (or (= 2 digit) (seq "@" (= 5 digit)) (seq "F" (or (= 2 digit) (seq (in "*!/_|\1\2\3\4") (= 2 digit)) (seq "@" (= 5 digit)) (seq "@" (in "*!/_|\1\2\3\4") (= 5 digit)))) (seq "B" (or (= 2 digit) (seq "@" (= 5 digit)))) (seq "*" (or (= 2 digit) (seq (in "*!/_|\1\2\3\4") (= 2 digit)) (seq "@" (= 5 digit)) (seq "@" (in "*!/_|\1\2\3\4") (= 5 digit)) (seq (or ... ... ... ...) "," (or ... ... ... ...)))) (seq "b" (in "FDB_-#il")) "\34")) (seq "\32" (in "*!/_|\1\2\3\4")) (seq "\33" (in "*!/_|\1\2\3\4")) "\34"))
rx--translate-form((or (seq "\31" (or (= 2 digit) (seq "@" (= 5 digit)) (seq "F" (or (= 2 digit) (seq (in "*!/_|\1\2\3\4") (= 2 digit)) (seq "@" (= 5 digit)) (seq "@" (in "*!/_|\1\2\3\4") (= 5 digit)))) (seq "B" (or (= 2 digit) (seq "@" (= 5 digit)))) (seq "*" (or (= 2 digit) (seq (in "*!/_|\1\2\3\4") (= 2 digit)) (seq "@" (= 5 digit)) (seq "@" (in "*!/_|\1\2\3\4") (= 5 digit)) (seq (or ... ... ... ...) "," (or ... ... ... ...)))) (seq "b" (in "FDB_-#il")) "\34")) (seq "\32" (in "*!/_|\1\2\3\4")) (seq "\33" (in "*!/_|\1\2\3\4")) "\34"))
byte-code("\301\302!\210\301\303!\210\301\304!\210\305\306\307\310\311\312\313\314\315\316&\11\210\317\320\321\322\315\306%\210\317\323\324\325\315\306%\210\317\326\327\330\315\306%\210\317..." [emacs-major-version require weechat-core rx s custom-declare-group weechat-faces nil "WeeChat Faces and Color settings" :link (url-link "https://github.com/the-kenny/weechat.el") :prefix "weechat-" :group weechat custom-declare-face weechat-nick-self-face ((t :weight bold :foreground "brown")) "Face for your own nick." weechat-time-face ((t :inherit default)) "Weechat face used for timestamps." weechat-prompt-face ((t :inherit minibuffer-prompt)) "Weechat face used for the prompt." weechat-highlight-face ((((class grayscale) (background light)) :foreground "LightGray" :weight bold) (((class grayscale) (background dark)) :foreground "DimGray" :weight bold) (((class color) (min-colors 88) (background light)) :foreground "Purple") (((class color) (min-colors 88) (background dark)) :foreground "Cyan1") (((class color) (min-colors 16) (background light)) :foreground "Purple") (((class color) (min-colors 16) (background dark)) :foreground "Cyan") (((class color) (min-colors 8)) :foreground "cyan" :weight bold) (t :weight bold)) "Weechat face for highlighted lines." weechat-error-face ((t :inherit error)) "Weechat face used to display errors." custom-declare-variable weechat-strip-formatting funcall function #f(compiled-function () #<bytecode 0x15848e837ad1>) "Remove every kind of formatting or color from mess..." :type boolean 27 (lambda (def-tmp-var) (defvar weechat-formatting-regex def-tmp-var)) (in "*!/_|\1\2\3\4") (= 2 digit) seq ((= 2 digit)) (seq "@" (= 5 digit)) "@" ((= 5 digit)) rx--translate-form or ...] 30)
require(weechat-color)
byte-code("\300\301!\210\300\302!\210\300\303!\210\300\304!\210\300\305!\210\300\306!\210\307\310\311\312\313DD\314\315\316\317\320&\7\210\307\321\311\312\322DD\323\315\316\317..." [require weechat-core weechat-relay weechat-color cl-lib format-spec s custom-declare-variable weechat-host-default funcall function #f(compiled-function () #<bytecode 0x15848e84fa65>) "Default host for `weechat-connect'." :type string :group weechat weechat-port-default #f(compiled-function () #<bytecode 0x15848e84fa75>) "Default port for `weechat-connect'." weechat-mode-default #f(compiled-function () #<bytecode 0x15848e84fa85>) "Wether to connect via SSL by default.\n\nNull or 'pl..." (choice (const :tag "Plain" 'plain) (const :tag "SSL/TLS" 'ssl) (string :tag "Command to run")) weechat-modules #f(compiled-function () #<bytecode 0x15848e84fa95>) "Modules loaded when weechat.el is loaded.\n\nEach mo..." (repeat symbol) weechat-read-only #f(compiled-function () #<bytecode 0x15848e84faa5>) "Whether to make text in weechat buffers read-only." boolean weechat-initial-lines #f(compiled-function () #<bytecode 0x15848e84fab5>) "Number of lines to show when initializing a channe..." integer weechat-more-lines-amount #f(compiled-function () #<bytecode 0x15848e84fac5>) "Number of extra lines `weechat-get-more-lines' wil..." weechat-prompt #f(compiled-function () #<bytecode 0x15848e84fad5>) "The Weechat prompt." weechat-buffer-line-limit #f(compiled-function () #<bytecode 0x15848e84fae5>) "Number of max. lines per buffer." (choice integer (const :tag "Unlimited" nil)) weechat-return-always-replace-input #f(compiled-function () #<bytecode 0x15848e84faf5>) "Always replace current input with line on return.\n..." weechat-auto-move-cursor-to-prompt ...] 10)
require(weechat nil t)
(not (require 'weechat nil t))
(if (not (require 'weechat nil t)) (display-warning 'use-package (format "Cannot load %s" 'weechat) :error) (condition-case err (progn (load-library "weechat-tracking") (load-library "weechat-latex") (load-library "weechat-image") (load-library "weechat-sauron") (load-library "weechat-spelling") (defalias 'weechat-get-even-more-lines #'(lambda nil (interactive) (weechat-get-more-lines 'nil 500))) (define-key weechat-mode-map (kbd "C-c G") 'weechat-get-even-more-lines) t) ((debug error) (funcall use-package--warning61 :config err))))
(condition-case err (if (not (require 'weechat nil t)) (display-warning 'use-package (format "Cannot load %s" 'weechat) :error) (condition-case err (progn (load-library "weechat-tracking") (load-library "weechat-latex") (load-library "weechat-image") (load-library "weechat-sauron") (load-library "weechat-spelling") (defalias 'weechat-get-even-more-lines #'(lambda nil (interactive) (weechat-get-more-lines ... 500))) (define-key weechat-mode-map (kbd "C-c G") 'weechat-get-even-more-lines) t) ((debug error) (funcall use-package--warning61 :config err)))) ((debug error) (funcall use-package--warning61 :catch err)))
Additional: I'm not sure what (seq "b" (in "FDB_-#il")) actually does, but changing rx-form to rx--translate-form and commenting out (seq "b" (in "FDB_-#il")) seems to enable weechat to work in Emacs 27. I haven't noticed any oddity with colours thus far, and so seems to be a functional workaround for now.
Update: this workaround fails to work with mentions.
Did you ever come up with a solution that works with mentions too?
I haven't. And even on Emacs 26.3, there's still some weirdness.
Really the rx bits of Weechat need rewriting. (And I don't understand enough about either the old or new rx of Emacs to do this. I'm hoping the package maintainer has a solution in the works.)
Any progress on this?
Various forks. Try http://github.com/bqv/weechat.el (rx-range branch) - its ok for me
For those who (also) struggle with this: you can take the corrected defvar statement from the pull request and put it into your .emacs file before weechat is loaded to get it working again.
Ensure that you also copy the non-printable characters (copy&paste from the source view here in github might not work for you)!
(or you just wait for the pull request to be merged).
That's how I started, but forking was tidier, especially with there being multiple issues now and kenny not maintaining this
So
rx--translate-formcan be substituted forrx-form, but....rx--string-to-intervalsthen complains about(seq "b" (in "FDB_-#il"):
Please don't: when an upgrade breaks something, please start by reporting it as a bug.
Also using identifiers with -- in their name means you're relying on code we explicitly want to be able to change at will, so better not do that.
BTW, I think instead of rx-form you want to use rx-to-string.
It's still not solved as for today. I tried circe and it worked right away.
It's still not solved as for today. I tried
circeand it worked right away.
are you using circe with a weechat backend? I'd love to find some fairly drop-in solution for weechat.