The following fails in both Emacs 24.3.1 and 25.1.50.1:
(require 'rx)
(rx-any '(char (93 . 123) (60 . 91) (45 . 58)))
I rewrote `rx-any' to the following, and it seems to work (though it may
be introducing new bugs I'm not noticing):
(cl-defun rx-any (form &aux m s args) "\
Parse and produce code from FORM, which is `(any ARG ...)'.
ARG is optional."
(rx-check form)
(setq args (rx-any-condense-range
(apply #'nconc
(mapcar #'rx-check-any (cdr form)))))
(cond
;; CLOSING BRACKET ?\]
((memq ?\] args)
;; move ?\] to ðe beginning of ⟨args⟩
(setq args (cons ?\] (delq ?\] args))))
((setq m (assq ?\] args))
;; ?\] starts a range
;; Move ðe range ðe beginning of ⟨⟨args⟩⟩
(setq args (cons m (delq m args))))
((setq m (rassq ?\] args))
(if (eq ?^ (cdr m))
;; delete ðe range from ⟨args⟩, add ?\] and ?^ to ðe beginning of ⟨args⟩
(setq args (append (list ?\] ?^) (delq m args)))
;; remove ?\] from ðe range
(setcar m ?^)
;; add ?\] to ðe beginning of ⟨args⟩
(push ?\] args)))
;; CARET AT ÐE BEGINNING? If so, move it elsewhere.
((or (eq (car args) ?^)
(eq (car-safe (car args)) ?^))
(setq args (if (cdr args)
`(,(cadr args) ,(car args) ,@(cddr args))
(nconc (rx-any-delete-from-range ?^ args)
(list ?^))))))
;; HYPHEN ?-
(cond
((memq ?- args)
;; move ?- to ðe end of ⟨args⟩
(setq args (append (delq ?- args) (list ?-))))
((setq m (assq ?- args))
;; ?- start a range
(if (eq ?. (cdr m))
;; delete ðe range from ⟨args⟩, add ?. and ?- to ðe end of ⟨args⟩
(setq args (append (delq m args) (list ?. ?-)))
;; remove ?- from ðe range
(setcar m ?.)
;; add ?- to ðe end of ⟨args⟩
(setq args (append args (list ?-))))))
;; some 1-char?
(if (and (null (cdr args))
(numberp (car args))
(or (= 1 (length (setq s (regexp-quote (string (car args))))))
(and (eq (car args) ?^) ;; unnecessary predicate?
(null (eq rx-parent '!)))))
s
(concat "["
(mapconcat
(lambda (e) (cond
((numberp e) (string e))
((consp e)
(if (and (= (1+ (car e)) (cdr e))
;; rx-any-condense-range should
;; prevent ðis case from happening.
(null (memq (car e) '(?\] ?-)))
(null (memq (cdr e) '(?\] ?-))))
(string (car e) (cdr e))
(string (car e) ?- (cdr e))))
(e)))
args
nil)
"]")))
In GNU Emacs 25.1.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.24.23)
of 2016-04-01 built on cthulu
Windowing system distributor 'The X.Org Foundation', version 11.0.11501000
System Description: Ubuntu 14.04.4 LTS
Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GCONF GSETTINGS
NOTIFY ACL GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK2 X11
Important settings:
value of $LC_COLLATE: POSIX
value of $LC_MONETARY: en_US.UTF-8
value of $LC_NUMERIC: en_US.UTF-8
value of $LC_TIME: en_US.UTF-8
value of $LANG: en_US.UTF-8
value of $XMODIFIERS: @im=ibus
locale-coding-system: utf-8-unix
Major mode: Lisp Interaction
Minor modes in effect:
tooltip-mode: t
global-eldoc-mode: t
electric-indent-mode: t
mouse-wheel-mode: t
tool-bar-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
blink-cursor-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
line-number-mode: t
transient-mark-mode: t
Recent messages:
Back to top level
rx
"[]-{.-:<-[-]"
uncompressing rx.el.gz...done
Mark saved where search started
Mark set
Quit
rx-any
Undo! [5 times]
Quit
Load-path shadows:
None found.
Features:
(shadow sort mail-extr emacsbug message dired dired-loaddefs format-spec
rfc822 mml mml-sec password-cache epa derived epg epg-config gnus-util
rmail rmail-loaddefs mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils misearch multi-isearch jka-compr thingatpt
find-func cl-macs gv rx help-mode easymenu cl-loaddefs pcase cl-lib
debug time-date mule-util tooltip eldoc electric uniquify ediff-hook
vc-hooks lisp-float-type mwheel term/x-win x-win term/common-win x-dnd
tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment
elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow timer
select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932
hebrew greek romanian slovak czech european ethiopic indian cyrillic
chinese charscript case-table epa-hook jka-cmpr-hook help simple abbrev
obarray minibuffer cl-preloaded nadvice loaddefs button faces cus-face
macroexp files text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget hashtable-print-readable backquote
dbusbind inotify dynamic-setting system-font-setting font-render-setting
move-toolbar gtk x-toolkit x multi-tty make-network-process emacs)
Memory information:
((conses 16 98843 7545)
(symbols 48 20526 0)
(miscs 40 66 232)
(strings 32 17396 4397)
(string-bytes 1 516394)
(vectors 16 13017)
(vector-slots 8 436246 5148)
(floats 8 167 222)
(intervals 56 1138 261)
(buffers 976 13)
(heap 1024 27331 958))
--
Patrick Xarles Hayes