Created
December 8, 2012 22:01
-
-
Save hsaito/4242168 to your computer and use it in GitHub Desktop.
Create random buffers
This file contains 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
;; Create Random Buffer | |
;; by Hideki Saito (hidekis@gmail.com) | |
;; | |
;; Summary: Creates an empty buffer with random numbered name. | |
;; | |
;; Background: | |
;; Just wanted to make extra "scratch" buffer. | |
;; | |
;; Limitations: | |
;; Does not handle buffer name collision. | |
;; | |
;; Requires: | |
;; Emacs 24.1 or later | |
;; | |
;; Install: | |
;; Add the following to .emacs | |
;; (require 'create-random-buffer) | |
;; | |
(provide 'create-random-buffer) | |
(defun create-random-buffer () | |
"Creates an empty buffer with random name." | |
(interactive) | |
(switch-to-buffer (concat "*temp-" (concat (sha1 (number-to-string (random))) "*"))) | |
) | |
(setq random-tempfile-default-directory "~/") | |
(defun create-random-tempfile () | |
"Creates temporary txt file of random name." | |
(interactive) | |
(find-file (concat random-tempfile-default-directory (concat "temp-" (sha1 (number-to-string(random))) ".txt"))) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment