POV-Ray : Newsgroups : povray.unix : pov-mode.2.10 patch: major mode for emacs 22 Server Time
22 Dec 2024 04:11:30 EST (-0500)
  pov-mode.2.10 patch: major mode for emacs 22 (Message 1 to 2 of 2)  
From: Marco e Erika
Subject: pov-mode.2.10 patch: major mode for emacs 22
Date: 7 Feb 2008 12:08:58
Message: <47ab3b2a@news.povray.org>
Hi all!
Emacs 22 no longer works with pov-mode-2.10
http://www.acc.umu.se/~woormie/povray/pov-mode.2.10.tgz

I've made a workaround adding the missing variable. Then I made a simple script for
setting 2 vars that emacs 22 can't digest.
This is the patch (beware of word wrapping!!)

=============CUT HERE======================================
--- pov-mode.el-orig    2008-02-05 19:47:26.000000000 +0100
+++ pov-mode.el 2008-02-05 20:48:46.000000000 +0100
@@ -3,10 +3,15 @@
  ;; Author: Peter Boettcher <pwb### [at] andrewcmuedu>
  ;; Maintainer: Peter Toneby <woo### [at] accumuse>
  ;; Created: 04 March 1994
-;; Modified: 08 Sep 2003
-;; Version: 2.10
+;; Modified: 05 Feb 2008
+;; Version: 2.10-pl1
  ;; Keywords: pov, povray
  ;;
