开发者

emacs: Force parsing of local variables of a buffer

I have an Emacs-lisp script that creates two buffers with some content, asking the user the name of the buffer. The text of the file is inserted in the newly created buffer by the name given by the user. Here is the code snippet:

(with-current-buffer (find-file-noselect
                        (read-file-name "C++ example file name: "))
    (erase-buffer)
    (save-excursion (insert "file-contents")))

The question is. Once the text in file-contents is inserted, it may contain local variables specified such as:

// -*- mode: c++; c-basic-offset: 4; -*-

However, these variables are not processed for the buffer. I was wondering if there is some lisp function to force the local variables to be recognized (parsed and applied) for the b开发者_C百科uffer once it has the correct contents.


(normal-mode t) sets the mode for the current buffer, as if it had just been visited.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