Skip to content

Instantly share code, notes, and snippets.

@dbrady
Created September 9, 2011 17:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dbrady/1206823 to your computer and use it in GitHub Desktop.
Save dbrady/1206823 to your computer and use it in GitHub Desktop.
reload-buffer
; ----------------------------------------------------------------------
; reload-buffer
; Seriously, why doesn't this already exist? Reloads the current
; buffer. find-alternate-file will sort of already do this; if you do
; not supply an argument to it it will reload the current
; buffer... but it will switch you to another buffer when it does
; it. All this function does is find-alt and then switch you back.
(defun reload-buffer()
(interactive)
(let ((buffername (buffer-name)))
(find-alternate-file buffername)
(switch-to-buffer buffername)))
; override the binding for find-alternate-file to be reload-buffer,
; since that's what I always use it for.
(global-set-key (kbd "\C-x C-v") 'reload-buffer)
@darrylhebbes
Copy link

And M-x eval-buffer won't work in this instance?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment