Background: my company provides (confidential) elisp libraries for editing source code in several languages, including TypeScript. I added some lines to load these libraries to my init.el:

(require 'REDACTED)
(require 'REDACTED-typescript)

This worked as expected: when I find a .ts file the company-specific TypeScript mode is enabled and works as expected.

I later encountered a problem, however: when I quit Emacs and then restarted it, desktop would attempt to re-find files I was previously visiting; if any of them were .ts then it would fail to restore my previous frame arrangement and would instead emit the following error messages in Messages:

File mode specification error: (error Don’t know how to make a localized variable an alias)
byte-code: Don’t know how to make a localized variable an alias

It tried starting Emacs with -debug-init, but this did not cause a debugger to open when this happened.

After much futile deletion of content from init.el and removal of potentially conflicting elpa packages I eventually noticed that there were multiple (desktop-create-buffer …) entries in my .emacs.desktop file, and was able to rectify the immediate problem by killing emacs, deleting my .emacs-desktop file, and re-creating my frame and buffer layout. For now emacs seems to be happy to save and restore my desktop even if I have TypeScript buffers open. Win.

But I am at a loss as to how to debug the underlying issue.

  • What does "Don’t know how to make a localized variable an alias" mean?

  • If it reoccurs (which seems likely), how can I find out what is causing it, when it does not appear to trigger the debugger despite, apparently, causing desktop-read to abort?

  • 1
    This was an error emitted by defvaralias up to at least Emacs 28.2. It has been somewhat rephrased in recent upstream Emacs to Don't know how to make a buffer-local variable an alias. But basically it seems that somebody is trying to do a defvaralias on a buffer-local variable. Hope this helps.
    – NickD
    Feb 21 at 18:48


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.

Browse other questions tagged or ask your own question.