unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* text.texi - `buffer-substring'
@ 2006-06-23  6:47 Andreas Roehler
  2006-06-23  6:47 ` Miles Bader
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Andreas Roehler @ 2006-06-23  6:47 UTC (permalink / raw
  Cc: Richard Stallman

Evaluation of the given example to `buffer-substring'
produces a different result as shown in the manual.

Whereas the manual demonstrates

          ---------- Buffer: foo ----------
          This is the contents of buffer foo

          ---------- Buffer: foo ----------

          (buffer-substring 1 10)
               => "This is t"

I get

(buffer-substring 1 10)#("This is t" 0 1 (fontified t) 1 9 (fontified t))

ie text-properties are copied as a kind of comment
behind, not solely `along' as the info says. (Reading
the info I would understand, that the chars copied into
the returned string are propertized as the original
one, as it seems the case altogether.)

The mentioned copying effects eventually following procedures.

(setq baz (buffer-substring 1 10))

baz --> #("This is t" 0 1 (fontified t) 1 9 (fontified t))

Maybe it's a `buffer-substring' bug ?

__
Andreas Roehler

;;;;;;;;;;;;;

GNU Emacs 22.0.50.2 (i686-pc-linux-gnu, X toolkit, Xaw3d scroll bars) of 
2006-06-18

X server distributor `The X.Org Foundation', version 11.0.60802000
Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: de_DE.UTF-8
  locale-coding-system: utf-8
  default-enable-multibyte-characters: t

Major mode: Emacs-Lisp

Minor modes in effect:
  icicle-mode: t
  global-hi-lock-mode: t
  hi-lock-mode: t
  auto-image-file-mode: t
  iswitchb-mode: t
  recentf-mode: t
  show-paren-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  unify-8859-on-encoding-mode: t
  utf-translate-cjk-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t
  abbrev-mode: t
;;;;;;;

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

* Re: text.texi - `buffer-substring'
  2006-06-23  6:47 text.texi - `buffer-substring' Andreas Roehler
@ 2006-06-23  6:47 ` Miles Bader
  2006-06-23  7:18   ` Andreas Roehler
  2006-06-23  7:50 ` Eli Zaretskii
  2006-06-24  8:31 ` Richard Stallman
  2 siblings, 1 reply; 5+ messages in thread
From: Miles Bader @ 2006-06-23  6:47 UTC (permalink / raw
  Cc: Richard Stallman, emacs-devel

Andreas Roehler <andreas.roehler@online.de> writes:
> (buffer-substring 1 10)#("This is t" 0 1 (fontified t) 1 9 (fontified t))
>
> ie text-properties are copied as a kind of comment
> behind, not solely `along' as the info says. (Reading
> the info I would understand, that the chars copied into
> the returned string are propertized as the original
> one, as it seems the case altogether.)

No, you are still confusing the _printed representation_ of the return
value of buffer-substring with the actual return value.

Try this:

  (type-of (buffer-substring 1 10))

It returns `string', showing that the return value of buffer-substring
is really a string.

-Miles
-- 
`...the Soviet Union was sliding in to an economic collapse so comprehensive
 that in the end its factories produced not goods but bads: finished products
 less valuable than the raw materials they were made from.'  [The Economist]

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

* Re: text.texi - `buffer-substring'
  2006-06-23  6:47 ` Miles Bader
@ 2006-06-23  7:18   ` Andreas Roehler
  0 siblings, 0 replies; 5+ messages in thread
From: Andreas Roehler @ 2006-06-23  7:18 UTC (permalink / raw
  Cc: Richard Stallman, emacs-devel

Miles Bader schrieb:
> Andreas Roehler <andreas.roehler@online.de> writes:
>> (buffer-substring 1 10)#("This is t" 0 1 (fontified t) 1 9 (fontified t))
>>
>> ie text-properties are copied as a kind of comment
>> behind, not solely `along' as the info says. (Reading
>> the info I would understand, that the chars copied into
>> the returned string are propertized as the original
>> one, as it seems the case altogether.)
>
> No, you are still confusing the _printed representation_ of the return
> value of buffer-substring with the actual return value.
>
> Try this:
>
>   (type-of (buffer-substring 1 10))
>
> It returns `string', showing that the return value of buffer-substring
> is really a string.
>
> -Miles
Sorry, thanks.

__
Andreas Roehler

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

* Re: text.texi - `buffer-substring'
  2006-06-23  6:47 text.texi - `buffer-substring' Andreas Roehler
  2006-06-23  6:47 ` Miles Bader
@ 2006-06-23  7:50 ` Eli Zaretskii
  2006-06-24  8:31 ` Richard Stallman
  2 siblings, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2006-06-23  7:50 UTC (permalink / raw
  Cc: rms, emacs-devel

> Date: Fri, 23 Jun 2006 08:47:06 +0200
> From: Andreas Roehler <andreas.roehler@online.de>
> Cc: Richard Stallman <rms@gnu.org>
> 
> Evaluation of the given example to `buffer-substring'
> produces a different result as shown in the manual.
> 
> Whereas the manual demonstrates
> 
>           ---------- Buffer: foo ----------
>           This is the contents of buffer foo
> 
>           ---------- Buffer: foo ----------
> 
>           (buffer-substring 1 10)
>                => "This is t"
> 
> I get
> 
> (buffer-substring 1 10)#("This is t" 0 1 (fontified t) 1 9 (fontified t))

I cannot reproduce this.  If the buffer `foo' is in Fundamental mode,
I get precisely what the manual says.

Your output suggests that the buffer with the text has font-lock
turned on.  Please see how could that happen in Fundamental mode.

> ie text-properties are copied as a kind of comment
> behind, not solely `along' as the info says.

That is normal behavior.

> (setq baz (buffer-substring 1 10))
> 
> baz --> #("This is t" 0 1 (fontified t) 1 9 (fontified t))
> 
> Maybe it's a `buffer-substring' bug ?

No, it's expected behavior when the buffer was fontified.

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

* Re: text.texi - `buffer-substring'
  2006-06-23  6:47 text.texi - `buffer-substring' Andreas Roehler
  2006-06-23  6:47 ` Miles Bader
  2006-06-23  7:50 ` Eli Zaretskii
@ 2006-06-24  8:31 ` Richard Stallman
  2 siblings, 0 replies; 5+ messages in thread
From: Richard Stallman @ 2006-06-24  8:31 UTC (permalink / raw
  Cc: emacs-devel

    I get

    (buffer-substring 1 10)#("This is t" 0 1 (fontified t) 1 9 (fontified t))

    ie text-properties are copied as a kind of comment
    behind, not solely `along' as the info says.

The text properties ARE copied along into thye string, and that is how
such a string looks when you print it.

I will clarify that.

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

end of thread, other threads:[~2006-06-24  8:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-23  6:47 text.texi - `buffer-substring' Andreas Roehler
2006-06-23  6:47 ` Miles Bader
2006-06-23  7:18   ` Andreas Roehler
2006-06-23  7:50 ` Eli Zaretskii
2006-06-24  8:31 ` Richard Stallman

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