From f52e6bd94fab618e69d38332756e5321ed131f4e Mon Sep 17 00:00:00 2001
From: Rob Browning <rlb@defaultvalue.org>
Date: Mon, 4 Apr 2011 22:46:22 -0500
Subject: Run debian-startup and set debian-emacs-flavor

Emacs runs debian-startup and sets debian-emacs-flavor.

* Emacs runs debian-startup during the startup process unless
  site-run-file is false.

* The global variable debian-emacs-flavor is bound to 'emacs.

Author: Rob Browning <rlb@defaultvalue.org>
---
 lisp/startup.el | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/lisp/startup.el b/lisp/startup.el
index bff10003f84..78cd8dd0e3a 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -436,6 +436,10 @@ tutorial-directory
   :type 'directory
   :initialize #'custom-initialize-delay)
 
+(defconst debian-emacs-flavor 'emacs
+  "A symbol representing the particular debian flavor of emacs running.
+Something like 'emacs, 'xemacs21, etc.")
+
 (defun normal-top-level-add-subdirs-to-load-path ()
   "Recursively add all subdirectories of `default-directory' to `load-path'.
 More precisely, this uses only the subdirectories whose names
@@ -1361,7 +1365,14 @@ command-line
         ;; Sites should not disable the startup screen.
         ;; Only individuals should disable the startup screen.
         (let ((inhibit-startup-screen inhibit-startup-screen))
-	  (load site-run-file t t)))
+          (progn
+            ;; This form has been added by Debian to load all the
+            ;; debian package snippets (dh-elpa, etc.).  It's in here
+            ;; because we want -q to kill it too.
+            (if (load "debian-startup" t t nil)
+                (debian-startup debian-emacs-flavor))
+            ;; This is the normal upstream behavior
+            (load site-run-file t t))))
 
     ;; Load that user's init file, or the default one, or none.
     (startup--load-user-init-file
