1

I like to have my auto-mode-alist for *.el files set up to open them in a custom major-mode that is buffer-read-only. When installing certain packages through the choices available when typing M-x list-packages, the package process creates an ...autoloads.el file. Adding information to that ...autoloads.el file during the package building process fails because the buffer is read only.

Essentially, I'd like the auto-mode-alist to temporarily be set to nil so that the process of creating the ...autoloads.el file is working in a fundamental-mode buffer instead of my custom major-mode.

Some suggestions on how to handle this issue would be greatly appreciated.

1
  • Why don't you add a second entry to auto-mode-alist for these autoload files ?
    – politza
    Feb 3, 2015 at 21:04

1 Answer 1

1

Try this:

(with-eval-after-load 'package
  (defadvice package-generate-autoloads
    (around disable-custom-major-mode activate preactivate compile)
    (let ((auto-mode-alist nil))
      ad-do-it)))

I haven't tested if it works, but I'm pretty sure it does what you ask.

1
  • Yes, that does indeed do the job -- thank you very much!
    – lawlist
    Feb 3, 2015 at 20:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.