Define a shell function that uses the first argument to man
as a parameter
macsman() {
emacsclient -c -e "(man \"$1\")"
}
alias man=macsman
You could invoke the function without the alias (e.g. macman ls
), but it may be useful to set the alias for specific shells.
One note: You may want to assure your Man page is visible in the Emacs session as soon as it is invoked. Check the settings of the Man-notify-method
variable to achieve that. Either set it using customize-variable
, or set it explicitly as part of the function, i.e.
emacsclient -c -e "(let ((Man-notify-method 'bully)) (man \"$1\"))"
(Hat tip to @phils)