Вопрос

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-!?

Это было полезно?

Решение

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.

Другие советы

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.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top