Is there a way to pass non-numeric argument to functions?
Ex: C-u 5 M-x eshell makes(switches to) a eshell with name *eshell*<5>. But I want to give a name instead of number to eshell buffer.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I don’t think there is any general way to pass non-numeric arguments to any command the same way
C-uworks.However, different modes can get input using the minibuffer. For example,
C-u M-x shell(rather thaneshell) lets you name your new shell buffer.You can easily write your own
eshellcommand that also lets you name the buffer:Then bind it to some key:
Now when you type
C-c e, you will be prompted for a buffer name and a neweshellbuffer with that name will be created for you.Edit: Simplified the code as @sanityinc helpfully pointed out.