Add `shell-command` keybinding from emacs

Open
#2,229 3 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
55/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Quiet
Tech stack
shell

Research direction

Start by reading the issue’s example using lem:define-command, lem-process:run-process, and lem:define-key, then inspect the existing run-shell behavior and lem-shell-mode:*default-shell-command* mentioned in the report. The report describes the desired M-! command, but does not identify implementation files or tests; determine where command and process behavior are defined before estimating the change. Done means M-! prompts for a command and displays its output without the reported TTY errors.

Written by the indexing model from the issue text.

Description

I find myself missing the M-! binding from emacs to run a shell command. A minimal implementation of this in lem would look like this.


(lem:define-command shell-command (cmd) ((:string "Command to run: "))
    (lem-process:run-process
        (uiop:split-string cmd)
           :output-callback (lambda (str) 
                              (lem:message str))))                                        

(lem:define-key lem:*global-keymap* "M-!" 'shell-command) 

I've tried using run-shell, but that doesn't seem to work

0: *shell pid:81579* 
warning: No TTY for interactive shell (tcgetpgrp failed)
setpgid: Inappropriate ioctl for device
 

I also setting lem-shell-mode:*default-shell-command*, to no avail.

Dominant language
Common Lisp
Stars
3.1k
Forks
261
Avg merge
1d 6h
Merged PRs (30d)
133

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from lem-project/lem

All issues in lem-project/lem

Similar issues

More CLI issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.