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
121 stars 15 forks source link

Usage of string-match-p #13

Closed twmr closed 2 years ago

twmr commented 2 years 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 2 years ago

Why doesn't it work for you?

twmr commented 2 years 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 2 years ago

0, which is truthy in elisp.

twmr commented 2 years ago

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

twmr commented 2 years ago

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