Package: php-mode
Version: 1.5.0-1
Severity: normal
Tags: patch
Suppose I install and then remove php-elisp. This file remains:
/etc/emacs/site-start.d/50php-elisp.el
because it is a conffile. Fine. But then I start Emacs and open a .php
file and get the error:
File mode specification error: (file-error "Cannot open load file"
"php-elisp/php-mode")
This is because the code:
(setq auto-mode-alist
(cons '("\\.php[34]?\\'\\|\\.phtml\\." . php-mode) auto-mode-alist))
(autoload 'php-mode "php-elisp/php-mode" "mode for editing php files" t)
in 50php-elisp.el is run unconditionally. I recommend code that detects
(1) whether the package has been removed but not purged and (2) whether
the package has been correctly byte-compiled.
A better /etc/emacs/site-start.d/50php-elisp.el file is attached which
you can use as debian/emacsen-startup
Thanks,
Peter
-- System Information:
Debian Release: squeeze/sid
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.6.32-3-686 (SMP w/2 CPU cores)
Locale: LANG=en_CA.UTF-8, LC_CTYPE=en_CA.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
;; -*-emacs-lisp-*-
;;
;; Emacs startup file for the Debian GNU/Linux php-elisp package
;;
;; Originally contributed by Nils Naumann <[email protected]>
;; Modified by Dirk Eddelbuettel <[email protected]>
;; Adapted for dh-make by Jim Van Zandt <[email protected]>
;; Peter S Galbraith <[email protected]> 2010-06-05
;; Check if package is installed and correctly byte-compiled.
;; The php-elisp package follows the Debian/GNU Linux 'emacsen' policy and
;; byte-compiles its elisp files for each 'emacs flavor' (emacs19,
;; xemacs19, emacs20, xemacs20...). The compiled code is then
;; installed in a subdirectory of the respective site-lisp directory.
(cond
((not (file-exists-p "/usr/share/emacs/site-lisp/php-elisp/php-mode.el"))
(message
"Package php-elisp removed but not purged. Skipping setup."))
((not (file-exists-p (concat "/usr/share/"
(symbol-name debian-emacs-flavor)
"/site-lisp/php-elisp/php-mode.elc")))
(message "Package php-elisp is not fully installed. Skipping setup."))
(t
(setq auto-mode-alist
(cons '("\\.php[34]?\\'\\|\\.phtml\\." . php-mode) auto-mode-alist))
(autoload 'php-mode "php-elisp/php-mode" "mode for editing php files" t)))