Emacs, Markdown-mode, insert spaces in text links created by the C-c C-l command - My Notebook Home

 
How to insert text links in Emacs Markdown-mode (C-c C-l) with spaces inside them

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:

  1. Activate the command C-c C-l
  2. Insert the URL of a link and press Return
  3. 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 space.

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 my GitHub account

Comments

Popular posts from this blog

Vim: searching for text containing a slash or a question mark

Vim: Cut, Copy and Paste to and from the system clipboard