Emacs, Markdown-mode, insert spaces in text links created by the C-c C-l command
The reference environment: Emacs, Markdown-mode, insert a link
This article applies to the following environment:
- Emacs: GNU Emacs 26.3 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.30) of 2019–12–03
- Markdown Mode: markdown-mode-20200622.20
- OS: Linux Ubuntu 20.4 LTS, Linux Fedora 32
The problem in a few words: You need to insert a link in a document written using Markdown-mode for Emacs and in the Link text you need to insert one or more spaces.
The following are the steps:
- Activate the command
- Insert the URL of a link and press
- Insert text link with some spaces inside it … STOP!
You could notice that the minibuffer does not accept the spaces! You also get a “ No match “ advice.
Is there a bug? Have I made an error?
None of them.
It is a deliberate behavior of the plugin.
I recently opened a New Issue in jrblevin/markdown-mode and the solution was immediate.
The official assistance service solution
If you need to insert spaces in you Link text in Markdown-mode you can use
C-q followed by
C-q runs the command quoted-insert (found in global-map), which is an interactive compiled Lisp function.
It reads the next input character and inserts it where you are typing.
If the next input character is a space it inserts a space in the minibuffer and you’ve solved the problem.
If you want to use just the
space key in your keyboard you can set minibuffer-local-completion-map configuration in your .emacs file as below:
(defun my/markdown-mode-hook ()
(define-key minibuffer-local-completion-map (kbd "SPC") 'self-insert-command))
Now you can directly digit text links with spaces inside the minibuffer.
Thank you to the jrblevin/markdown-mode Team for the solution.
Thank you for your attention.
Originally published at https://francopasut.github.io on July 5, 2020.