all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: emacs-devel <emacs-devel@gnu.org>
Subject: Bug in hide-ifdef-mode
Date: Sat, 19 Jan 2008 17:51:24 +0100	[thread overview]
Message-ID: <47922A8C.6040007@gmx.at> (raw)

[-- Attachment #1: Type: text/plain, Size: 1204 bytes --]

To reproduce with Emacs -Q: Open src/data.c and do M-x hide-ifdef-mode.

Should get you something like:

Debugger entered--Lisp error: (error "Bad token in parenthesized expression: 125")
   signal(error ("Bad token in parenthesized expression: 125"))
   error("Bad token in parenthesized expression: %s" 125)
   hif-factor()
   hif-math()
   hif-eq-expr()
   hif-and-expr()
   hif-or-expr()
   hif-expr()
   hif-parse-if-exp((lparen FLT_RADIX equal 2 and FLT_MANT_DIG equal 24 and FLT_MIN_EXP equal hif-minus 125 and FLT_MAX_EXP equal 128 rparen))
   hif-canonicalize()
   hif-possibly-hide()
   hide-ifdef-guts()
   hif-recurse-on(1351 1547)
   hif-possibly-hide()
   hide-ifdef-guts()
   hide-ifdefs()
   hide-ifdef-mode(toggle)
   call-interactively(hide-ifdef-mode)
   execute-extended-command(nil)
   call-interactively(execute-extended-command)

The bug occurs when `hif-factor' tries to parse the unary minus in:

#if (FLT_RADIX == 2 && FLT_MANT_DIG == 24 \
      && FLT_MIN_EXP == -125 && FLT_MAX_EXP == 128)

The attached, somewhat naive, patch fixes the bug for me.  Could someone
who uses `hide-ifdef-mode' on a regular basis check whether that fix
breaks something else.  Thanks in advance.

[-- Attachment #2: hideif.patch --]
[-- Type: text/plain, Size: 556 bytes --]

*** progmodes/hideif.el	Sat Jan 19 14:53:52 2008
--- progmodes/hideif.el	Sat Jan 19 17:16:20 2008
***************
*** 473,478 ****
--- 473,486 ----
     ((numberp hif-token)
      (prog1 hif-token (hif-nexttoken)))
  
+    ((memq hif-token '(hif-minus hif-plus))
+     (let (result math-op)
+       (while (memq hif-token '(hif-plus hif-minus))
+ 	(setq math-op hif-token)
+ 	(hif-nexttoken)
+ 	(setq result (list math-op result (hif-factor))))
+       result))
+ 
     (t					; identifier
      (let ((ident hif-token))
        (if (memq ident '(or and))

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

                 reply	other threads:[~2008-01-19 16:51 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47922A8C.6040007@gmx.at \
    --to=rudalics@gmx.at \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.