+;; Modified by: Marco Pessotto <mar### [at] gmailcom>
+;; 1/5/2008
+;; Workaround for Emacs 22
+;; Peter Tobeby no more maintains pov-mode :-(
+;;
  ;; LCD Archive Entry:
  ;; povray|Peter Toneby|woo### [at] accumuse|
  ;; Major mode for Povray scene files|
@@ -58,7 +63,9 @@
  ;;
  ;; To learn about the basics, just load a pov-file and press C-h m.
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; Modified by: Peter Boettcher <pwb### [at] andrewcmuedu>
+
+;;
+;;Modified by: Peter Boettcher <pwb### [at] andrewcmuedu>
  ;;  5/8/97:
  ;;    Added font-lock support for Emacs/XEmacs 19
  ;;    Indent under `#declare Object=' lines
@@ -235,9 +242,18 @@
         (not font-pov-is-XEmacs20)
         (not font-pov-is-XEmacs21)
         (= 21 emacs-major-version)))
+(defvar font-pov-is-Emacs22
+  (and (not font-pov-is-XEmacs19)
+       (not font-pov-is-XEmacs20)
+       (not font-pov-is-XEmacs21)
+       (= 22 emacs-major-version)))

  (defvar font-pov-is-Emacs
-  (or font-pov-is-Emacs19 font-pov-is-Emacs20 font-pov-is-Emacs21))
+  (or font-pov-is-Emacs19
+      font-pov-is-Emacs20
+      font-pov-is-Emacs21
+      font-pov-is-Emacs22))
+

  (require 'cl)
  (require 'font-lock) ;;[TODO] Not nice to reqire it, the user should
@@ -312,7 +328,7 @@
    (customize-set-value 'max-lisp-eval-depth 1000))

  ;; Yup XEmacs didn't get cutomizations until 20.2.
-(cond ((or font-pov-is-XEmacs20-2 (or font-pov-is-Emacs20 font-pov-is-Emacs21))
+(cond ((or font-pov-is-XEmacs20-2 (or font-pov-is-Emacs20 font-pov-is-Emacs21
font-pov-is-Emacs22))
        (defgroup  pov nil
         "*Major mode for editing povray 3.X scence files <http://www.povray.org>."
         :group 'languages)
@@ -400,12 +416,12 @@
                                             '()))
         "the commands to run")

-      (defcustom pov-home-dir "/usr/local/lib/povray31/"
+      (defcustom pov-home-dir "SHARELIBSPOVRAY"
         "*The directory in which the povray files reside."
         :type 'directory
         :group 'pov)

-      (defcustom pov-include-dir "/usr/local/lib/povray31/include/"
+      (defcustom pov-include-dir "SHARELIBSPOVRAY/include"
         "*The directory in which the povray includefiles reside."
         :type 'directory
         :group 'pov)
@@ -422,12 +438,12 @@
         :group 'pov)

        (defcustom pov-fontify-insanely t
-       "*Non-nil means colorize every povray keyword.  This may take a while on lare
files.  Maybe disable this on slow systems."
+       "*Non-nil means colorize every povray keyword.  This may take a while on large
files.  Maybe disable this on slow systems."
         :type 'boolean
         :group 'pov)

        (defcustom pov-imenu-in-menu t
-       "*Non-nil means have #locals and #declares in a menu called PoV in the
menubar. This may take a while on lare files.  Maybe disable this on slow systems."
+       "*Non-nil means have #locals and #declares in a menu called PoV in the
menubar. This may take a while on large files.  Maybe disable this on slow systems."
         :type 'boolean
         :group 'pov)
  ;; CH
@@ -510,10 +526,15 @@
  )

  ; Find where the menubar icons are placed, should be where pov-mode is...
-(setq pov-icons-location
-      (file-name-directory (locate-data-file "povrender.xpm"
-                                            (cons (file-name-directory
(locate-library "pov-mode"))
-                                                  (if font-pov-is-Emacs
data-directory data-directory-list)))))
+;; (setq pov-icons-location
+;;       (file-name-directory (locate-data-file "povrender.xpm"
+;;                                          (cons (file-name-directory
(locate-library "pov-mode"))
+;;                                                (if font-pov-is-Emacs
data-directory data-directory-list)))))
+
+;;FIX ME
+
+(setq pov-icons-location "EMACSLISPLIBRARY/povrender.xpm")
+

  ;; Lets play with the Toolbar, we want to add buttons for
  ;; rendering and showing images, lets place them on the rightmost
@@ -597,7 +618,7 @@
  (defun font-pov-setup ()
    "Setup this buffer for PoV font-lock."
    (cond
-   ((or font-pov-is-Emacs20 font-pov-is-Emacs21)
+   ((or font-pov-is-Emacs20 font-pov-is-Emacs21 font-pov-is-Emacs22)
      ;; Tell Font Lock about the support.
      (make-local-variable 'font-lock-defaults))
     ((or font-pov-is-XEmacs19 font-pov-is-XEmacs20)
@@ -619,7 +640,7 @@
      (make-local-variable 'font-lock-defaults))))

  (cond
- ((or font-pov-is-Emacs20 font-pov-is-XEmacs20-2 font-pov-is-Emacs21)
+ ((or font-pov-is-Emacs20 font-pov-is-XEmacs20-2 font-pov-is-Emacs21
font-pov-is-Emacs22)
    (defface font-pov-object-face
      '((((class grayscale) (background light)) (:foreground "DimGray" :bold t))
        (((class grayscale) (background dark))  (:foreground "LightGray" :bold t))
@@ -2013,12 +2034,12 @@
    )

  ;; Let's try to find where the InsertMenu is located...
-(setq pov-insertmenu-location
-      (locate-data-directory "InsertMenu" (cons (file-name-directory
-                                                (locate-library "pov-mode"))
-                                               (if font-pov-is-Emacs
-                                                   data-directory
-                                                 data-directory-list))))
+(setq pov-insertmenu-location "EMACSLISPLIBRARY/InsertMenu")
+;;       (locate-data-directory "InsertMenu" (cons (file-name-directory
+;;                                              (locate-library "pov-mode"))
+;;                                             (if font-pov-is-Emacs
+;;                                                 data-directory
+;;                                               data-directory-list))))

  (defun pov-im-get-submenunames ()
    (interactive)
===================CUT HERE================================================

Untar pov-mode-2.10.tar.gz in your load-path, paste the patch in a file
named e.g. ``Patch'' in the same directory of pov-mode.el,
then:

patch --verbose < Patch

and should be OK.
Then run this simple script, in the same directory too:



==========CUT HERE====================
#!/bin/bash
# Copyright (C) 2008  Marco Pessotto
# <mar### [at] gmailcom>
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.


# check if povray is in your path
which povray 1>/dev/null 2>/dev/null
if [ ! $? -eq 0 ]; then
     echo "povray is not in your PATH. Why?"
     exit 1
fi

# I assume the share directory is here
povshare=$(echo $(dirname $(which povray)) | sed -e "s|bin|share/povray-3.6|")
echo  "Where is the share directory of povray? "
echo -n "Should be $povshare >>>  "
read povshare
if [ "$povshare" == "" ]; then
     povshare=$(echo $(dirname $(which povray)) | sed -e "s|bin|share/povray-3.6|")
     echo "Using default: $povshare "
fi


povlib=$(pwd)
# I assume that you are already untar this in the right directory
echo "Where are the emacs libs, where you are going to extract this files?"
echo -n "I assume here, in $povlib >>>   "
read povlib
if [ "$povlib" == "" ]; then
     povlib=$(pwd)
     echo "Using default: $povlib "
fi
#get rid of slashes
povshare=$(echo $povshare | sed -e "s|//* *\$||")
povlib=$(echo $povlib | sed -e "s|//* *\$||")

sed -e "s|SHARELIBSPOVRAY|$povshare|" \
     -e "s|EMACSLISPLIBRARY|$povlib|" pov-mode.el > pov-mode-new.el


echo "I changed this: "
diff pov-mode.el pov-mode-new.el
echo -n "Can I overwrite pov-mode.el? "
read i
case $i in
	y|Y) cp pov-mode.el pov-mode.el.backup
		mv pov-mode-new.el pov-mode.el

	;;
	*) echo "ok"
	;;
esac

exit 0


==============CUT HERE======================================
This should fix the vars. Of course you must follow the instructions here:
http://www.acc.umu.se/~woormie/povray/
Feedback welcome!

Regards

Marco Pessotto


Post a reply to this message

From: Marco e Erika
Subject: Re: pov-mode.2.10 patch: major mode for emacs 22
Date: 7 Feb 2008 13:53:27
Message: <47ab53a7@news.povray.org>
Ok, sorry, the patch has been wrapped: try this.

http://pastebin.com/f6bc22bd8

This is the pov-mode.el already patched. Pleas run the script in the previous post to
get the vars right.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.