Code Monkey home page Code Monkey logo

emacs-run-command's Introduction

MELPA

M-x run-command

Emacs, the text editor that lets you read mail and play Tetris, is often cast in opposition to the Unix philosophy of "do one thing well" and "combine small programs". It's a false dichotomy. Emacs can do a lot on its own and can be combined usefully with other programs.

run‑command makes the combination convenient through a simple configuration format and an interaction flow that stays out of your way. Instead of reaching for a shell or a specialized major mode, you give run‑command a simple "recipe" and you get a contextual command palette where you can browse, select, and run commands without leaving Emacs.

For demo, quickstart, and advanced configuration, see the documentation website.

emacs-run-command's People

Contributors

bard avatar jdormit avatar ktfleming avatar leungbk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

emacs-run-command's Issues

Allow editing command in Ivy

When using run-command with Helm, one can press C-u before selecting a command and edit it. Provide the same functionality when running in Ivy.

Getting error when trying to run example recipe

This is an exciting project, and one I know I will find useful for a number of different projects, so thanks for writing it!

I'm trying to set this up in Doom Emacs (with Selectrum), but I'm getting an error when trying out the simple example recipes.

When I try to run a command with the config below, both commands are displayed correctly in the minibuffer, but when I select either, I get the error 'Symbol's value as variable is void: command-name'. I do have sloccount installed and it works fine run manually, but the echo command example doesn't work either.

I suspect that the way I have added the examples to the run-command-recipes variable is wrong, but I'm a bit of a newbie with elisp and suspect that I somehow haven't quoted it properly (quoting still baffles me!).

Here's my configuration:

(defun run-command-recipe-example ()
  (list
   (list :command-name "say-hello"
         :command-line "echo Hello, World!")
   (when-let ((buffer-file (buffer-file-name)))
     (list :display "Count lines of code"
           :command-name "count-lines-of-code"
           :command-line (format "sloccount '%s'" buffer-file)))))

(use-package! run-command
  :config
  (setq run-command-recipes '(run-command-recipe-example))
  :bind ("C-c c" . run-command))

Any help you can give me would be much appreciated!

Feedback for “Quickstart”

in the manual it says

To activate the recipe, execute M-x customize RET run-command-recipes RET and add run-command-recipe-example to the list.

What is the command to do this non-interactively?

feature request: running elisp functions instead of shell ones?

Nice project!

I wonder if a feature could be added so that run-command execute elisp functions instead of shell ones?

It would help me avoid making regular elisp commands (along with a "package" prefix for them, which pollutes the global namespace) just for some specific projects.

Furthermore, this feature would let run-command execute elisp functions instead of just limited to executing shell commands.

vterm-runner has an error when trying to reuse a buffer

The first time I run a command with run-command-runner-vterm, it works fine. But if I try running the same command again, nothing happens other than I get an error:

You cannot change major mode in vterm buffers

This seems to be because the vterm runner executes the command by setting vterm-shell and then calling vterm-mode:

(vterm-shell (format "%s -c '%s'" vterm-shell command-line)))
(vterm-mode))))

But when the buffer is already using vterm-mode (as happens when re-running a command), it runs into this guard in vterm's code that prevents changing the major mode (even "changing" it from vterm-mode to vterm-mode):

https://github.com/akermu/emacs-libvterm/blob/990cc18decb489c54d16d03fd8acbfe268b98a9c/vterm.el#L757-L762

I haven't yet been able to think of a way around this other than locally disabling the "reuse buffer" feature and having it always generate a new buffer (which I believe was the behavior in older versions of run-command). Locally removing that guard in vterm's code and then re-running a command results in a different error: vterm-mode: Buffer is read-only. I suppose something, not sure what, in the code that runs when activating vterm-mode breaks when run in a read-only buffer. If I manually turn off read-only-mode in the command buffer and re-run the command again, the command re-uses the buffer as expected.

Unfortunately vterm doesn't seem to offer anything like term-exec, and the approach of setting vterm-shell is the only way I've found of having vterm run an arbitrary command.

FR: detached.el package integration

Thanks for sharing this package.
I'd like to run some commands and compilations and them to survive an Emacs close or crash. This can accomplished with detached.el, which is an Emacs integration for crigler/dtach.

Having the corresponding run-command-runner-*-detached variants would be great for integrating both packages.

uniform buffer name

I use popper: https://github.com/karthink/popper which lets you toggle windows of "temporary" buffers

Can you make the names of the term buffers uniform so I can add that regex to my popper list? Like eglot for example: "^\\*EGLOT" - anything that starts with *EGLOT

Use "term" run method by default

A fully functioning term environment is an expectation of many commands. Once the term run method is sufficiently tested, it should become the default.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.