tag 601600 +patch
thanks

On Wed, Oct 27, 2010 at 01:45:18PM -0400, mike castleman wrote:
>Package: protobuf
>Severity: wishlist
>
>The upstream protobuf source includes an editors directory with an emacs 
>mode for editing protocol description files. It'd be nice if this file 
>could be packaged somewhere. There is also a vim file in there; I don't 
>know enough about vim to suggest what to do with it, though I imagine 
>there are people who would like it as well.

Patch attached to install emacs mode with emacs common.

Robert: I can push this to the collab repo if that is easier than patching.

--bod
diff --git a/debian/README.emacs b/debian/README.emacs
new file mode 100644
index 0000000..17486ee
--- /dev/null
+++ b/debian/README.emacs
@@ -0,0 +1 @@
+Install the protobuf-mode-el package.
diff --git a/debian/changelog b/debian/changelog
index 16060ee..4116be5 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+protobuf (2.6.1-2) unstable; urgency=medium
+
+  * Split protobuf-mode.el into a separate package (closes: #601600.)
+  * Work around emacs bug #18845 when byte compiling protobuf-mode.el.
+
+ -- Brendan O'Dea <b...@debian.org>  Mon, 24 Nov 2014 21:53:54 +1100
+
 protobuf (2.6.1-1) unstable; urgency=medium
 
   * New upstream release.
diff --git a/debian/control b/debian/control
index 49097c5..8eaa09f 100644
--- a/debian/control
+++ b/debian/control
@@ -159,6 +159,7 @@ Package: python-protobuf
 Architecture: any
 Section: python
 Depends: ${shlibs:Depends}, ${python:Depends}, ${misc:Depends}
+Suggests: protobuf-mode-el
 Description: Python bindings for protocol buffers
  Protocol buffers are a flexible, efficient, automated mechanism for
  serializing structured data - similar to XML, but smaller, faster, and
@@ -196,3 +197,10 @@ Description: Java bindings for protocol buffers
  need the protoc tool (in the protobuf-compiler package) to compile your
  definition to Java classes, and then the modules in this package will allow
  you to use those classes in your programs.
+
+Package: protobuf-mode-el
+Architecture: all
+Depends: ${misc:Depends}, emacsen-common (>= 2.0.8)
+Section: devel
+Description: Emacs major mode for editing protocol buffers
+ Syntax highlighting and indenting support for protocol buffers.
diff --git a/debian/protobuf-compiler.install b/debian/protobuf-compiler.install
index e772481..302bfab 100644
--- a/debian/protobuf-compiler.install
+++ b/debian/protobuf-compiler.install
@@ -1 +1,2 @@
 usr/bin
+debian/README.emacs /usr/share/doc/protobuf-compiler/editors
diff --git a/debian/protobuf-mode-el.emacsen-compat b/debian/protobuf-mode-el.emacsen-compat
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/debian/protobuf-mode-el.emacsen-compat
@@ -0,0 +1 @@
+0
diff --git a/debian/protobuf-mode-el.emacsen-install b/debian/protobuf-mode-el.emacsen-install
new file mode 100644
index 0000000..6119a06
--- /dev/null
+++ b/debian/protobuf-mode-el.emacsen-install
@@ -0,0 +1,24 @@
+#!/bin/sh -e
+
+FLAVOR=$1
+PACKAGE=protobuf-mode-el
+
+ELDIR=/usr/share/emacs/site-lisp/${PACKAGE}
+ELCDIR=/usr/share/${FLAVOR}/site-lisp/${PACKAGE}
+files="protobuf-mode.el"
+flags="-batch -no-site-file -l path.el -f batch-byte-compile"
+
+if [ ${FLAVOR} != emacs ]; then
+  echo install/${PACKAGE}: Byte-compiling for ${FLAVOR}
+
+  install -m 755 -d ${ELCDIR}
+  cd ${ELCDIR}
+  for f in ${files}; do
+    ln -sf ../../../emacs/site-lisp/${PACKAGE}/${f} .
+  done
+  cat << EOF > path.el
+(setq load-path (cons "." load-path) byte-compile-warnings nil)
+EOF
+  ${FLAVOR} ${flags} ${files}
+  rm -f path.el
+fi
diff --git a/debian/protobuf-mode-el.emacsen-remove b/debian/protobuf-mode-el.emacsen-remove
new file mode 100644
index 0000000..5d23e96
--- /dev/null
+++ b/debian/protobuf-mode-el.emacsen-remove
@@ -0,0 +1,9 @@
+#!/bin/sh -e
+
+FLAVOR=$1
+PACKAGE=protobuf-mode-el
+
+if [ ${FLAVOR} != emacs ]; then
+  echo remove/${PACKAGE}: Purging byte-compiled files for ${FLAVOR}
+  rm -rf /usr/share/${FLAVOR}/site-lisp/${PACKAGE}
+fi
diff --git a/debian/protobuf-mode-el.emacsen-startup b/debian/protobuf-mode-el.emacsen-startup
new file mode 100644
index 0000000..6592979
--- /dev/null
+++ b/debian/protobuf-mode-el.emacsen-startup
@@ -0,0 +1,6 @@
+;; Startup for protobuf-mode.
+(if (not (file-exists-p "/usr/share/emacs/site-lisp/protobuf-mode-el"))
+    (message "protobuf-mode-el removed but not purged, skipping setup")
+  (autoload 'protobuf-mode "protobuf-mode-el/protobuf-mode"
+    "Major mode for editing Protocol Buffers description language." t)
+  (add-to-list 'auto-mode-alist '("\\.proto$" . protobuf-mode)))
diff --git a/debian/protobuf-mode-el.install b/debian/protobuf-mode-el.install
new file mode 100644
index 0000000..66c605e
--- /dev/null
+++ b/debian/protobuf-mode-el.install
@@ -0,0 +1 @@
+editors/protobuf-mode.el /usr/share/emacs/site-lisp/protobuf-mode-el
diff --git a/debian/rules b/debian/rules
index babb525..21515a1 100755
--- a/debian/rules
+++ b/debian/rules
@@ -79,3 +79,6 @@ override_dh_install:
 
 	# Remove compiler headers from libprotobuf-dev.
 	rm -rf $(CURDIR)/debian/libprotobuf-dev/usr/include/google/protobuf/compiler
+
+override_dh_installdocs:
+	dh_installdocs -Xprotobuf-mode.el  # in protobuf-mode-el
diff --git a/editors/protobuf-mode.el b/editors/protobuf-mode.el
index 09aecc9..87f024e 100644
--- a/editors/protobuf-mode.el
+++ b/editors/protobuf-mode.el
@@ -67,7 +67,10 @@
 
 (eval-when-compile
   (require 'cc-langs)
-  (require 'cc-fonts))
+  (require 'cc-fonts)
+  ;; http://debbugs.gnu.org/db/18/18845.html
+  (when (and (= emacs-major-version 24) (= emacs-minor-version 4))
+    (require 'cl)))
 
 ;; This mode does not inherit properties from other modes. So, we do not use 
 ;; the usual `c-add-language' function.

Reply via email to