help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: want a file format easily edited and read by emacs that allows (mult


From: Emanuel Berg
Subject: Re: want a file format easily edited and read by emacs that allows (multiple) pictures to be included
Date: Wed, 06 Dec 2017 06:55:11 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

YT wrote:

> tomás wrote:
>
>> Because it makes life easier for me.
>> An example: if I want to show to someone
>> what "df -h" does on my box, I just open an
>> org mode buffer and do: This is the output
>> of =df= on my box #+BEGIN_SRC sh :results
>> raw drawer df -h #+END_SRC
>
> Or:
>
>     C-u M-! df -h RET

Yet another way. I didn't bother with the fancy
interactive interface of `shell-command'.
But you could hook it to the output buffer,
then yank that, and kill it, if anyone cannot
live without autocompletion and won't have
code duplication.

    (defun insert-command-and-output (cmd)
      (interactive "sshell command: ")
      (when cmd
        (insert (format "$ %s\n\n" cmd))
        (shell-command cmd t)
        (goto-char (mark)) ))
    (defalias 'icao 'insert-command-and-output)

$ df -h

Filesystem      Size  Used Avail Use% Mounted on
/dev/root        15G   12G  1.5G  89% /
devtmpfs        458M     0  458M   0% /dev
tmpfs           462M     0  462M   0% /dev/shm
tmpfs           462M  6.8M  455M   2% /run
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           462M     0  462M   0% /sys/fs/cgroup
/dev/mmcblk0p1   60M   22M   39M  37% /boot
tmpfs            93M     0   93M   0% /run/user/1001
/dev/sda2        25G   24G  1.1G  96% /mnt-disk

-- 
underground experts united
http://user.it.uu.se/~embe8573


reply via email to

[Prev in Thread] Current Thread [Next in Thread]