all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* strange font information in local abbrev table
@ 2014-10-26 14:06 Uwe Brauer
  2014-10-26 16:54 ` Stefan Monnier
  0 siblings, 1 reply; 3+ messages in thread
From: Uwe Brauer @ 2014-10-26 14:06 UTC (permalink / raw
  To: emacs-devel


Hello 

I use the following simple functions


(defun ediff-copy-to-register-A ()
  (interactive)
  (copy-to-register ?A (region-beginning) (region-end) nil)
  (message "diff is copied to register A"))

(defun ediff-copy-to-register-B ()
  (interactive)
  (copy-to-register ?B (region-beginning) (region-end) nil)
  (message "diff is copied to register B"))

(defun ediff-define-abbrev ()
  (interactive)
  (let ((name (get-register ?A)))
	(let ((expansion (get-register ?B)))
	  (define-abbrev local-abbrev-table  name (downcase expansion))))
  (message "abbrev is added using register A and B."))

Which come in handy for example to define abbrevs when ediff was called,
but could be used in other circumstances. Now while this works in Xemacs
and GNU emacs, I just recently discovered that in GNU emacs there is
some additional font information, whose origin and purpose I don't
understand:
example:

I have the defined the following minor mode with a corresponding 
abbrev table:

(deutsch-minor-mode-abbrev-table)
however when I defined 

hallllo to be expanded has hallo 

It works but relevant entry in the local-abbrev-table is:

#("hallllo" 0 7 (fontified t)) 0 "hallo"

The doc of define-abbrev seems not to make reference to this.

Can anybody enlighten me please?

Thanks 

Uwe Brauer 




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

* Re: strange font information in local abbrev table
  2014-10-26 14:06 strange font information in local abbrev table Uwe Brauer
@ 2014-10-26 16:54 ` Stefan Monnier
  2014-10-26 18:25   ` Uwe Brauer
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Monnier @ 2014-10-26 16:54 UTC (permalink / raw
  To: emacs-devel

> Which come in handy for example to define abbrevs when ediff was called,
> but could be used in other circumstances. Now while this works in Xemacs
> and GNU emacs, I just recently discovered that in GNU emacs there is
> some additional font information, whose origin and purpose I don't
> understand:
> example:

copy-to-register copies the text, including its text-properties.

> #("hallllo" 0 7 (fontified t)) 0 "hallo"

This is a string that has a `fontified' text-property applied to it.
This property is normally applied to the buffer text by `jit-lock' to
keep track of which part of the buffer has been font-locked and which
part hasn't.

You can ignore this property: it should be harmless.  But if it bothers
you (e.g. for aesthetic reasons) you can strip it by calling
(set-text-properties 0 (length name) nil name).

Notice that the other string doesn't have this property, because
`downcase' does not preserve text-properties (tho it probably should,
ideally, on the part of the string which is not modified).


        Stefan



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

* Re: strange font information in local abbrev table
  2014-10-26 16:54 ` Stefan Monnier
@ 2014-10-26 18:25   ` Uwe Brauer
  0 siblings, 0 replies; 3+ messages in thread
From: Uwe Brauer @ 2014-10-26 18:25 UTC (permalink / raw
  To: emacs-devel


>>>>> "Stefan" == Stefan Monnier <monnier@IRO.UMontreal.CA> writes:


   > copy-to-register copies the text, including its text-properties.

   >> #("hallllo" 0 7 (fontified t)) 0 "hallo"

   > This is a string that has a `fontified' text-property applied to it.

[...]


   > You can ignore this property: it should be harmless.  But if it
   > bothers you (e.g. for aesthetic reasons) you can strip it by
   > calling (set-text-properties 0 (length name) nil name).

Thanks for clarifying. Indeed this feature annoys me and your proposal
works as expected, thanks!
 




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

end of thread, other threads:[~2014-10-26 18:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-26 14:06 strange font information in local abbrev table Uwe Brauer
2014-10-26 16:54 ` Stefan Monnier
2014-10-26 18:25   ` Uwe Brauer

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.