Source

cc-mode / cc-mode-19.el

Diff from to

File cc-mode-19.el

 ;;; cc-mode-19.el --- compatibility library for Emacs and XEmacs 19
 
-;; Copyright (C) 1985,87,92,93,94,95,96,97,98 Free Software Foundation, Inc.
+;; Copyright (C) 1985,1987,1992-2000 Free Software Foundation, Inc.
 
-;; Authors:    1998 Barry A. Warsaw and Martin Stjernholm
+;; Authors:    2000- Martin Stjernholm
+;;	       1998-1999 Barry A. Warsaw and Martin Stjernholm
 ;;             1997 Barry A. Warsaw
 ;; Maintainer: bug-cc-mode@gnu.org
 ;; Created:    03-Jul-1997
 
 ;;; Code:
 
-
+(provide 'cc-mode-19) ; Before loading cc-defs to avoid a file load loop.
+(eval-when-compile
+  (let ((load-path
+	 (if (and (boundp 'byte-compile-current-file)
+		  (stringp byte-compile-current-file))
+	     (cons (file-name-directory byte-compile-current-file)
+		   load-path)
+	   load-path)))
+    (load "cc-defs" nil t)))
+
 (require 'advice)
 
+
 ;; Emacs 19.34 requires the POS argument to char-after.  Emacs 20
 ;; makes it optional, as it has long been in XEmacs.
 (or (condition-case nil
 	(progn (char-after) t)
       (error nil))
-    (defadvice char-after (before c-char-after-advice
-				  (&optional pos)
-				  activate preactivate)
-      "POS is optional and defaults to the position of point."
-      (if (not pos)
-	  (setq pos (point)))))
+    (progn
+      (ad-define-subr-args 'char-after '(pos))
+      (defadvice char-after (before c-char-after-advice
+				    (&optional pos)
+				    activate)
+	"POS is optional and defaults to the position of point."
+	(if (not pos)
+	    (setq pos (point))))))
 
 (if (fboundp 'char-before)
     ;; (or (condition-case nil
     ;; MULE based on Emacs 19.34 has a char-before function, but
     ;; it requires a position.  It also has a second optional
     ;; argument that we must pass on.
-    (defadvice char-before (before c-char-before-advice
-				   (&optional pos byte-unit)
-				   activate preactivate)
-      "POS is optional and defaults to the position of point."
-      (if (not pos)
-	  (setq pos (point))))
+    (progn
+      (ad-define-subr-args 'char-before '(pos &optional byte-unit))
+      (defadvice char-before (before c-char-before-advice
+				     (&optional pos byte-unit)
+				     activate)
+	"POS is optional and defaults to the position of point."
+	(if (not pos)
+	    (setq pos (point)))))
   ;; Emacs 19.34 doesn't have a char-before function.  Here's it's
   ;; Emacs 20 definition.
   (defsubst char-before (&optional pos)
 ;; Emacs 19.34 doesn't have a functionp function.  Here's it's Emacs
 ;; 20 definition.
 (or (fboundp 'functionp)
-    (defun functionp (obj)
-      "Returns t if OBJ is a function, nil otherwise."
-      (cond
-       ((symbolp obj) (fboundp obj))
-       ((subrp obj))
-       ((compiled-function-p obj))
-       ((consp obj)
-	(if (eq (car obj) 'lambda) (listp (car (cdr obj)))))
-       (t nil))))
+    (defun functionp (object)
+      "Non-nil if OBJECT is a type of object that can be called as a function."
+      (or (subrp object) (byte-code-function-p object)
+	  (eq (car-safe object) 'lambda)
+	  (and (symbolp object) (fboundp object)))))
 
 ;; Emacs 19.34 doesn't have a when macro.  Here's it's Emacs 20
 ;; definition.
       (cons 'if (cons cond (cons nil body)))))
 
 
-(provide 'cc-mode-19)
 ;;; cc-mode-19.el ends here