summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpsg <>2009-02-23 16:18:53 +0000
committerpsg <>2009-02-23 16:18:53 +0000
commit6bc6b282f87012b3aeaf8760958fd4add98d4a96 (patch)
treea6eaf77aef3d13bf64565890e796f65c769bddfe
parent220fdf4dd29cd8b48fe05e95e10da3f8d905af2b (diff)
dpkg-dev-el.el:
Moved some stuff in from 50dpkg-dev-el.el. Added README.Source to auto-mode-alist, thanks to Noah Slater (Closes #490292).
-rw-r--r--dpkg-dev-el.el37
1 files changed, 37 insertions, 0 deletions
diff --git a/dpkg-dev-el.el b/dpkg-dev-el.el
index dafe536..053cb84 100644
--- a/dpkg-dev-el.el
+++ b/dpkg-dev-el.el
@@ -57,6 +57,43 @@
:load 'readme-debian
:group 'dpkg-dev-el)
+
+
+
+;; other useful automode
+(add-to-list 'auto-mode-alist
+ '("/debian/[^/]*emacsen-startup\\'" . emacs-lisp-mode))
+;; Closes #490292
+(add-to-list 'auto-mode-alist '("README.source" . readme-debian-mode))
+
+(when (member 'utf-8 (coding-system-list))
+ ;; default to utf-8 for debian changelog files
+ (modify-coding-system-alist 'file "/changelog\\.Debian\\'" 'utf-8)
+ (modify-coding-system-alist 'file "/debian/control\\'" 'utf-8)
+
+;;; (modify-coding-system-alist 'file "/debian/changelog\\'" 'utf-8)
+;;; Instead use this. See http://bugs.debian.org/457047 by Trent W. Buck
+ (modify-coding-system-alist 'file "/debian/\\([[:lower:][:digit:].+-]\\.\\)?changelog\\'" 'utf-8)
+
+ ;; Handle Debian native package, from Kevin Ryde in bug #317597 and #416218
+ (defun debian-changelog-coding-system (args)
+ "Return the coding system for a /usr/share/doc/[package]/changelog file.
+If [package] is a debian native (no separate changelog.Debian) then answer
+`utf-8', otherwise remove ourselves from `file-coding-system-alist' and see
+what other rules say."
+ (let ((filename (if (consp (cadr args))
+ (car (cadr args)) ;; ("filename" . buffer) in emacs 22
+ (cadr args))) ;; "filename" in emacs 21
+ (dirname (file-name-directory filename)))
+ (if (file-exists-p (concat dirname "changelog.Debian.gz"))
+ (let ((file-coding-system-alist
+ (remove '("/usr/share/doc/[^/]+/changelog\\'"
+ . debian-changelog-coding-system)
+ file-coding-system-alist)))
+ (apply 'find-operation-coding-system args))
+ 'utf-8))))
+
+
(provide 'dpkg-dev-el)
;;; dpkg-dev-el.el ends here