[Vuejs]-How to overwrite Emacs package settings (script) via global settings (without editing package script)

3đź‘Ť

âś…

The code in question appears to be:

(defcustom vue-modes
  '((:type template :name nil :mode vue-html-mode)
    (:type template :name html :mode vue-html-mode)
    (:type template :name jade :mode jade-mode)
    (:type template :name pug :mode pug-mode)
    [...])
  "A list of vue component languages [...]"
  [...]
  :group 'vue)

(defcustom vue-modes tells you that the variable vue-modes is a user option, and that you can therefore customize it:

M-x customize-option RET vue-modes RET

You can also get there via the “customize” link at C-hv vue-modes RET

Make the desired change in the customize buffer, and use the “Apply and Save” button to save the changes to your init file (or your C-hv custom-file RET if that has been set).


You’ll also see a link in the customize buffer to edit all the user options for the vue group (note the :group 'vue in the code). You could go directly to that with:

M-x customize-group RET vue RET

A large number of Emacs libraries have a customize group like this, and you can typically guess/autocomplete your way to that without even looking at the code.


I found a way that is to rewrite … to … on .emacs.d/elpa/vue-mode-xxxxxxxx.xx/vue-mode.elc (not on vue-mode.el file)

As you’ve realised, you probably shouldn’t be editing those — but editing the byte-compiled .elc files is definitely not recommended.

By default, Emacs prefers byte-compiled files (because they’re more efficient), but that’s predicated on an assumption that the byte-compiled .elc files will be kept up-to-date with their .el source.

Use M-x customize-option RET load-prefer-newer RET to enable that option, after which if you make any changes to an .el file, Emacs will prefer that over its associated byte-compiled-but-now-outdated .elc file (if any). See also C-hig (emacs)Lisp Libraries RET

You can also recompile a modified .el file with M-x byte-compile-file RET /path/to/file.el RET (amongst other methods), so that your changes to the .el file are propagated to the compiled .elc file.

👤phils

Leave a comment