all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* problem with text properties whose names aren't symbols
@ 2005-12-12  2:49 Joe Corneli
  2005-12-12 11:04 ` Andreas Schwab
  0 siblings, 1 reply; 3+ messages in thread
From: Joe Corneli @ 2005-12-12  2:49 UTC (permalink / raw)


>From the elisp manual (node: Text Properties):

   Each property has a name and a value.  Both of these
   can be any Lisp object, but the name is normally a symbol.

Well, it seems that when the Lisp object is not a symbol,
there is a problem.  This is illustrated by evaluating
the following form interactively:

(progn
  (put-text-property (point) (1+ (point)) 
                     '(example name)
                      t)
  (put-text-property (point) (1+ (point)) 
                     '(example name)
                      nil)
  (text-properties-at (point)))

If emacs crashed, and you have the emacs process in the gdb debugger,
please include the output from the following gdb commands:
    `bt full' and `xbacktrace'.
If you would like to further debug the crash, please read the file
/Users/jcorneli/emacs/etc/DEBUG for instructions.


In GNU Emacs 22.0.50 (powerpc-apple-darwin7.2.0, X toolkit)
 of 2005-12-11 on Joseph-Cornelis-Computer.local
X server distributor `The XFree86 Project, Inc', version 11.0.40400000
configured using `configure '--without-carbon' '-with-x' '--with-jpeg''

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: nil
  locale-coding-system: nil
  default-enable-multibyte-characters: t

Major mode: Fundamental

Minor modes in effect:
  show-paren-mode: t
  tooltip-mode: t
  auto-compression-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  unify-8859-on-encoding-mode: t
  utf-translate-cjk-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
C-x C-f <M-backspace> e m <tab> - b <tab> <return> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <C-right> 
C-x C-e C-SPC <C-left> M-w M-x r e p o r <tab> <re
turn>

Recent messages:
Loading joes_basic_bindings (source)...
Loading edmacro...done
Loading joes_basic_bindings (source)...done
Loading joes_special_bindings (source)...done
Loading joes_mail2 (source)...done
Loading joes_parens (source)...done
For information about the GNU Project and its goals, type C-h C-p.
((example name) nil (example name) t)
Mark set
Loading emacsbug...done

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

* Re: problem with text properties whose names aren't symbols
  2005-12-12  2:49 problem with text properties whose names aren't symbols Joe Corneli
@ 2005-12-12 11:04 ` Andreas Schwab
  2005-12-12 16:48   ` Joe Corneli
  0 siblings, 1 reply; 3+ messages in thread
From: Andreas Schwab @ 2005-12-12 11:04 UTC (permalink / raw)
  Cc: bug-gnu-emacs

Joe Corneli <jcorneli@planetmath.org> writes:

>>From the elisp manual (node: Text Properties):
>
>    Each property has a name and a value.  Both of these
>    can be any Lisp object, but the name is normally a symbol.
>
> Well, it seems that when the Lisp object is not a symbol,
> there is a problem.  This is illustrated by evaluating
> the following form interactively:
>
> (progn
>   (put-text-property (point) (1+ (point)) 
>                      '(example name)
>                       t)
>   (put-text-property (point) (1+ (point)) 
>                      '(example name)
>                       nil)
>   (text-properties-at (point)))

This is not a bug, because '(example name) and '(example name) are
distinct objects:

ELISP> (eq '(example name) '(example name))
nil

Try this instead:

(let ((name '(example name)))
  (put-text-property (point) (1+ (point)) name t)
  (put-text-property (point) (1+ (point)) name nil)
  (text-properties-at (point)))

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

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

* Re: problem with text properties whose names aren't symbols
  2005-12-12 11:04 ` Andreas Schwab
@ 2005-12-12 16:48   ` Joe Corneli
  0 siblings, 0 replies; 3+ messages in thread
From: Joe Corneli @ 2005-12-12 16:48 UTC (permalink / raw)


   This is not a bug, because '(example name) and '(example name) are
   distinct objects:

   ELISP> (eq '(example name) '(example name))
   nil

OK, thanks for the tip.

I guess this could be filed under "feature request"; compare my
request of Aug. 8 for property search with user-defined predicates.

http://lists.gnu.org/archive/html/emacs-pretest-bug/2005-08/msg00068.html  

In the current case the request becomes "enable the use of a
user-defined :test for comparing names stored by `put-text-property'."
On the other hand, there is (again) a work-around, following along the
lines of Andreas's suggestion:

(progn
  (put-text-property (point) (1+ (point)) '(example name) t)
  (let ((props (text-properties-at (point))))
    (put-text-property (point) (1+ (point)) 
                       (car (member '(example name) props)) nil))
  (text-properties-at (point)))

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

end of thread, other threads:[~2005-12-12 16:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-12  2:49 problem with text properties whose names aren't symbols Joe Corneli
2005-12-12 11:04 ` Andreas Schwab
2005-12-12 16:48   ` Joe Corneli

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.