Frage

I have an alias alias lpr2='lpr -o sides=one-sided -o number-up=2' defined in .bashrc for easy printing. I can use it in the (emacs) shell, but when I use M-! on a pdf file in dired-mode and type in lpr2, I receive /bin/bash: lpr2: command not found. How can aliases be made available in dired-mode on M-!?

War es hilfreich?

Lösung

You cannot use aliases in M-!. However, you can define the variable lpr-switches so you can use all the Emacs' printing commands with requested behaviour.

Andere Tipps

Alternately, you can explicitly invoke bash in its interactive mode, which reads ~/.bashrc and makes aliases available. Use this as your shell command:

bash -ic 'lpr2 "$@"' -- *

You'll get some harmless warnings (at least I do), but it will work.

I assume you probably meant ! (dired-do-shell-command) rather than M-! (shell-command), which is not related to dired mode.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top