unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* gud.el - jdb support update to work with updated cc-mode
  2003-07-16 21:13     ` Martin Stjernholm
@ 2003-09-14  0:07       ` Zoltan Kemenczy
  0 siblings, 0 replies; 3+ messages in thread
From: Zoltan Kemenczy @ 2003-09-14  0:07 UTC (permalink / raw)


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" <mast@lysator.liu.se>
To: "Zoltan Kemenczy" <zoltan@ieee.org>
Cc: <bug-cc-mode@gnu.org>; <emacs-devel@gnu.org>; <monnier@cs.yale.edu>;
<rms@gnu.org>
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" <kemenczy@rogers.com> 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.)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: gud.el - jdb support update to work with updated cc-mode
@ 2003-09-14  0:14 Zoltan Kemenczy
  2003-09-15 19:13 ` Nick Roberts
  0 siblings, 1 reply; 3+ messages in thread
From: Zoltan Kemenczy @ 2003-09-14  0:14 UTC (permalink / raw)


This is a smaller patch and more correct since it ignores whitespace
differences relative to gud.el in CVS
My apologies...
Regards, Zoltan

diff -w -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
@@ -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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: gud.el - jdb support update to work with updated cc-mode
  2003-09-14  0:14 gud.el - jdb support update to work with updated cc-mode Zoltan Kemenczy
@ 2003-09-15 19:13 ` Nick Roberts
  0 siblings, 0 replies; 3+ messages in thread
From: Nick Roberts @ 2003-09-15 19:13 UTC (permalink / raw)
  Cc: emacs-devel


 > This is a smaller patch and more correct since it ignores whitespace
 > differences relative to gud.el in CVS

Committed to the repository.

Nick

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-09-15 19:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-09-14  0:14 gud.el - jdb support update to work with updated cc-mode Zoltan Kemenczy
2003-09-15 19:13 ` Nick Roberts
     [not found] <E19ZyfW-0006ae-4m@fencepost.gnu.org>
2003-07-08 23:31 ` [kemenczy@rogers.com: cc-engine:c-guess-basic-syntax related problem in latest CVS] Martin Stjernholm
2003-07-10  2:08   ` Zoltan Kemenczy
2003-07-16 21:13     ` Martin Stjernholm
2003-09-14  0:07       ` gud.el - jdb support update to work with updated cc-mode Zoltan Kemenczy

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).