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

markdown-insert-gfm-code-block default language #152

Closed
conal opened this issue Jul 15, 2016 · 2 comments
Closed

markdown-insert-gfm-code-block default language #152

conal opened this issue Jul 15, 2016 · 2 comments
Labels

Comments

@conal
Copy link

conal commented Jul 15, 2016

In markdown-insert-gfm-code-block (C-c C-s P), I'm offered a what looks like a default (e.g., "haskell"), but when I press enter, I don't get a language for the fenced code region. Intended behavior? I can fix the code easily enough to use (car markdown-gfm-used-languages) as the default in completing-read, instead of adding to the prompt string, i.e., change

                (completing-read
                 (format "Programming language [%s]: "
                         (or (car markdown-gfm-used-languages) "none"))
                 (markdown-gfm-get-corpus)
                 nil 'confirm (car markdown-gfm-used-languages)
                 'markdown-gfm-language-history)

to

                (completing-read
                 "Programming language: "
                 (markdown-gfm-get-corpus)
                 nil 'confirm (car markdown-gfm-used-languages)
                 'markdown-gfm-language-history)

I like this behavior, but I'm unsure it's the behavior you want. If it is, I'll submit a pull request.

@conal
Copy link
Author

conal commented Jul 15, 2016

Oops. Now I see that the language offered is the most recently added language, not most recently chosen language. A simple fix in markdown-gfm-add-used-language is to replace

  (add-to-list 'markdown-gfm-used-languages
               (markdown-clean-language-string lang))

by

  (setq markdown-gfm-used-languages
        (cons lang (remove lang markdown-gfm-used-languages)))

@jrblevin
Copy link
Owner

Thanks for reporting and fixing this! Sorry it took me so long to take a closer look. I didn't want to trouble you for a PR this long after the fact, so I applied the patch by hand as 7d8f78b. It seems fine to me, but let me know if you see any issues.

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

No branches or pull requests

2 participants