chiark / gitweb /
Files found on jura.
[ian-dotfiles.git] / files / emacs_dired-alternate.el
1 ; dired-alternate.el
2 ; (C)1991 Ian Jackson
3 ; This file is placed under the protection of the GNU General Public Licence.
4 ;
5 ; Patch to make "F" in dired-mode replace the current (dired) buffer with
6 ; a buffer visiting the file the cursor is on.
7 ;
8 ; Also new dired-run-file function.
9
10 (defun dired-find-alternate-file ()
11   "Like dired-find-file and find-alternate-file put together"
12   (interactive)
13   (find-alternate-file (dired-get-filename)))
14
15 (defun dired-run-file ()
16   "Runs the file pointed to in dired - output if any is put in the *Shell Command Output* buffer"
17   (interactive)
18   (let ((file (dired-get-filename))
19         (shelco (get-buffer-create "*Shell Command Output*"))
20         (oldbuf (current-buffer)))
21     (message "Running %s..." file)
22     (set-buffer shelco)
23     (erase-buffer)
24     (set-buffer-modified-p nil)
25     (call-process file nil shelco nil)
26     (if (buffer-modified-p)
27         (display-buffer shelco))
28     (message "Running %s...done" file)
29     (set-buffer oldbuf)
30     (revert-buffer)))