Created
August 12, 2021 14:06
-
-
Save briang/439908f66fd0387fc86ebbfa0763ce6b to your computer and use it in GitHub Desktop.
run-perl-on-current-buffer-file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define-derived-mode run-mode | |
special-mode "Run" | |
"help!!!" | |
:init-value nil) | |
(defun run-perl-on-current-buffer-file () | |
(interactive) | |
(save-buffer) | |
(setq filename (buffer-file-name (current-buffer))) | |
(delete-other-windows) | |
(split-window-below) | |
(other-window 1) | |
(switch-to-buffer (get-buffer-create "*perl*")) | |
(setq buffer-read-only nil) | |
(erase-buffer) | |
; insert date+time | |
(insert (shell-command-to-string (concat "head" " " filename))) | |
; insert date+time+elapsed | |
(setq buffer-read-only t) | |
(run-mode)) | |
(global-set-key (kbd "<f12>") 'run-perl-on-current-buffer-file) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment