Source

cc-mode / cc-lobotomy.el

Diff from to

cc-lobotomy.el

 ;;; cc-lobotomy.el --- excise portions of cc-mode's brain... for speed
 
-;; Copyright (C) 1985,1987,1992-2000 Free Software Foundation, Inc.
+;; Copyright (C) 1985,1987,1992-2001 Free Software Foundation, Inc.
 
 ;; Author:     1995 Barry A. Warsaw
 ;; Maintainer: Unmaintained
 ;; GNU General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; along with this program; see the file COPYING.  If not, write to
+;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 ;; Boston, MA 02111-1307, USA.
 
 ;;; Commentary:
 ;; This will redefine certain cc-mode functions and affect all cc-mode
 ;; buffers globally.
 ;;
-;; This file is completely unsupported!  I have no idea whether this
-;; will work with such things as cc-mode-18.el.
+;; This file is completely unsupported!  Although it has been patched
+;; superficially to keep pace with the rest of CC Mode, it hasn't been
+;; tested for a long time.
 
 ;;; Code:
 
 (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)
+	 (if (and (boundp 'byte-compile-dest-file)
+		  (stringp byte-compile-dest-file))
+	     (cons (file-name-directory byte-compile-dest-file) load-path)
 	   load-path)))
-    (load "cc-defs" nil t)))
-(require 'cc-mode)
+    (require 'cc-bytecomp)))
+
+(cc-require 'cc-defs)
+(cc-require 'cc-engine)
+(cc-require 'cc-cmds)
 
 
 (defvar cc-lobotomy-pith-list ()
 	  (fset 'c-inside-bracelist-p 'cc-inside-bracelist-p-lobotomized)
 	  (setq pithedp t)))
     (if pithedp
-	(fset 'c-submit-bug-report 'cc-submit-bug-report-lobotomized))
+	(add-hook 'c-prepare-bug-report-hooks 'cc-lobo-bug-report-blurb))
     ))
 
 
 ;; cannot be the first non-whitespace on a line.
 (defun cc-in-literal-lobotomized (&optional lim)
   ;; first check the cache
-  (if (and (boundp 'c-in-literal-cache)
-	   c-in-literal-cache
+  (if (and (vectorp c-in-literal-cache)
 	   (= (point) (aref c-in-literal-cache 0)))
       (aref c-in-literal-cache 1)
     ;; quickly check for cpp macro. this breaks if the `#' character
 		 ((nth 4 state) (if (nth 7 state) 'c++ 'c))
 		 (t nil))))
       ;; cache this result if the cache is enabled
-      (and (boundp 'c-in-literal-cache)
-	   (setq c-in-literal-cache (vector (point) rtn)))
+      (if (not c-in-literal-cache)
+	  (setq c-in-literal-cache (vector (point) rtn)))
       rtn)))
 
 (defun cc-narrow-out-enclosing-class-lobotomized (dummy1 dummy2) nil)
 
 (defun cc-inside-bracelist-p-lobotomized (dummy1 dummy2) nil)
 
-(defun cc-submit-bug-report-lobotomized ()
-  "Submit via mail a bug report on cc-mode."
-  (interactive)
-  ;; load in reporter
-  (let ((reporter-prompt-for-summary-p t)
-	(reporter-dont-compact-list '(c-offsets-alist)))
-    (and
-     (y-or-n-p "Do you want to submit a report on cc-mode? ")
-     (require 'reporter)
-     (reporter-submit-bug-report
-      c-mode-help-address
-      (concat "cc-mode " c-version " ("
-	      (cond ((eq major-mode 'c++-mode)  "C++")
-		    ((eq major-mode 'c-mode)    "C")
-		    ((eq major-mode 'objc-mode) "ObjC"))
-	      ")")
-      (let ((vars (list
-		   ;; report only the vars that affect indentation
-		   'c-basic-offset
-		   'c-offsets-alist
-		   'c-block-comments-indent-p
-		   'c-cleanup-list
-		   'c-comment-only-line-offset
-		   'c-backslash-column
-		   'c-delete-function
-		   'c-electric-pound-behavior
-		   'c-hanging-braces-alist
-		   'c-hanging-colons-alist
-		   'c-hanging-comment-ender-p
-		   'c-tab-always-indent
-		   'c-recognize-knr-p
-		   'defun-prompt-regexp
-		   'tab-width
-		   )))
-	(if (not (boundp 'defun-prompt-regexp))
-	    (delq 'defun-prompt-regexp vars)
-	  vars))
-      (function
-       (lambda ()
-	 (insert
-	  (if c-special-indent-hook
-	      (concat "\n@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n"
-		      "c-special-indent-hook is set to '"
-		      (format "%s" c-special-indent-hook)
-		      ".\nPerhaps this is your problem?\n"
-		      "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n\n")
-	    "\n")
-	  (format "c-emacs-features: %s\n" c-emacs-features)
-	  )))
-      (function
-       (lambda ()
-	 (insert
-	  "You are using cc-lobotomy.el.  You realize that by doing\n"
-	  "so you have already made the decision to trade off accuracy\n"
-	  "for speed?  Don't set your hopes too high that your problem\n"
-	  "will be fixed.\n\n"
-	  )))
-      "Dear Barry,"
-      ))))
+(defun cc-lobo-bug-report-blurb ()
+  (insert
+   "\nYou are using cc-lobotomy.el.  You realize that by doing\n"
+   "so you have already made the decision to trade off accuracy\n"
+   "for speed?  Don't set your hopes too high that your problem\n"
+   "will be fixed.\n\n"))
 
-(provide 'cc-lobotomy)
+
+(cc-provide 'cc-lobotomy)
 ;;; cc-lobotomy.el ends here