all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* default-text-properties
@ 2004-05-20  1:33 Luc Teirlinck
  2004-05-20  3:01 ` default-text-properties Luc Teirlinck
  0 siblings, 1 reply; 7+ messages in thread
From: Luc Teirlinck @ 2004-05-20  1:33 UTC (permalink / raw)


I did:

emacs-21.3.50 -q --eval "(blink-cursor-mode 0)"

Execute the following example from (elisp)Examining Properties:

(setq default-text-properties '(foo 69)
                char-property-alias-alist nil)
nil
(set-text-properties 1 2 nil)
t
(get-text-property 1 'foo)
nil

in the *scratch* buffer, or apparently any other buffer.

The last value should not have been nil, but 69.  It was 69 in CVS
from, I believe, less than two days ago.  I have read through the code
of Fget_text_property and the functions it calls.  That code should
result in a return value of 69.  From checking on Savannah, no changes
to any of that code occurred since a few days ago, when it _did_
return 69.  Complete mystery to me.  Did anybody  make changes recently
that could explain this?

Sincerely,

Luc.

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

* Re: default-text-properties
  2004-05-20  1:33 default-text-properties Luc Teirlinck
@ 2004-05-20  3:01 ` Luc Teirlinck
  2004-05-20  3:12   ` default-text-properties Luc Teirlinck
  2004-05-20 13:17   ` default-text-properties Richard Stallman
  0 siblings, 2 replies; 7+ messages in thread
From: Luc Teirlinck @ 2004-05-20  3:01 UTC (permalink / raw)
  Cc: emacs-devel

I understand now.  I did not read the code carefully enough and I
forgot to remember something extra I did yesterday.

Fget_text_property calls `textget' which calls `lookup_char_property'
which contains the code:

  tail = Fassq (prop, Vchar_property_alias_alist);
  if (NILP (tail))
    return tail;

In other words, default-text-properties is only consulted for foo if
char-property-alias-alist contains foo as a key.  Hence:

(setq default-text-properties '(foo 69)
                char-property-alias-alist nil)
