all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Problems extracting a text property
@ 2007-07-23  8:22 Tassilo Horn
  2007-07-23  9:33 ` Tassilo Horn
  2007-07-23 20:13 ` Stefan Monnier
  0 siblings, 2 replies; 7+ messages in thread
From: Tassilo Horn @ 2007-07-23  8:22 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,

on a link in an info buffer the text has properies like these:

,----
| (font-lock-face info-xref mouse-face highlight
|  help-echo mouse-2: go to (libc)Special Functions)
| (font-lock-face info-xref mouse-face highlight
|  help-echo mouse-2: go to (libext2fs.info))
| (font-lock-face info-xref mouse-face highlight
|  help-echo mouse-2: go to (libidn)Invoking idn)
| (font-lock-face info-xref mouse-face highlight
|  help-echo mouse-2: go to (nano))
| (font-lock-face info-xref mouse-face highlight
|  help-echo mouse-2: go to (recode))
`----

Now I'd like to extract the link locations, e.g. "(libc)Special
Functions". But how?

The other properties can be examined with

    (get-text-property (point) 'font-lock-face)

but I cannot get the target.

I tried

    (get-text-property (point) 'mouse-2)
    (get-text-property (point) 'mouse-2:)
    (get-text-property (point) "mouse-2: go to")
    (get-text-property (point) 'to)

but they all return nil.

Much thanks in advance,
Tassilo
-- 
People say that  if you play Microsoft CD's  backwards, you hear satanic
things,  but that's  nothing, because  if you  play them  forwards, they
install Windows.

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

* Re: Problems extracting a text property
  2007-07-23  8:22 Problems extracting a text property Tassilo Horn
@ 2007-07-23  9:33 ` Tassilo Horn
  2007-07-23 10:44   ` Harald Hanche-Olsen
  2007-07-23 20:13 ` Stefan Monnier
  1 sibling, 1 reply; 7+ messages in thread
From: Tassilo Horn @ 2007-07-23  9:33 UTC (permalink / raw)
  To: help-gnu-emacs

Tassilo Horn <thorn+news@fastmail.fm> writes:

Hi,

> on a link in an info buffer the text has properies like these:
>
> ,----
> | (font-lock-face info-xref mouse-face highlight
> |  help-echo mouse-2: go to (libc)Special Functions)
> | (font-lock-face info-xref mouse-face highlight
> |  help-echo mouse-2: go to (libext2fs.info))
> | (font-lock-face info-xref mouse-face highlight
> |  help-echo mouse-2: go to (libidn)Invoking idn)
> | (font-lock-face info-xref mouse-face highlight
> |  help-echo mouse-2: go to (nano))
> | (font-lock-face info-xref mouse-face highlight
> |  help-echo mouse-2: go to (recode))
> `----

I found the solution myself. "mouse-2: go to (recode)" is the value of
the help-echo property, so

    (get-text-property (point) 'help-echo)

works.

Bye,
Tassilo
-- 
People sometimes  ask me if it  is a sin in  the Church of  Emacs to use
vi. Using a free  version of vi is not a sin; it  is a penance. So happy
hacking. (Richard M. Stallman)

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

* Re: Problems extracting a text property
  2007-07-23  9:33 ` Tassilo Horn
@ 2007-07-23 10:44   ` Harald Hanche-Olsen
  2007-07-23 10:46     ` Harald Hanche-Olsen
  2007-07-23 11:28     ` Tassilo Horn
  0 siblings, 2 replies; 7+ messages in thread
From: Harald Hanche-Olsen @ 2007-07-23 10:44 UTC (permalink / raw)
  To: help-gnu-emacs

+ Tassilo Horn <thorn+news@fastmail.fm>:

|> | (font-lock-face info-xref mouse-face highlight
|> |  help-echo mouse-2: go to (recode))
|> `----
|
| I found the solution myself. "mouse-2: go to (recode)" is the value of
| the help-echo property, so

... which you no doubt found out, or could have found out, by
executing (with M-:) (text-properties-at (point)) and examining the
result.

