Coder Social home page Coder Social logo

Comments (4)

protesilaos avatar protesilaos commented on July 28, 2024

Hello @hpgisler!

Coincidentally, we are having a discussion about the same topic on the mailing list: https://lists.sr.ht/~protesilaos/denote/%3C2273b3b1-344c-6c6e-3ab6-a227b6bc3721%40eh-is.de%3E

Copying the relevant part of what I wrote:

We basically need to tweak the 'denote-faces--file-name-regexp', specifically groups 4 and 6. Though I am not sure exactly which character class we should include.

Read the Elisp manual by evaluating:

(info "(elisp) Char Classes")

My guess is either [:alpha:] or a combination of [:ascii:] and [:nonascii:] plus the numbers.

Do you think that is the right approach or we should simplify it as you suggest? Also, we technically downcase the title so the current regexp is not correct anyway.

from denote.

protesilaos avatar protesilaos commented on July 28, 2024

This works for me:

(defvar denote-faces--file-name-regexp
  (concat "\\(?1:[0-9]\\{8\\}\\)\\(?2:T[0-9]\\{6\\}\\)"
          "\\(?:\\(?3:--\\)\\(?4:[[:alnum:]-]*\\)\\)?"
          "\\(?:\\(?5:__\\)\\(?6:[[:alnum:]_-]*\\)\\)?"
          "\\(?7:\\..*\\)?$")
  "Regexp of file names for fontification.")

(defconst denote-faces-file-name-keywords
  `((,(concat " " denote-faces--file-name-regexp)
     (1 'denote-faces-date)
     (2 'denote-faces-time)
     (3 'denote-faces-delimiter nil t)
     (4 'denote-faces-title nil t)
     (5 'denote-faces-delimiter nil t)
     (6 'denote-faces-keywords nil t)
     (7 'denote-faces-extension nil t )))
  "Keywords for fontification of file names.")

Kill the dired buffer and open it again.

from denote.

hpgisler avatar hpgisler commented on July 28, 2024

Yes, your solution works; thank you.

I've tried the following, which also seems to work;
however, your's more readable, I think
and perhaps it is better to not 'open up' the number of
allowed characters to much...

(defvar denote-faces--file-name-regexp
  (concat "\\(?1:[0-9]\\{8\\}\\)\\(?2:T[0-9]\\{6\\}\\)"
          "\\(?:\\(?3:--\\)\\(?4:[^_]*\\)\\)?"
          "\\(?:\\(?5:__\\)\\(?6:[^.]*\\)\\)?"
          "\\(?7:\\..*\\)?$")
  "Regexp of file names for fontification.")

from denote.

protesilaos avatar protesilaos commented on July 28, 2024

Thank you for the feedback! Based on it, I pushed my change. Also tweaked some other variables to make them compatible with this.

I will prepare a new release in the coming days. Maybe tomorrow or the day after, depending on how things go.

Closing this issue now.

from denote.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.