Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9046535
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T11:40:47+00:00 2026-06-16T11:40:47+00:00

I have an executable file that can be used from the terminal command line.

  • 0

I have an executable file that can be used from the terminal command line.

$ foo "bar"
which returns a single line of text

I would like to be able to call this function while editing files.

I can see that I can do the following

M-! ~/Library/yolo/bin/foo "bar"
and I get exactly what I am looking for.

So I am trying to write a function that I can then bind to keys. But I am stumped.

(setq foobar-path "~/Library/yolo/bin/foo ")
(defun foo-bar (func)
  (shell-command (concat foobar-path func)))

(global-set-key (kbd "M-p") foo-bar)

but I know (emacs is telling me) that I am way way off.

What I would ideally end up with is a keybinding that can send a line of code (like evaluate last expression) to the external function and display the return at the bottom of the screen in the message bar.

Any hints?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T11:40:48+00:00Added an answer on June 16, 2026 at 11:40 am

    Your code has two issues:

    • You need to quote the symbol you pass to global-set-key.
    • The function has to be a “command”. This is any emacs function marked as interactively callable by containing a top-level interactive form.

    In particular, if you want to pass in the func argument from the minibuffer, you could do this:

    (setq foobar-path "~/Library/yolo/bin/foo ")
    (defun foo-bar (func)
      (interactive "sEnter func: ")
      (shell-command (concat foobar-path func)))
    
    (global-set-key (kbd "M-p") 'foo-bar)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a command line exe that takes input from a text file and
I have a Mojolicious Lite script that gives out an executable file (user can
I need to have an executable file (.exe) which takes some parameters from a
I have an executable jar Client.jar that requires jndi.properties file. Since the jndi properties
I have to generate an executable (.exe) file from my python program. I would
I have the problem running executable .jar file. I've created a project which contains
I have a CMakeLists.txt file that looks like this: add_executable(exec1 exec1.c source1.c source2.c source3.c)
I have a executable jar file and i want to see code behind it.
I have running process but it's executable file has got deleted. If I try
I have created a directory structure with an executable file. Following is the output

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.