help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Set major mode for all visited files by extension


From: Stefan Monnier
Subject: Re: Set major mode for all visited files by extension
Date: Tue, 05 May 2020 13:49:38 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

>> (defun reload-buffer ()
>>    "Reload the current buffer"
>>    (interactive)
>>    (let ((curfile (buffer-file-name)))
>>      (kill-this-buffer)
>> (find-file curfile)))
>
> The built-in (revert-buffer), which I have bound to C-<f5>, works for
> me in similar cases (but I don’t use session.el, just desktop.el).

BTW, if you only want to (re)set the major mode but not reload the buffer's
contents, then `normal-mode` is the function you likely want to call.


        Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]