On Fri, Jan 24, 2014 at 03:25:10PM +0100, Agustin Martin wrote:
> This should have been fixed in emacsen-common 2.0.6, but that version
> enabled the other check.
> 
> Please consider attached patch. Since pylint uses dh_installemacsen that
> compat file should be installed in the right place and bug fixed for 2.0.6.
> 
> > Loading 50pylint...
> > Loading pylint...
> > Error while loading 50pylint: Symbol's function definition is void:
> > define-compilation-mode
> 
> It is a lisp macro defined in Emacs compile.el (at least in emacs-snapshot)
> and is required by pylint.el. Do not understand why it is not pulled, if not
> present `require' should have complained about it.
> 
> Also note that pylint byte-compilation is too verbose and loads site files,
> which may not be needed for byte-compilation or even interfere with it. 
> Consider passing -no-site-file (should work for both Emacs and XEmacs)
> unless site files are really needed.
> 
> In particular /etc/emacs/site-start.d/50pylint.el seems to unconditionally
> load pylint, even if not dealing with a python file, thus loading pylint.el
> itself during pylint.el byte compilation
> 
> Loading /etc/emacs/site-start.d/50pylint.el (source)...
> 
> I do not know the pylint internals, but something like what is suggested in
> pylint.el
> 
> (autoload 'pylint "pylint")
> (add-hook 'python-mode-hook 'pylint-add-menu-items)
> (add-hook 'python-mode-hook 'pylint-add-key-bindings)
> 
> may be a better alternative.

Hi,

While we are at this I was playing a bit more with pylint. Please find
attached some more suggestions for pylint elisp. Tested only from the
packaging point of view (install ...), that is not using pylint mode
itself.

* 0002-debian-pylint.emacsen-install-Use-no-site-file.patch

  debian/pylint.emacsen-install: Do not load site files

* 0003-debian-pylint.emacsen-install-Use-symlinks-for-pylin.patch 

  debian/pylint.emacsen-install: Use and keep symlinks for .el files. 
  Mandatory per current policy.

* 0004-debian-pylint.emacsen-startup-Use-debian-pkg-add-loa.patch
 
  debian/pylint.emacsen-startup: Use `debian-pkg-add-load-path-item' to add
  path for byte-compiled pylint to load-path.

* 0005-debian-pylint.emacsen-startup-Do-not-unconditionally.patch

  debian/pylint.emacsen-startup: Do not unconditionally load "pylint" but
  set suggested autoloads.

Regards,

-- 
Agustin
>From 37fb901fe99e47bcb802db3b1cc3a1e8cc8b80cf Mon Sep 17 00:00:00 2001
From: Agustin Martin Domingo <[email protected]>
Date: Tue, 4 Feb 2014 17:37:50 +0100
Subject: [PATCH 2/5] debian/pylint.emacsen-install: Use (-|--)no-site-file.

---
 debian/pylint.emacsen-install | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/debian/pylint.emacsen-install b/debian/pylint.emacsen-install
index 66a8480..7c04cb0 100644
--- a/debian/pylint.emacsen-install
+++ b/debian/pylint.emacsen-install
@@ -12,12 +12,19 @@ if [ ${FLAVOR} = emacs ]; then exit 0; fi
 
 echo install/${PACKAGE}: Handling install for emacsen flavor ${FLAVOR}
 
-#FLAVORTEST=`echo $FLAVOR | cut -c-6`
-#if [ ${FLAVORTEST} = xemacs ] ; then
-#    SITEFLAG="-no-site-file"
-#else
-#    SITEFLAG="--no-site-file"
-#fi
+case "$FLAVOR" in
+    xemacs*)
+        SITEFLAG="-no-site-file"
+        ;;
+    emacs*)
+        SITEFLAG="--no-site-file"
+        ;;
+    *)
+        echo install/${PACKAGE}: Ignoring emacsen flavour [${FLAVOR}]
+        exit 0
+        ;;
+esac
+
 FLAGS="${SITEFLAG} -q -batch -l path.el -f batch-byte-compile"
 
 ELDIR=/usr/share/emacs/site-lisp/${PACKAGE}
-- 
1.8.5.3

>From 0165fb9a35654f06e0852a53901e53189cc2c05d Mon Sep 17 00:00:00 2001
From: Agustin Martin Domingo <[email protected]>
Date: Tue, 4 Feb 2014 18:29:43 +0100
Subject: [PATCH 3/5] debian/pylint.emacsen-install: Use symlinks for pylint
 .el files and keep them.

---
 debian/pylint.emacsen-install | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/debian/pylint.emacsen-install b/debian/pylint.emacsen-install
index 7c04cb0..5ace32f 100644
--- a/debian/pylint.emacsen-install
+++ b/debian/pylint.emacsen-install
@@ -40,13 +40,15 @@ fi
 install -m 755 -d ${ELCDIR}
 cd ${ELDIR}
 FILES=`echo *.el`
-cp ${FILES} ${ELCDIR}
 cd ${ELCDIR}
+for i in ${FILES}; do
+    ln -fs ${ELDIR}/$i .
+done
 
 cat << EOF > path.el
 (setq load-path (cons "." load-path) byte-compile-warnings nil)
 EOF
 ${FLAVOR} ${FLAGS} ${FILES}
-rm -f *.el path.el
+rm -f path.el
 
 exit 0
-- 
1.8.5.3

>From 0babaddeb4442a1229f152e9eaa25d601383c42d Mon Sep 17 00:00:00 2001
From: Agustin Martin Domingo <[email protected]>
Date: Tue, 4 Feb 2014 17:42:07 +0100
Subject: [PATCH 4/5] debian/pylint.emacsen-startup: Use
 `debian-pkg-add-load-path-item' to add path for byte-compiled pylint to
 load-path.

---
 debian/pylint.emacsen-startup | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/debian/pylint.emacsen-startup b/debian/pylint.emacsen-startup
index 646bd81..e73060a 100644
--- a/debian/pylint.emacsen-startup
+++ b/debian/pylint.emacsen-startup
@@ -10,8 +10,11 @@
 ;; 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.
-;; We have to add this to the load-path:
-(setq load-path (cons (concat "/usr/share/"
-                              (symbol-name flavor)
-                              "/site-lisp/pylint") load-path))
+
+;; Add path for byte-compiled pylint to load-path
+(debian-pkg-add-load-path-item
+ (concat "/usr/share/"
+	 (symbol-name flavor)
+	 "/site-lisp/pylint"))
+
 (load-library "pylint")
-- 
1.8.5.3

>From 7091ad0413e79d7bf8042c225d9b39377f6e48d4 Mon Sep 17 00:00:00 2001
From: Agustin Martin Domingo <[email protected]>
Date: Tue, 4 Feb 2014 17:50:38 +0100
Subject: [PATCH 5/5] debian/pylint.emacsen-startup: Do not unconditionally
 load "pylint" but set suggested autoloads.

---
 debian/pylint.emacsen-startup | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/debian/pylint.emacsen-startup b/debian/pylint.emacsen-startup
index e73060a..eb0a105 100644
--- a/debian/pylint.emacsen-startup
+++ b/debian/pylint.emacsen-startup
@@ -17,4 +17,7 @@
 	 (symbol-name flavor)
 	 "/site-lisp/pylint"))
 
-(load-library "pylint")
+;; Some autoloads
+(autoload 'pylint "pylint")
+(add-hook 'python-mode-hook 'pylint-add-menu-items)
+(add-hook 'python-mode-hook 'pylint-add-key-bindings)
-- 
1.8.5.3

Reply via email to