unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* Dot at start of symbols confuses edebug
@ 2004-10-29 23:57 Johan Bockgård
  2004-10-30  1:11 ` Juri Linkov
  0 siblings, 1 reply; 4+ messages in thread
From: Johan Bockgård @ 2004-10-29 23:57 UTC (permalink / raw)



(let (.foo ) .foo)
C-u C-M-x =>
  edebug-syntax-error: Invalid read syntax: "Dotted spec required."


(let (.foo) (ignore 0 .foo))
C-u C-M-x =>
  Debugger entered--Lisp error: (wrong-type-argument
    number-or-marker-p ((16924 . 16927) . 16928))
    edebug-inc-offset(((16924 . 16927) . 16928))
    edebug-form((((ignore 0 . foo)) (16913 (16914 . 16920) (16921 .
    16922) (16924 . 16927) . 16928) . 16929))


(defun .foo (n))
C-u C-M-x =>
  Debugger entered--Lisp error: (invalid-read-syntax "Expected `)'")
    signal(invalid-read-syntax ("Expected `)'"))
    edebug-syntax-error("Expected `)'")

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

* Re: Dot at start of symbols confuses edebug
  2004-10-29 23:57 Dot at start of symbols confuses edebug Johan Bockgård
@ 2004-10-30  1:11 ` Juri Linkov
  2004-10-30 14:20   ` Richard Stallman
  0 siblings, 1 reply; 4+ messages in thread
From: Juri Linkov @ 2004-10-30  1:11 UTC (permalink / raw)


bojohan+news@dd.chalmers.se (Johan Bockgård) writes:
> (let (.foo ) .foo)
> C-u C-M-x =>
>   edebug-syntax-error: Invalid read syntax: "Dotted spec required."
>
> (let (.foo) (ignore 0 .foo))
> C-u C-M-x =>
>   Debugger entered--Lisp error: (wrong-type-argument
>     number-or-marker-p ((16924 . 16927) . 16928))
>     edebug-inc-offset(((16924 . 16927) . 16928))
>     edebug-form((((ignore 0 . foo)) (16913 (16914 . 16920) (16921 .
>     16922) (16924 . 16927) . 16928) . 16929))
>
> (defun .foo (n))
> C-u C-M-x =>
>   Debugger entered--Lisp error: (invalid-read-syntax "Expected `)'")
>     signal(invalid-read-syntax ("Expected `)'"))
>     edebug-syntax-error("Expected `)'")

It seems there is no simple fix to support unusual variable names
in edebug.  However, if you need dots in variable names you can
add \ before dots:

(let (\.foo ) \.foo)
(let (\.foo) (ignore 0 \.foo))
(defun \.foo (n))

and C-u C-M-x works fine.

-- 
Juri Linkov
http://www.jurta.org/emacs/

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

* Re: Dot at start of symbols confuses edebug
  2004-10-30  1:11 ` Juri Linkov
@ 2004-10-30 14:20   ` Richard Stallman
  2004-10-30 23:02     ` Juri Linkov
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Stallman @ 2004-10-30 14:20 UTC (permalink / raw)
  Cc: bug-gnu-emacs

    It seems there is no simple fix to support unusual variable names
    in edebug.

What is the difficulty?  Is it related to the way edebug inserts
periods?

Judging from the manual, edebug never adds a period before a symbol.
So it could treat a period before a symbol as part of the name,
without any trouble.  However, that leaves the question of
handling dots in symbols that are not at the start.

      However, if you need dots in variable names you can
    add \ before dots:

Maybe edebug could add slashes along with dots, as needed
to avoid ambiguity, and it could remove them when it removes
the dots.  Would this work?

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

* Re: Dot at start of symbols confuses edebug
  2004-10-30 14:20   ` Richard Stallman
@ 2004-10-30 23:02     ` Juri Linkov
  0 siblings, 0 replies; 4+ messages in thread
From: Juri Linkov @ 2004-10-30 23:02 UTC (permalink / raw)
  Cc: bug-gnu-emacs

Richard Stallman <rms@gnu.org> writes:
>     It seems there is no simple fix to support unusual variable names
>     in edebug.
>
> What is the difficulty?  Is it related to the way edebug inserts
> periods?

OK, I looked a little more and have found a simple fix.

The source of the problem is the function `edebug-next-token-class'
which assumes that the leading dot can start a symbol only if it is
followed by the digits.  That is wrong.  The dot can start a symbol
if it followed by all characters which can be part of the symbol:

Index: lisp/emacs-lisp/edebug.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/emacs-lisp/edebug.el,v
retrieving revision 3.69
diff -u -r3.69 edebug.el
--- lisp/emacs-lisp/edebug.el	10 Jun 2004 04:18:04 -0000	3.69
+++ lisp/emacs-lisp/edebug.el	30 Oct 2004 23:17:49 -0000
@@ -714,8 +714,10 @@
   (if (and (eq (following-char) ?.)
 	   (save-excursion
 	     (forward-char 1)
-	     (and (>= (following-char) ?0)
-		  (<= (following-char) ?9))))
+	     (or (and (eq (aref edebug-read-syntax-table (following-char))
+			  'symbol)
+		      (not (= (following-char) ?\;)))
+		 (memq (following-char) '(?\, ?\.)))))
       'symbol
     (aref edebug-read-syntax-table (following-char))))

-- 
Juri Linkov
http://www.jurta.org/emacs/

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

end of thread, other threads:[~2004-10-30 23:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-10-29 23:57 Dot at start of symbols confuses edebug Johan Bockgård
2004-10-30  1:11 ` Juri Linkov
2004-10-30 14:20   ` Richard Stallman
2004-10-30 23:02     ` Juri Linkov

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).