tag 653253 +patch
thanks

2011/12/26 Kevin Ryde <[email protected]>:
> Package: gnuplot-mode
> Version: 1:0.6.0-7
> Severity: minor
> File: /etc/emacs/site-start.d/50gnuplot-mode.el
>
> After
>
>    apt-get remove gnuplot-mode
>
> visiting a .gp file
>
>    emacs /tmp/foo.gp
>
> gets an error
>
>    File mode specification error: (file-error "Cannot open load file" 
> "gnuplot")
>
> I think 50gnuplot-mode.el should not make an auto-mode-alist setup if
> the package has been removed, but not purged, so the 50gnuplot-mode.el
> remains.
>
> Usually this can be done by checking for a package directory and
> skipping then setups when "removed but not purged".  Eg. (untested :)
>
>
> (if (not (file-exists-p "/usr/share/emacs/site-lisp/gnuplot-mode"))
>    (message "gnuplot-mode removed but not purged, skipping setup")
>
>  ...)

In particular, attached patch based in above suggestion seems to work here.

> Incidentally, the "foo.gp" can clash with pari-gp scripts called ".gp".
> I've used and seen occasionally ".gnuplot".  Maybe it'd be worth adding
> that to auto-mode-alist as well.

For the records I have also used and occasionally seen ".gpt". Do not
know if this can clash with other known extensions. In any case,
".gnuplot" seems a good candidate for addition.

Regards,

-- 
Agustin
From e11ec2a61f355d03e185bbd477d39a189f7d6fb0 Mon Sep 17 00:00:00 2001
From: Agustin Martin Domingo <[email protected]>
Date: Fri, 6 Jan 2012 03:44:07 +0100
Subject: [PATCH] debian/emacsen-startup: Skip startup code if gnuplot-mode is removed but not purged. (Closes: #653253).

Original suggestion by Kevin Ryde.
---
 debian/emacsen-startup |   33 ++++++++++++++++++---------------
 1 files changed, 18 insertions(+), 15 deletions(-)

diff --git a/debian/emacsen-startup b/debian/emacsen-startup
index 8f03136..16edb39 100644
--- a/debian/emacsen-startup
+++ b/debian/emacsen-startup
@@ -10,22 +10,25 @@
 ;; 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:
 
-(debian-pkg-add-load-path-item
- (concat "/usr/share/"
-	 (symbol-name debian-emacs-flavor)
-	 "/site-lisp/gnuplot-mode"))
-
-;; these lines enable the use of gnuplot mode
+(if (not (file-exists-p "/usr/share/emacs/site-lisp/gnuplot-mode"))
+    (message "Package gnuplot-mode removed but not purged. Skipping setup")
+  
+  ;; We have to add this to the load-path:
+  (debian-pkg-add-load-path-item
+   (concat "/usr/share/"
+	   (symbol-name debian-emacs-flavor)
+	   "/site-lisp/gnuplot-mode"))
+  
+  ;; these lines enable the use of gnuplot mode
   (autoload 'gnuplot-mode "gnuplot" "gnuplot major mode" t)
   (autoload 'gnuplot-make-buffer "gnuplot" "open a buffer in gnuplot mode" t)
-
-;; this line automatically causes all files with the .gp extension to
-;; be loaded into gnuplot mode
+  
+  ;; this line automatically causes all files with the .gp extension to
+  ;; be loaded into gnuplot mode
   (setq auto-mode-alist (append '(("\\.gp\\'" . gnuplot-mode)) auto-mode-alist))
-
-;; This line binds the function-9 key so that it opens a buffer into
-;; gnuplot mode
-;;  (global-set-key [(f9)] 'gnuplot-make-buffer)
-
+  
+  ;; This line binds the function-9 key so that it opens a buffer into
+  ;; gnuplot mode
+  ;;  (global-set-key [(f9)] 'gnuplot-make-buffer)
+  )
-- 
1.7.2.5

Reply via email to