|     (get-text-property (point) 'help-echo)
|
| works.

Which may prove useless in the long run, as in my (CVS) version of
emacs that text is replaced by the much less useful "mouse-1: go to
this node".

You may need to dig around in info.el to find out how the info code
itself finds the necessary information.

-- 
* Harald Hanche-Olsen     <URL:http://www.math.ntnu.no/~hanche/>
- It is undesirable to believe a proposition
  when there is no ground whatsoever for supposing it is true.
  -- Bertrand Russell

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

* Re: Problems extracting a text property
  2007-07-23 10:44   ` Harald Hanche-Olsen
@ 2007-07-23 10:46     ` Harald Hanche-Olsen
  2007-07-23 11:28     ` Tassilo Horn
  1 sibling, 0 replies; 7+ messages in thread
From: Harald Hanche-Olsen @ 2007-07-23 10:46 UTC (permalink / raw)
  To: help-gnu-emacs

+ Harald Hanche-Olsen <hanche@math.ntnu.no>:

| executing (with M-:) (text-properties-at (point)) and examining the

... in which gnus renders a smiley in the midst of the text.
How silly.  I suppose I should have written the parenthetical remark
with an extra space: (with M-: ).

-- 
* Harald Hanche-Olsen     <URL:http://www.math.ntnu.no/~hanche/>
- It is undesirable to believe a proposition
  when there is no ground whatsoever for supposing it is true.
  -- Bertrand Russell

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

* Re: Problems extracting a text property
  2007-07-23 10:44   ` Harald Hanche-Olsen
  2007-07-23 10:46     ` Harald Hanche-Olsen
@ 2007-07-23 11:28     ` Tassilo Horn
  1 sibling, 0 replies; 7+ messages in thread
From: Tassilo Horn @ 2007-07-23 11:28 UTC (permalink / raw)
  To: help-gnu-emacs

Harald Hanche-Olsen <hanche@math.ntnu.no> writes:

Hi Harald,

> |     (get-text-property (point) 'help-echo)
>
> Which may prove useless in the long run, as in my (CVS) version of
> emacs that text is replaced by the much less useful "mouse-1: go to
> this node".

Hopefully the behavior of my CVS-version of emacs (HEAD, not the
unicode-2 branch) survives when unicode-2 gets merged.

> You may need to dig around in info.el to find out how the info code
> itself finds the necessary information.

Yes, that will be the best solution.

Bye,
Tassilo
-- 
            Wenn Windows die Lösung ist, kann ich dann bitte
                       das Problem zurück haben?

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

* Re: Problems extracting a text property
  2007-07-23  8:22 Problems extracting a text property Tassilo Horn
  2007-07-23  9:33 ` Tassilo Horn
@ 2007-07-23 20:13 ` Stefan Monnier
  2007-07-24  7:23   ` Tassilo Horn
  1 sibling, 1 reply; 7+ messages in thread
From: Stefan Monnier @ 2007-07-23 20:13 UTC (permalink / raw)
  To: help-gnu-emacs

> on a link in an info buffer the text has properies like these:

> ,----
> | (font-lock-face info-xref mouse-face highlight
> |  help-echo mouse-2: go to (libc)Special Functions)
> | (font-lock-face info-xref mouse-face highlight
> |  help-echo mouse-2: go to (libext2fs.info))
> | (font-lock-face info-xref mouse-face highlight
> |  help-echo mouse-2: go to (libidn)Invoking idn)
> | (font-lock-face info-xref mouse-face highlight
> |  help-echo mouse-2: go to (nano))
> | (font-lock-face info-xref mouse-face highlight
> |  help-echo mouse-2: go to (recode))
> `----

> Now I'd like to extract the link locations, e.g. "(libc)Special
> Functions". But how?

The code activated by mouse-2 does not use the text-properties, but the
buffer's text instead.  So take a look at the text covered by those
properties (and beware that some part of it may be invisible).


        Stefan

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

* Re: Problems extracting a text property
  2007-07-23 20:13 ` Stefan Monnier
@ 2007-07-24  7:23   ` Tassilo Horn
  0 siblings, 0 replies; 7+ messages in thread
From: Tassilo Horn @ 2007-07-24  7:23 UTC (permalink / raw)
  To: help-gnu-emacs

Stefan Monnier <monnier@iro.umontreal.ca> writes:

Hi Stefan,

>> | (font-lock-face info-xref mouse-face highlight
>> |  help-echo mouse-2: go to (recode))
>> `----
>
>> Now I'd like to extract the link locations, e.g. "(libc)Special
>> Functions". But how?
>
> The code activated by mouse-2 does not use the text-properties, but
> the buffer's text instead.  So take a look at the text covered by
> those properties (and beware that some part of it may be invisible).

Yes, I've found `Info-get-token' which was exactly what was needed for
my purpose (building a list of all info pages in the Top node).

Bye,
Tassilo
-- 
          "Emacs is not a development tool but a way of life."
                - David Kastrup in alt.religion.emacs -

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

end of thread, other threads:[~2007-07-24  7:23 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-23  8:22 Problems extracting a text property Tassilo Horn
2007-07-23  9:33 ` Tassilo Horn
2007-07-23 10:44   ` Harald Hanche-Olsen
2007-07-23 10:46     ` Harald Hanche-Olsen
2007-07-23 11:28     ` Tassilo Horn
2007-07-23 20:13 ` Stefan Monnier
2007-07-24  7:23   ` Tassilo Horn

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.