Subject: Re: bug#14458: 24.3; specman-mode_v1.22.el not compatible with emacs 24.x

From: Glenn Morris <[email-masked]>
Date: Fri, 24 May 2013 15:54:13 -0400

As a general rule, we at bug-gnu-emacs don't support third-party libraries.
The code looks pretty crufty, but the attached minimal patch might get
it working again for you.
If you have any further problems with it, someone on the
[email-masked] list might be willing to help.

*** specman-modev122.el.ORIG	2013-05-24 11:03:30.988169064 -0700
--- specman-modev122.el	2013-05-24 11:18:26.382601795 -0700
***************
*** 65,70 ****
--- 65,72 ----
  ;;  specman-mode is a major mode for editing code written in the 'e' language
  ;;
  
+ (require 'cl)
+ 
  (defconst specman-mode-version "$$Revision: 1.22 $$"
    "Version of this Specman mode.")
  
***************
*** 137,154 ****
  	(defmacro customize (&rest args)
  	  (message "Sorry, Customize is not available with this version of emacs"))
  	(defmacro defcustom (var value doc &rest args)
! 	  (` (defvar (, var) (, value) (, doc))))
  	)
        (if (fboundp 'defface)
  	  nil ;; great!
  	(defmacro defface (var value doc &rest args)
! 	  (` (make-face (, var))))
  	)
        (if (and (featurep 'custom) (fboundp 'customize-group))
  	  nil ;; We've got what we needed
  	;; We have an intermediate custom-library, hack around it!
  	(defmacro customize-group (var &rest args)
! 	  (`(customize (, var) )))
  	)
        (if (and (featurep 'custom) (fboundp 'custom-declare-variable))
  	  nil ;; We've got what we needed
--- 139,156 ----
  	(defmacro customize (&rest args)
  	  (message "Sorry, Customize is not available with this version of emacs"))
  	(defmacro defcustom (var value doc &rest args)
! 	  `(defvar ,var ,value , doc))
  	)
        (if (fboundp 'defface)
  	  nil ;; great!
  	(defmacro defface (var value doc &rest args)
! 	  `(make-face ,var))
  	)
        (if (and (featurep 'custom) (fboundp 'customize-group))
  	  nil ;; We've got what we needed
  	;; We have an intermediate custom-library, hack around it!
  	(defmacro customize-group (var &rest args)
! 	  `(customize ,var) )
  	)
        (if (and (featurep 'custom) (fboundp 'custom-declare-variable))
  	  nil ;; We've got what we needed
***************
*** 157,170 ****
  	(defmacro customize (&rest args)
  	  (message "Sorry, Customize is not available with this version of emacs"))
  	(defmacro defcustom (var value doc &rest args)
! 	  (` (defvar (, var) (, value) (, doc))))
  	)
        
        (if (and (featurep 'custom) (fboundp 'customize-group))
  	  nil ;; We've got what we needed
  	;; We have an intermediate custom-library, hack around it!
  	(defmacro customize-group (var &rest args)
! 	  (`(customize (, var) )))
  	)
        (condition-case nil
            (require 'easymenu)
--- 159,172 ----
  	(defmacro customize (&rest args)
  	  (message "Sorry, Customize is not available with this version of emacs"))
  	(defmacro defcustom (var value doc &rest args)
! 	  `(defvar ,var ,value ,doc))
  	)
        
        (if (and (featurep 'custom) (fboundp 'customize-group))
  	  nil ;; We've got what we needed
  	;; We have an intermediate custom-library, hack around it!
  	(defmacro customize-group (var &rest args)
! 	  `(customize ,var))
  	)
        (condition-case nil
            (require 'easymenu)
***************
*** 407,419 ****
    "cover[ \t\n]+\\([A-Za-z0-9_]+\\)[ \t\n]+is"
    "Regexp that identifies cover definitions (arg 1)")
  
  (defconst specman-symbol-begin-regexp
    "\\<"
    "Regexp that identifies the beginning of a symbol")
  
  (defconst specman-symbol-end-regexp
    "\\>"
!   "Regexp that identifies the end of a symbol")
  
  (defconst specman-number-regexp
    (concat
--- 409,422 ----
    "cover[ \t\n]+\\([A-Za-z0-9_]+\\)[ \t\n]+is"
    "Regexp that identifies cover definitions (arg 1)")
  
+ (eval-and-compile
  (defconst specman-symbol-begin-regexp
    "\\<"
    "Regexp that identifies the beginning of a symbol")
  
  (defconst specman-symbol-end-regexp
    "\\>"
!   "Regexp that identifies the end of a symbol"))
  
  (defconst specman-number-regexp
    (concat
***************
*** 748,754 ****
                     :paren-parent nil))
              scope-index)
        
!       (when (re-search-forward "^<'" buffer-end nil)
          (while (and (< (point) buffer-end)
                      (re-search-forward search-regexp buffer-end 'move))
            
--- 751,757 ----
                     :paren-parent nil))
              scope-index)
        
!       (when (re-search-forward "^<'" buffer-end t)
          (while (and (< (point) buffer-end)
                      (re-search-forward search-regexp buffer-end 'move))
            
***************
*** 3135,3141 ****
  
  ;;; Hacks for FSF
  (require 'font-lock)
! (defvar specman-need-fld 1)
  (defvar font-lock-defaults-alist nil)	;In case we are XEmacs
  (if specman-need-fld
      (let ((specman-mode-defaults
--- 3138,3144 ----
  
  ;;; Hacks for FSF
  (require 'font-lock)
! (defvar specman-need-fld nil)
  (defvar font-lock-defaults-alist nil)	;In case we are XEmacs
  (if specman-need-fld
      (let ((specman-mode-defaults
***************
*** 3205,3210 ****
--- 3208,3216 ----
    (make-local-variable 'indent-line-function)
    (setq indent-line-function 'specman-indent-line)
  
+   (set (make-local-variable 'font-lock-defaults)
+        (get 'specman-mode 'font-lock-defaults))
+ 
    (make-local-variable 'comment-start)
    (make-local-variable 'comment-end)
    (make-local-variable 'block-comment-start)
***************
*** 3448,3454 ****
                  (goto-char lim)
                  (if (equal (point) ;; enter the scope
                             (point-min))
!                     (re-search-forward "^<'")
                    (forward-char 1))
                  (specman-forward-ws)
                  (forward-to-indentation 0)
--- 3454,3460 ----
                  (goto-char lim)
                  (if (equal (point) ;; enter the scope
                             (point-min))
!                     (re-search-forward "^<'" nil t)
                    (forward-char 1))
                  (specman-forward-ws)
                  (forward-to-indentation 0)
***************
*** 5371,5377 ****
  ;; =============================================================================
  ;; Require package filladapt
  
! (require 'filladapt)
  
  (add-hook 'specman-mode-hook
    '(lambda () (auto-fill-mode 1)))
--- 5377,5383 ----
  ;; =============================================================================
  ;; Require package filladapt
  
! (when (require 'filladapt nil t)
  
  (add-hook 'specman-mode-hook
    '(lambda () (auto-fill-mode 1)))
***************
*** 5384,5390 ****
  ; C++ style comments are already recognized.
  (setcar filladapt-token-table '("---*" e-comment))
  (setcar filladapt-token-match-table '(e-comment e-comment))
! (setcar filladapt-token-conversion-table '(e-comment . exact))

--- 5390,5396 ----
  ; C++ style comments are already recognized.
  (setcar filladapt-token-table '("---*" e-comment))
  (setcar filladapt-token-match-table '(e-comment e-comment))
! (setcar filladapt-token-conversion-table '(e-comment . exact)))