bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#19206: 25.0.50; CC Mode tracks wrong source files


From: Sebastian Wiesner
Subject: bug#19206: 25.0.50; CC Mode tracks wrong source files
Date: Fri, 28 Nov 2014 11:19:01 +0100

CC Mode tracks wrong source files when a CC Mode derived mode is
installed non-interactively.

To reproduce, save the following code as `cc-miscompile.el'

(require 'package)
(require 'cc-defs)

(defun main ()
  (add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/";))

  (setq package-user-dir (make-temp-file "cc-miscompile" 'directory))

  (package-initialize)
  (package-refresh-contents)
  (package-install 'd-mode)

  (require 'd-mode)

  (let ((source (get (intern "c-typedef-decl-kwds" c-lang-constants) 'source)))
    (message "Sources: %S" (mapcar 'car source)))

  (delete-directory package-user-dir 'recursive))

(main)

and run it with `emacs -Q --script cc-miscompile.el'.  The output is as
follows (package.el output shortened for readility):

Contacting host: melpa.org:80
Contacting host: elpa.gnu.org:80
[…]
Sources: (d-mode cc-miscompile cc-langs)

Note that `cc-miscompile' ends up in the source list of
`c-typedef-decl-kwds', even though it never actually calls any `c-*'
functions at all.

Naturally, CC Mode will later try to load this file, and fail if it is
not in the `load-path'.  This effectively breaks installations of D
Mode from non-interactive Emacs sessions.

I did not try to find the culprit.  The CC Mode code is convoluted
beyond my understanding.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]