Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defvar-local is-new-file-buffer nil)
- (defun save-new-file-before-kill ()
- (when (and (not (buffer-file-name))
- is-new-file-buffer
- (yes-or-no-p
- "New file has not been saved. Would you like to save before closing?"))
- (call-interactively 'save-buffer)))
- (add-hook 'kill-buffer-hook 'save-new-file-before-kill)
- (defun new-file (dir)
- (interactive "DCreate New File In: ")
- (let ((buffer (generate-new-buffer "<Unsaved File>")))
- (switch-to-buffer buffer)
- (setq-local default-directory dir)
- (setq-local is-new-file-buffer t)))
- (globoal-set-key [(f12)] 'new-file)
- Warning (initialization): An error occurred while loading `/home/christoph/.emacs':
- Symbol's function definition is void: globoal-set-key
- To ensure normal operation, you should investigate and remove the
- cause of the error in your initialization file. Start Emacs with
- the `--debug-init' option to view a complete error backtrace.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement