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

option to use lowercase language name in gfm blocks #71

Closed
blaenk opened this issue Jan 11, 2016 · 5 comments
Closed

option to use lowercase language name in gfm blocks #71

blaenk opened this issue Jan 11, 2016 · 5 comments

Comments

@blaenk
Copy link

blaenk commented Jan 11, 2016

First of all, woah!! Thanks a lot @cosmicexplorer for your great work on #54!

It looks and seems to work beautifully! I had been following what seemed to me like a convention which was to use the lowercase representation of language names. The implementation of #54 seems to use the capitalized language, e.g. JavaScript or Python versus javascript or python. I know it's such a minor gripe! But I was wondering if you could possibly add an option to perhaps (downcase chosen-candidate) before inserting it?

I already have many codeblocks that use the lowercase names (which I really prefer) and everyone else I've seen does the same thing, so I'm not too eager to break with that convention and have mixed styles.

@blaenk
Copy link
Author

blaenk commented Jan 11, 2016

I just saw #59 but I admit I'm not sure I understand it. I noticed of course that I could "add" my own language, so for example if I type python and create a new one, it will indeed enter python, but now I'll have python and Python even though I only intend to have one. I think an option like I'm saying would be nice because users who want this wouldn't have to create "alternate" versions of each language they use and get a lot of leftover capitalized languages in the completing-read list.

To be clear, I of course don't mind (and in fact appreciate) the fact that the names are capitalized in the completing-read list, what I'm saying is that I would prefer it if the chosen language was inserted as a lower-case version of it.

cosmicexplorer pushed a commit to cosmicexplorer/markdown-mode that referenced this issue Jan 11, 2016
@cosmicexplorer
Copy link
Contributor

I agree that the lowercased version is more common; I think this is what @jrblevin was hinting at in his earlier issue on this topic.

#73 adds a defcustom markdown-gfm-downcase-languages, which adds the behavior you describe and defaults to t. The weird thing I've noticed is that using helm, even with completion-ignore-case off, completing-read will return "" if the entered pattern is a downcased version of a completion airbender, which shouldn't happen. I believe this is a bug in helm's completing-read, since completing-read-default seems to work just fine; I will investigate this.

Essentially, it now defaults to using the lowercased version of a language for all of the "preloaded" languages. If it parses a buffer upon opening and finds languages that are not preloaded (this includes alternative capitalizations), it adds those as candidates. This means that within a file, if that file uses the uppercased versions of "Ruby" or "Python", for example, those will be included as completions, but only within that buffer. Otherwise, the lowercased versions of all languages will be preferred for completion of a partial input. I've added this behavior to the test case for this feature.

@blaenk
Copy link
Author

blaenk commented Jan 11, 2016

Amazing! I really appreciate it, thank you!

@cosmicexplorer
Copy link
Contributor

emacs-helm/helm#1331 I've made an issue on helm, so that's definitely a helm thing. Should be fine for everyone else.

@jrblevin
Copy link
Owner

Good idea. I also use lowercase names (in my workflows they usually translate to class names for XHTML elements), so I appreciate having this flexibility.

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