Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keywords with hyphens get squeezed #184

Closed
psmith1303 opened this issue Oct 30, 2023 · 4 comments
Closed

Keywords with hyphens get squeezed #184

psmith1303 opened this issue Oct 30, 2023 · 4 comments

Comments

@psmith1303
Copy link

The manual says, "Keywords should not have spaces or other delimiters. If they do, they are converted into hyphens."

Super, that's perfect for me. I like keywords such as "strategy-as-practice".

I'm using Denote 2.0.0, and whenever I use such a keyword, it gets 'squeezed' to "strategyaspractice".

Alas, my ability in elisp isn't up to debugging this problem ... and hints or suggestions would be appreciated.

protesilaos added a commit that referenced this issue Oct 31, 2023
In short, you have to follow some convention that control the letter
casing of individual words to make them readable, while keeping them
part of the same keyword. Using the new user option we provide:

    (setq denote-file-name-letter-casing
          '((title . downcase)
            (signature . downcase)
            (keywords . verbatim) ; notice the `verbatim' here
            (t . downcase)))

With this in place, typing something like 'camelCase' at the keywords
prompt will insert that as-is and treat as a single keyword.

I am clarifying the documentation here as part of the process of
introducing the new 'denote-file-name-letter-casing' option. I do it
in response to the question raised by Peter Smith in issue 184 on the
GitHub mirror: <#184>.
@protesilaos
Copy link
Owner

Hello @psmith1303! We used to provide an option called denote-allow-multi-word-keywords. I removed it recently because hyphens in keywords would not always work (e.g. Org does not accept them). I have since introduced a new option, which is still part of the current development target, called denote-file-name-letter-casing.

To achieve what you want, you have to (i) use the new user option (ii) set it up so that it accepts your input for keywords verbatim, and (iii) rely on a letter casing convention to separate the constituent words of a keyword, like HelloWorld. The minimum change you need, using Denote version 2.1.0-dev:

(setq denote-file-name-letter-casing
      '((title . downcase)
        (signature . downcase)
        (keywords . verbatim) ; notice the `verbatim' here
        (t . downcase)))

@psmith1303
Copy link
Author

Thanks Prot. I'll do that then.

@protesilaos
Copy link
Owner

protesilaos commented Nov 1, 2023 via email

@mentalisttraceur
Copy link

Here's a few lisp lines I've been using for several months now to make hyphens work in keywords again:

    (defun fixed-denote-sluggify-keyword (keyword)
        (denote-sluggify keyword 'keywords))

    (defun fixed-denote-sluggify-keywords (keywords)
        (mapcar 'fixed-denote-sluggify-keyword keywords))

    (advice-add 'denote-sluggify-keywords
        :override 'fixed-denote-sluggify-keywords)

If Org mode can't handle dashes in Denote keywords, that sounds like Org's problem. I don't use Org mode and I refuse to let its limitations be my problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants