开发者

How can I compile an Emacs elisp extension (nXhtml)?

开发者 https://www.devze.com 2023-02-13 12:44 出处:网络
I\'m new to Emacs and recently I inst开发者_开发技巧alled nXhtml extension. How can I compile the extension?Assumption: You have installed xhtml from the bazaar repository on launchpadwith bzr branch

I'm new to Emacs and recently I inst开发者_开发技巧alled nXhtml extension. How can I compile the extension?


Assumption: You have installed xhtml from the bazaar repository on launchpad with bzr branch lp:nxhtml.

Now the answer: the README.txt file just told us

Note 3: You may optionally also byte compile nXhtml from the nXhtml
    menu (recommended).

Add (load "~/.emacs.d/nxhtml/autostart.el") to your .emacs, then M-x eval-buffer, activate the mode and as soon as you have a nXhtml entry in your menu, just browse nXhtml → nXhtml Help and Setup → Byte compile nXhtml.

Et voilà !


Normally, you do not have to compile emacs extensions. You usually include something like

(load "YOUR-PATH-TO/nxhtml/autostart")

into your .emacs.

However, if you really want to compile your file, you can do this using the function byte-compile-file (via M-x byte-compile-file).


Speaking generally, for extensions like nxhtml which have many .el files and perhaps sub-directories, you would normally want to use byte-recompile-directory:

byte-recompile-directory is an interactive compiled Lisp function in `bytecomp.el'.

(byte-recompile-directory BYTECOMP-DIRECTORY &optional BYTECOMP-ARG BYTECOMP-FORCE)

Recompile every .el' file in BYTECOMP-DIRECTORY that needs recompilation. This happens when a.elc' file exists but is older than the `.el' file. Files in subdirectories of BYTECOMP-DIRECTORY are processed also.

If the .elc' file does not exist, normally this function *does not* compile the corresponding.el' file. However, if the prefix argument BYTECOMP-ARG is 0, that means do compile all those files. A nonzero BYTECOMP-ARG means ask the user, for each such `.el' file, whether to compile it. A nonzero BYTECOMP-ARG also means ask about each subdirectory before scanning it.

If the third argument BYTECOMP-FORCE is non-nil, recompile every .el' file that already has a.elc' file.

  • so to update any existing but out-of-date .elc files:
    M-x byte-recompile-directory RET (path to nxhtml) RET
  • and to re/compile all .el files without asking for confirmation:
    M-0M-x byte-recompile-directory RET (path to nxhtml) RET

To read about prefix arguments:
M-: (info "(emacs) Arguments") RET)

You may also like to look into using the likes of ELPA (not applicable in this instance) or el-get (which is) to install and maintain packages, as they take care of all the compilation and autoloads.

0

精彩评论

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

关注公众号