nil
(set-text-properties 1 2 nil)
t
(get-text-property 1 'foo)
nil

But (I must have done something like this yesterday):

(setq default-text-properties '(foo 69)
                char-property-alias-alist '((foo bar)))
((foo bar))
(set-text-properties 1 2 nil)
t
(get-text-property 1 'foo)
69

Completely undocumented (actually explicitly contradicted with the
above example) in the Elisp manual and the relevant docstrings.  I
suspect this is a bug.  If so, it is trivial to fix.  If intentional,
it should be properly documented.

Sincerely,

Luc.

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

* Re: default-text-properties
  2004-05-20  3:01 ` default-text-properties Luc Teirlinck
@ 2004-05-20  3:12   ` Luc Teirlinck
  2004-05-20  3:20     ` default-text-properties Luc Teirlinck
  2004-05-20 13:17     ` default-text-properties Richard Stallman
  2004-05-20 13:17   ` default-text-properties Richard Stallman
  1 sibling, 2 replies; 7+ messages in thread
From: Luc Teirlinck @ 2004-05-20  3:12 UTC (permalink / raw)
  Cc: emacs-devel

Maybe yet another problem with default-text-properties, illustrated
with the following ielm run:

*** Welcome to IELM ***  Type (describe-mode) for help.
ELISP> (set-buffer "*scratch*")
#<buffer *scratch*>
ELISP> (setq default-text-properties '(foo 69))
(foo 69)

ELISP> (setq char-property-alias-alist '((foo bar)))
((foo bar))

ELISP> (get-text-property (point-max) 'foo)
69
ELISP> 

This contradicts the last line of get-text-property's docstring:

    get-text-property is a built-in function in `C source code'.
    (get-text-property position prop &optional object)

    Return the value of position's property prop, in object.
    object is optional and defaults to the current buffer.
    If position is at the end of object, the value is nil.

I suspect again that this is a bug.  If it is intentional, the
documentation should be fixed.  I could take care of both bugs(?) I
reported, but I first want to make completely sure that they are
really bugs and not, for some strange reason, intentional.

Sincerely,

Luc.

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

* Re: default-text-properties
  2004-05-20  3:12   ` default-text-properties Luc Teirlinck
@ 2004-05-20  3:20     ` Luc Teirlinck
  2004-05-20 13:17     ` default-text-properties Richard Stallman
  1 sibling, 0 replies; 7+ messages in thread
From: Luc Teirlinck @ 2004-05-20  3:20 UTC (permalink / raw)
  Cc: emacs-devel

Maybe an extended version of the ielm run of my previous message
showing the same problem for a string, where things might be more
obvious:

*** Welcome to IELM ***  Type (describe-mode) for help.
ELISP> (set-buffer "*scratch*")
#<buffer *scratch*>
ELISP> (setq default-text-properties '(foo 69))
(foo 69)

ELISP> (setq char-property-alias-alist '((foo bar)))
((foo bar))

ELISP> (get-text-property (point-max) 'foo)
69  ;; I believe this should be nil: end of object.
ELISP> (setq str "01")
"01"
ELISP> (get-text-property 2 'foo str)
69  ;; I believe this should be nil: end of object.
ELISP>

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

* Re: default-text-properties
  2004-05-20  3:01 ` default-text-properties Luc Teirlinck
  2004-05-20  3:12   ` default-text-properties Luc Teirlinck
@ 2004-05-20 13:17   ` Richard Stallman
  2004-05-20 17:40     ` default-text-properties Luc Teirlinck
  1 sibling, 1 reply; 7+ messages in thread
From: Richard Stallman @ 2004-05-20 13:17 UTC (permalink / raw)
  Cc: teirllm, emacs-devel

    In other words, default-text-properties is only consulted for foo if
    char-property-alias-alist contains foo as a key.  Hence:

    Completely undocumented (actually explicitly contradicted with the
    above example) in the Elisp manual and the relevant docstrings.  I
    suspect this is a bug.  If so, it is trivial to fix.

It is a bug; would you please fix it?

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

* Re: default-text-properties
  2004-05-20  3:12   ` default-text-properties Luc Teirlinck
  2004-05-20  3:20     ` default-text-properties Luc Teirlinck
@ 2004-05-20 13:17     ` Richard Stallman
  1 sibling, 0 replies; 7+ messages in thread
From: Richard Stallman @ 2004-05-20 13:17 UTC (permalink / raw)
  Cc: teirllm, emacs-devel

    ELISP> (setq default-text-properties '(foo 69))
    (foo 69)

    ELISP> (setq char-property-alias-alist '((foo bar)))
    ((foo bar))

    ELISP> (get-text-property (point-max) 'foo)
    69

I think that is a bug, but I am not entirely sure
what is correct in a case like this.

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

* Re: default-text-properties
  2004-05-20 13:17   ` default-text-properties Richard Stallman
@ 2004-05-20 17:40     ` Luc Teirlinck
  0 siblings, 0 replies; 7+ messages in thread
From: Luc Teirlinck @ 2004-05-20 17:40 UTC (permalink / raw)
  Cc: emacs-devel

Richard Stallman wrote:

       In other words, default-text-properties is only consulted for foo if
       char-property-alias-alist contains foo as a key.  Hence:

       Completely undocumented (actually explicitly contradicted with the
       above example) in the Elisp manual and the relevant docstrings.  I
       suspect this is a bug.  If so, it is trivial to fix.

   It is a bug; would you please fix it?

Done.

Sincerely,

Luc.

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

end of thread, other threads:[~2004-05-20 17:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-05-20  1:33 default-text-properties Luc Teirlinck
2004-05-20  3:01 ` default-text-properties Luc Teirlinck
2004-05-20  3:12   ` default-text-properties Luc Teirlinck
2004-05-20  3:20     ` default-text-properties Luc Teirlinck
2004-05-20 13:17     ` default-text-properties Richard Stallman
2004-05-20 13:17   ` default-text-properties Richard Stallman
2004-05-20 17:40     ` default-text-properties Luc Teirlinck

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.