wyuenho / emacs-pet

Tracks down the correct Python tooling executables from your virtualenvs so you can glue the binaries to Emacs and delete code in init.el
GNU General Public License v3.0
105 stars 13 forks source link

Usage of string-match-p #13

Closed twmr closed 1 year ago

twmr commented 1 year ago

In https://github.com/wyuenho/emacs-pet/blob/main/pet.el#L221 you're using string-match-p for the config file extensions. This doesn't work for me, because string-match-p returns 0 in my case. I would simply use

(or (equal "yaml" ext) 
     (equal "yml" ext)
     (eq 'yaml-mode mode))

or maybe you have a better idea.

(string-match-p "ya?ml" "yaml")
0

(string-match-p "ya?ml" "yml")
0
wyuenho commented 1 year ago

Why doesn't it work for you?

twmr commented 1 year ago

Good question.

What does it return for you?

(string-match-p "ya?ml" "yaml")
(string-match-p "ya?ml" "yml")

BTW I'm on emacs-29

wyuenho commented 1 year ago

0, which is truthy in elisp.

twmr commented 1 year ago

Ok, maybe there was a misunderstanding then. I always thought that sth is fishy because yaml-p is 0.

twmr commented 1 year ago

Thx for the tip about 0 being t in elisp! This ticket can be closed.