From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Zoltan Kemenczy" Newsgroups: gmane.emacs.devel Subject: gud.el - jdb support update to work with updated cc-mode Date: Sat, 13 Sep 2003 20:07:27 -0400 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <000701c37a54$2ef1b5a0$0701a8c0@rim.net> References: <5b1xx0tx2l.fsf@lister.roxen.com><000501c34688$20902500$0701a8c0@rim.net> <5b4r1mp43w.fsf@lister.roxen.com> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1063498175 28378 80.91.224.253 (14 Sep 2003 00:09:35 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 14 Sep 2003 00:09:35 +0000 (UTC) Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Sun Sep 14 02:09:34 2003 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19yKSM-0000nO-00 for ; Sun, 14 Sep 2003 02:09:34 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 19yKUI-0003Zo-00 for ; Sun, 14 Sep 2003 02:11:34 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.22) id 19yKRJ-0002Qb-BV for emacs-devel@quimby.gnus.org; Sat, 13 Sep 2003 20:08:29 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.22) id 19yKQw-0002PS-Ux for emacs-devel@gnu.org; Sat, 13 Sep 2003 20:08:06 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.22) id 19yKQu-0002Mp-Sz for emacs-devel@gnu.org; Sat, 13 Sep 2003 20:08:05 -0400 Original-Received: from [199.232.41.8] (helo=mx20.gnu.org) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.22) id 19yKQu-0002MS-Ao for emacs-devel@gnu.org; Sat, 13 Sep 2003 20:08:04 -0400 Original-Received: from [66.185.86.71] (helo=fep01-mail.bloor.is.net.cable.rogers.com) by mx20.gnu.org with esmtp (Exim 4.22) id 19yKQL-0002zt-1O for emacs-devel@gnu.org; Sat, 13 Sep 2003 20:07:29 -0400 Original-Received: from zkemenczylt ([24.42.20.42]) by fep01-mail.bloor.is.net.cable.rogers.com (InterMail vM.5.01.05.12 201-253-122-126-112-20020820) with ESMTP id <20030914000718.YLYX83282.fep01-mail.bloor.is.net.cable.rogers.com@zkemenczylt> for ; Sat, 13 Sep 2003 20:07:18 -0400 Original-To: X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Authentication-Info: Submitted using SMTP AUTH LOGIN at fep01-mail.bloor.is.net.cable.rogers.com from [24.42.20.42] using ID at Sat, 13 Sep 2003 20:07:18 -0400 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:16385 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:16385 This patch is required to make gud-jdb work again since cc-mode changed the syntactic information... Regards, Zoltan Kemenczy diff -u ~/b/emacs/emacs/lisp/progmodes/gud.el ~/local/lisp-cvs/gud.el --- /zoltan/b/emacs/emacs/lisp/progmodes/gud.el Mon Sep 1 11:45:35 2003 +++ /zoltan/local/lisp-cvs/gud.el Sat Sep 13 19:48:53 2003 @@ -2536,11 +2536,11 @@ (setq pos (point)) (setq overlay-arrow-string "=>") (or overlay-arrow-position - (setq overlay-arrow-position (make-marker))) + (setq overlay-arrow-position (make-marker))) (set-marker overlay-arrow-position (point) (current-buffer))) (cond ((or (< pos (point-min)) (> pos (point-max))) - (widen) - (goto-char pos)))) + (widen) + (goto-char pos)))) (if window (set-window-point window overlay-arrow-position)))))) ;; The gud-call function must do the right thing whether its invoking @@ -2817,8 +2817,13 @@ (save-match-data (let ((cplist (append gud-jdb-sourcepath gud-jdb-classpath)) (fbuffer (get-file-buffer f)) - class-found) + syntax-symbol syntax-point class-found) (setq f (file-name-sans-extension (file-truename f))) + ;; Syntax-symbol returns the symbol of the *first* element + ;; in the syntactical analysis result list, syntax-point + ;; returns the buffer position of same + (fset 'syntax-symbol (lambda (x) (c-langelem-sym (car x)))) + (fset 'syntax-point (lambda (x) (c-langelem-pos (car x)))) ;; Search through classpath list for an entry that is ;; contained in f (while (and cplist (not class-found)) @@ -2841,17 +2846,17 @@ ;; with the 'topmost-intro symbol, there may be ;; nested classes... (while (not (eq 'topmost-intro - (car (car (c-guess-basic-syntax))))) + (syntax-symbol (c-guess-basic-syntax)))) ;; Check if the current position c-syntactic ;; analysis has 'inclass (setq syntax (c-guess-basic-syntax)) (while - (and (not (eq 'inclass (car (car syntax)))) + (and (not (eq 'inclass (syntax-symbol syntax))) (cdr syntax)) (setq syntax (cdr syntax))) - (if (eq 'inclass (car (car syntax))) + (if (eq 'inclass (syntax-symbol syntax)) (progn - (goto-char (cdr (car syntax))) + (goto-char (syntax-point syntax)) ;; Now we're at the beginning of a class ;; definition. Find class name (looking-at @@ -2860,9 +2865,9 @@ (append (list (match-string-no-properties 1)) nclass))) (setq syntax (c-guess-basic-syntax)) - (while (and (not (cdr (car syntax))) (cdr syntax)) + (while (and (not (syntax-point syntax)) (cdr syntax)) (setq syntax (cdr syntax))) - (goto-char (cdr (car syntax))) + (goto-char (syntax-point syntax)) )) (string-match (concat (car nclass) "$") class-found) (setq class-found ----- Original Message ----- From: "Martin Stjernholm" To: "Zoltan Kemenczy" Cc: ; ; ; Sent: Wednesday, July 16, 2003 5:13 PM Subject: Re: [kemenczy@rogers.com: cc-engine:c-guess-basic-syntax related problem in latest CVS] > "Zoltan Kemenczy" wrote: > > > Getting syntax information on write-protected C++ buffers does work now... > > (however, visiting a .java file now doesn't load java-mode?? :-( . > > Perhaps you haven't updated your loaddefs.el file lately? > > > Two "predicates" (there must be a better term for "getAttribute" > > type methods?) > > I call them accessor functions. > > > I found useful to define (inside gud-find-class as local symbols) > > are: > > > > (fset 'syntax-symbol (lambda (x) (car (car x)))) ; symbol of first > > syntactic element > > (fset 'syntax-point (lambda (x) (car (cdr (car x))))) ; point (integer) of > > first syntactic element > > I find it more generic to make accessor functions for a single > syntactic element and then treat the syntactic context as a normal > list of them (i.e. no use defining accessors for the list itself). > There are many cases where single elements are handled. > > /.../ > > It's just common sense to have such predicates with the "objects", > > so if you agree, redesign/name them for cc-engine, and I'll patch > > gud-jdb accordingly... > > I've now added c-langelem-sym, c-langelem-pos, and c-langelem-2nd-pos > (which makes use of the new extended information in some syntactic > elements). (The naming scheme stems from the already existing > c-langelem-col.)