this post was submitted on 12 Nov 2023
2 points (100.0% liked)

Emacs

305 readers
1 users here now

A community for the timeless and infinitely powerful editor. Want to see what Emacs is capable of?!

Get Emacs

Rules

  1. Posts should be emacs related
  2. Be kind please
  3. Yes, we already know: Google results for "emacs" and "vi" link to each other. We good.

Emacs Resources

Emacs Tutorials

Useful Emacs configuration files and distributions

Quick pain-saver tip

founded 1 year ago
MODERATORS
 

I have this type of code in my init.el each loads the features in a directly and it turns out that because the file names contained the - character they were not being loaded, as the regex checks for only alphanumeric filenames which are not hidden.

(let ((default-directory (expand-file-name "wsi/lisp" user-emacs-directory)))
  (normal-top-level-add-to-load-path (directory-files default-directory nil "[^\\.][a-z0-9]*")))

By the way I copied this from someone's init.el and I've suffered from it for ages, an object lesson on how one should not copy init.el files and other Emacs lisp code without fully understanding the code in them.

I'm not sure but it looks like the regex will not even match file names with capitals in them.

I guess the question I want to ask is how to add arbitrary non-alphabetical characters to a regex matching alphanumeric characters, with the proviso that they are acceptable in file names..

you are viewing a single comment's thread
view the rest of the comments
[–] trollhard9000@alien.top 1 points 10 months ago

The second bracket part of your regex just needs some additions: [a-zA-Z0-9-._] Basically add any additional characters at the end after the ranges.