unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#9514: 24.0.50; eval + format weirdness
@ 2011-09-15 14:11 Wolfgang Jenkner
  2011-09-15 16:14 ` Paul Eggert
  0 siblings, 1 reply; 7+ messages in thread
From: Wolfgang Jenkner @ 2011-09-15 14:11 UTC (permalink / raw)
  To: 9514; +Cc: eggert

The form

(let* ((string (with-temp-buffer (insert "%%b") (buffer-string)))
       (form `(format ,string)))
  (list form
	(eval form)))

evaluates to

((format "%%b") "%bb")

but it should evaluate to

((format "%%b") "%b")

Note that bzr trunk rev. 104389 gives the correct result whereas
rev. 104390 gives the wrong result.

In GNU Emacs 24.0.50.1 (amd64-unknown-freebsd8.2, GTK+ Version 2.24.6)
 of 2011-09-13 on iznogoud.viz
Windowing system distributor `The X.Org Foundation', version 11.0.10707000
configured using `configure  'CC=gcc46' '--without-gsettings''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: en_US.UTF-8
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: nil
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t





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

* bug#9514: 24.0.50; eval + format weirdness
  2011-09-15 14:11 bug#9514: 24.0.50; eval + format weirdness Wolfgang Jenkner
@ 2011-09-15 16:14 ` Paul Eggert
  2011-09-15 16:18   ` Andreas Schwab
  0 siblings, 1 reply; 7+ messages in thread
From: Paul Eggert @ 2011-09-15 16:14 UTC (permalink / raw)
  To: Wolfgang Jenkner; +Cc: 9514-done

Thanks for reporting that.
I fixed it in the trunk (bzr 105786).





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

* bug#9514: 24.0.50; eval + format weirdness
  2011-09-15 16:14 ` Paul Eggert
@ 2011-09-15 16:18   ` Andreas Schwab
  2011-09-15 17:24     ` Wolfgang Jenkner
  0 siblings, 1 reply; 7+ messages in thread
From: Andreas Schwab @ 2011-09-15 16:18 UTC (permalink / raw)
  To: 9514; +Cc: eggert

Except that this has nothing to do with eval.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."





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

* bug#9514: 24.0.50; eval + format weirdness
  2011-09-15 16:18   ` Andreas Schwab
@ 2011-09-15 17:24     ` Wolfgang Jenkner
  2011-09-15 18:15       ` Paul Eggert
  2011-09-16  7:53       ` Andreas Schwab
  0 siblings, 2 replies; 7+ messages in thread
From: Wolfgang Jenkner @ 2011-09-15 17:24 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: 9514, eggert

Andreas Schwab <schwab@linux-m68k.org> writes:

> Except that this has nothing to do with eval.

Nor with most anything else in my example...

So a better bug report would have been

Subject: format barfs on certain strings

For example,

(format "%%é")

evaluates to garbage.

However, the paradoxical thing was rather

(let* ((string1 "%%b")
       (string2 (with-temp-buffer (insert string1) (buffer-string))))
  (list (string-equal string1 string2)
	(format string1)
	(format string2)))

=> (t "%b" "%bb")

as it wouldn't have easily occurred to me that string1 and string2 can
have different representations on the C level, which format treats
differently (though this shouldn't show ;-)

Wolfgang






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

* bug#9514: 24.0.50; eval + format weirdness
  2011-09-15 17:24     ` Wolfgang Jenkner
@ 2011-09-15 18:15       ` Paul Eggert
  2011-09-16  8:06         ` Andreas Schwab
  2011-09-16  7:53       ` Andreas Schwab
  1 sibling, 1 reply; 7+ messages in thread
From: Paul Eggert @ 2011-09-15 18:15 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Wolfgang Jenkner, 9514

Andreas Schwab <schwab@linux-m68k.org> writes:
> Except that this has nothing to do with eval.

True; I fixed the ChangeLog entry to not mention eval.

The patch you just installed for text properties (bzr 105788)
causes (format "%4000s%%" "") to fail with
(error "Format string ends in middle of format specifier"),
and it causes (length (format "%%")) to incorrectly return 2.
I fixed those two problems in a further patch (bzr 105791);
I hope this also fixes the text-property issue.





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

* bug#9514: 24.0.50; eval + format weirdness
  2011-09-15 17:24     ` Wolfgang Jenkner
  2011-09-15 18:15       ` Paul Eggert
@ 2011-09-16  7:53       ` Andreas Schwab
  1 sibling, 0 replies; 7+ messages in thread
From: Andreas Schwab @ 2011-09-16  7:53 UTC (permalink / raw)
  To: Wolfgang Jenkner; +Cc: 9514, eggert

The only issue was the mishandling of %% in a multibyte format string,
like this:

(format (string-to-multibyte "%%foo"))

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."





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

* bug#9514: 24.0.50; eval + format weirdness
  2011-09-15 18:15       ` Paul Eggert
@ 2011-09-16  8:06         ` Andreas Schwab
  0 siblings, 0 replies; 7+ messages in thread
From: Andreas Schwab @ 2011-09-16  8:06 UTC (permalink / raw)
  To: Paul Eggert; +Cc: Wolfgang Jenkner, 9514

Paul Eggert <eggert@cs.ucla.edu> writes:

> The patch you just installed for text properties (bzr 105788)
> causes (format "%4000s%%" "") to fail with
> (error "Format string ends in middle of format specifier"),
> and it causes (length (format "%%")) to incorrectly return 2.
> I fixed those two problems in a further patch (bzr 105791);
> I hope this also fixes the text-property issue.

Thanks, looks good.  For reference, here's a testcase for the
text-property issue:

(let ((s (string-to-multibyte "%%%%foo")))
  (add-text-properties 2 7 '(foo t) s)
  (format s))

Before my patch it returned #("%%foo" 0 5 (foo t)).

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."





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

end of thread, other threads:[~2011-09-16  8:06 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-15 14:11 bug#9514: 24.0.50; eval + format weirdness Wolfgang Jenkner
2011-09-15 16:14 ` Paul Eggert
2011-09-15 16:18   ` Andreas Schwab
2011-09-15 17:24     ` Wolfgang Jenkner
2011-09-15 18:15       ` Paul Eggert
2011-09-16  8:06         ` Andreas Schwab
2011-09-16  7:53       ` Andreas Schwab

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