Emacs lisp “shell-command-on-region”

后端 未结 3 1726
孤独总比滥情好
孤独总比滥情好 2021-02-04 01:25

In GNU Emacs, I want to run a program, figlet, on the currently selected text. I then want to comment the region which is produced.

I have figured out how to do it using

3条回答
  •  暖寄归人
    2021-02-04 02:08

    I'm unsure what you're trying to accomplish with the pushing and popping of the marks, I believe you'd get the same functionality by doing this:

    (defun figlet-region (&optional b e) 
      (interactive "r")
      (shell-command-on-region b e "figlet")
      (comment-region b e))
    

    The argument to interactive tells Emacs to pass the region (point and mark) in as the first two arguments to the command.

提交回复
热议问题