Mercurial > emacs
comparison lisp/simple.el @ 4374:1a64d641cea4
(shell-command-history): New variable.
(shell-command, shell-command-on-region): Use it.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sat, 31 Jul 1993 06:10:44 +0000 |
parents | 4d0c57f01eed |
children | 7101a887f80d |
comparison
equal
deleted
inserted
replaced
4373:02a515f35abc | 4374:1a64d641cea4 |
---|---|
631 (setq pending-undo-list (primitive-undo count pending-undo-list))) | 631 (setq pending-undo-list (primitive-undo count pending-undo-list))) |
632 | 632 |
633 (defvar last-shell-command "") | 633 (defvar last-shell-command "") |
634 (defvar last-shell-command-on-region "") | 634 (defvar last-shell-command-on-region "") |
635 | 635 |
636 (defvar shell-command-history nil | |
637 "History list for some commands that read shell commands.") | |
638 | |
636 (defun shell-command (command &optional flag) | 639 (defun shell-command (command &optional flag) |
637 "Execute string COMMAND in inferior shell; display output, if any. | 640 "Execute string COMMAND in inferior shell; display output, if any. |
638 If COMMAND ends in ampersand, execute it asynchronously. | 641 If COMMAND ends in ampersand, execute it asynchronously. |
639 | 642 |
640 Optional second arg non-nil (prefix arg, if interactive) | 643 Optional second arg non-nil (prefix arg, if interactive) |
641 means insert output in current buffer after point (leave mark after it). | 644 means insert output in current buffer after point (leave mark after it). |
642 This cannot be done asynchronously." | 645 This cannot be done asynchronously." |
643 (interactive (list (read-string "Shell command: " last-shell-command) | 646 (interactive (list (read-string "Shell command: " last-shell-command) |
644 current-prefix-arg)) | 647 current-prefix-arg nil nil 'shell-command-history)) |
645 (if flag | 648 (if flag |
646 (progn (barf-if-buffer-read-only) | 649 (progn (barf-if-buffer-read-only) |
647 (push-mark) | 650 (push-mark) |
648 ;; We do not use -f for csh; we will not support broken use of | 651 ;; We do not use -f for csh; we will not support broken use of |
649 ;; .cshrcs. Even the BSD csh manual says to use | 652 ;; .cshrcs. Even the BSD csh manual says to use |
734 even though that buffer is not automatically displayed. If there is no output | 737 even though that buffer is not automatically displayed. If there is no output |
735 or output is inserted in the current buffer then `*Shell Command Output*' is | 738 or output is inserted in the current buffer then `*Shell Command Output*' is |
736 deleted." | 739 deleted." |
737 (interactive (list (region-beginning) (region-end) | 740 (interactive (list (region-beginning) (region-end) |
738 (read-string "Shell command on region: " | 741 (read-string "Shell command on region: " |
739 last-shell-command-on-region) | 742 last-shell-command-on-region |
743 nil nil 'shell-command-history) | |
740 current-prefix-arg | 744 current-prefix-arg |
741 (prefix-numeric-value current-prefix-arg))) | 745 (prefix-numeric-value current-prefix-arg))) |
742 (if flag | 746 (if flag |
743 ;; Replace specified region with output from command. | 747 ;; Replace specified region with output from command. |
744 (let ((swap (and interactive (< (point) (mark))))) | 748 (let ((swap (and interactive (< (point) (mark))))) |