How to enter a space in the minibuffer instead of completing a word?

elisp, emacs

Solution

In the mini-buffer, `space` is bound to a completion command. If you want to enter an actual ' ', you need to quote it: `C-q <space>`. This comes up a lot for me, so I've bound `M-<space>` to enter a literal space in the minibuffer:

EDIT: following phils comment, the following code snippet is really pointless. You can get the desired behaviour with `M-space` without any keybindings.

(define-key minibuffer-local-completion-map "\M- " 
    (lambda () (interactive) (insert " "))) 

Problem

I would like to print from `dired-mode` by using `P`. This works fine for the default print command I have set up via `lpr-switches`, but I often want to edit the command. For example, if `P` suggests `lpr`, I would like to add `-o number-up=2`. The problem is that this contains a space after `-o` and hitting the space bar gives me `No match`. How can one adjust the `lpr` (or other commands facing the same problem)?

Original source