ziglang / zig-mode

Zig mode for Emacs
GNU General Public License v3.0
163 stars 54 forks source link

rx form `regexp' requires args satisfying `stringp' #42

Closed dm182 closed 3 years ago

dm182 commented 3 years ago

M-x zig-mode won't switch to zig-mode, it returns error instead: "rx form 'regexp' requires args satisfying `stringp'" emacs-version: 24.5.1, package: 20201013.1249

joachimschmidt557 commented 3 years ago

I created the PR which switched to the rx macros. I'll look into fixing this.

joachimschmidt557 commented 3 years ago

This bug report changed the way regexp works: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=36237

If we want to continue to support emacs 24, I think these are some options:

dm182 commented 3 years ago

Same error appears in emacs 25, it's 4 years old, though.

travv0 commented 3 years ago

I'm getting this error on 26.3.

larme commented 3 years ago

besides regexp, you also cannot use literal because I believe it's first implemented in emacs 27

larme commented 3 years ago

an ugly way to handle regexp is like this:

(defmacro zig-init1 ()                                                                               
  `(defconst zig-re-type                                                                             
     (rx (* (| "?" "[_]" "*" "[]"))                                                                  
         (regexp ,zig-re-identifier))))                                                              

(zig-init1)                                                                                          

(defmacro zig-init2 ()                                                                               
  `(progn                                                                                            
     (defconst zig-re-type-annotation                                                                
       (rx (group (regexp ,zig-re-identifier))                                                       
           (* (any space)) ":" (* (any space))                                                       
           (group (regexp ,zig-re-type))))))                                                         

(zig-init2)