* Re: Help with elisp
@ 2003-07-31 18:13 David Chadd
0 siblings, 0 replies; 9+ messages in thread
From: David Chadd @ 2003-07-31 18:13 UTC (permalink / raw)
Lawrence, Tom
Wonderful, just the help I needed. Thank you both very much.
David
--
--------------------------
Professor David Chadd
University of East Anglia
Norwich NR4 7TJ, UK
net: <d.chadd@uea.ac.uk>
web: www.uea.ac.uk/~q506/
fax: +44 (0)1263 250454
--------------------------
^ permalink raw reply [flat|nested] 9+ messages in thread
* help with Elisp
@ 2021-10-14 22:18 Emanuel Berg via Users list for the GNU Emacs text editor
2021-10-14 22:21 ` Emanuel Berg via Users list for the GNU Emacs text editor
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-10-14 22:18 UTC (permalink / raw)
To: help-gnu-emacs
How can I disable the Elisp syntax helper that appears in the
echo area?
I don't even know what triggers it?
And after it pops up, the text remains even after
I move point.
Annoying!
But I see its value ... if it can just be disabled I'm happy.
GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, cairo version
1.16.0) of 2021-10-04
--
underground experts united
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 9+ messages in thread
[parent not found: <mailman.767.1059641390.8231.help-gnu-emacs@gnu.org>]
* Re: Help with elisp
[not found] <mailman.767.1059641390.8231.help-gnu-emacs@gnu.org>
@ 2003-07-31 11:30 ` lawrence mitchell
2003-07-31 11:59 ` Tom Capey
1 sibling, 0 replies; 9+ messages in thread
From: lawrence mitchell @ 2003-07-31 11:30 UTC (permalink / raw)
David Chadd wrote:
> Apologies for a question demonstrating beginner's total Elisp
> incompetence. I want to make lists out of series of
> attribute-values in an xml file. (The values are sigla of
> manuscripts.) These are e.g. in the form:
> wit="CAO-C Alb2 Hyd"
> Having found the string of values (CAO-C Alb2 Hyd) with a regexp
> search, I simple-mindedly thought I would be able to do something like
> (setq wits (split-string (match-string 1)))
> This does indeed make a list --- (listp wits) returns T --- but the
> lists don't behave as I would expect. For instance, they don't
> respond correctly to (set-difference), (intersection) etc. And for
> reasons I can guess at, but don't know enough to do anything about,
> the lists are in the form ("CAO-C" "Alb2" "Hyd") rather than (CAO-C
> Alb2 Hyd).
> I'm obviously going totally the wrong way about this. How should I be
> trying to make a conventional Lisp list out of a found string of this
> kind? Advice and guidance gratefully received.
In fact, you're almost there. The only thing you're missing is
the correct equality test. You see, strings are not EQ, or EQL
in emacs lisp.
(eq "foo" "foo")
=> nil
(eql "foo" "foo")
=> nil
instead, you need to check for equality either with EQUAL, or,
if you know you are using strings, STRING=.
(equal "foo" "foo")
=> t
(string= "foo" "foo")
=> t
Now, the functions SET-DIFFERENCE and INTERSECTION by default
test for equality with EQ, so you need to tell them to use a
different testing function. This can be done by supplying them
with a keyword argument.
(setq foo '("foo" "bar" "baz")
bar '("bar" "baz" "quux"))
foo
=> ("foo" "bar" "baz")
bar
=> ("bar" "baz" "quux")
;; Default, comparison done with EQ.
(set-difference foo bar)
=> ("baz" "bar" "foo")
(intersection foo bar)
=> nil
;; Comparison done with STRING=
(set-difference foo bar :test 'string=)
=> ("foo")
(intersection foo bar :test 'string=)
=> ("baz" "bar")
Hope that clears things up a bit
--
lawrence mitchell <wence@gmx.li>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Help with elisp
[not found] <mailman.767.1059641390.8231.help-gnu-emacs@gnu.org>
2003-07-31 11:30 ` Help with elisp lawrence mitchell
@ 2003-07-31 11:59 ` Tom Capey
2003-07-31 15:59 ` Kevin Rodgers
1 sibling, 1 reply; 9+ messages in thread
From: Tom Capey @ 2003-07-31 11:59 UTC (permalink / raw)
* David Chadd <d.chadd@uea.ac.uk> writes:
> Apologies for a question demonstrating beginner's total Elisp
> incompetence. I want to make lists out of series of
> attribute-values in an xml file. (The values are sigla of
> manuscripts.) These are e.g. in the form:
> wit="CAO-C Alb2 Hyd"
> Having found the string of values (CAO-C Alb2 Hyd) with a regexp
> search, I simple-mindedly thought I would be able to do something like
> (setq wits (split-string (match-string 1)))
> This does indeed make a list --- (listp wits) returns T --- but the
> lists don't behave as I would expect. For instance, they don't
> respond correctly to (set-difference), (intersection) etc. And for
> reasons I can guess at, but don't know enough to do anything about,
> the lists are in the form ("CAO-C" "Alb2" "Hyd") rather than (CAO-C
> Alb2 Hyd).
change the test in the set functions from `eq':
(setq a (list "CAO-C" "Alb2" "Hyd")
b (list "CAO-C" "Alb2" "Hyd" "foo"))
(intersection a b :test 'string-equal)
=> ("Hyd" "Alb2" "CAO-C")
(set-difference b a :test 'string-equal)
=> ("foo")
(set-difference a b :test 'string-equal)
=> nil
/Tom
--
Mais, à part ça, Madame la Marquise,
Tout va très bien, tout va très bien.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Help with elisp
2003-07-31 11:59 ` Tom Capey
@ 2003-07-31 15:59 ` Kevin Rodgers
0 siblings, 0 replies; 9+ messages in thread
From: Kevin Rodgers @ 2003-07-31 15:59 UTC (permalink / raw)
Tom Capey wrote:
> * David Chadd <d.chadd@uea.ac.uk> writes:
>>Having found the string of values (CAO-C Alb2 Hyd) with a regexp
>>search, I simple-mindedly thought I would be able to do something like
>>
>> (setq wits (split-string (match-string 1)))
>>
>>This does indeed make a list --- (listp wits) returns T --- but the
>>lists don't behave as I would expect. For instance, they don't
>>respond correctly to (set-difference), (intersection) etc. And for
>>reasons I can guess at, but don't know enough to do anything about,
>>the lists are in the form ("CAO-C" "Alb2" "Hyd") rather than (CAO-C
>>Alb2 Hyd).
>
> change the test in the set functions from `eq':
>
> (setq a (list "CAO-C" "Alb2" "Hyd")
> b (list "CAO-C" "Alb2" "Hyd" "foo"))
>
> (intersection a b :test 'string-equal)
> => ("Hyd" "Alb2" "CAO-C")
>
> (set-difference b a :test 'string-equal)
> => ("foo")
>
> (set-difference a b :test 'string-equal)
> => nil
Or create a list of symbols (which can be compared with `eq')
instead of strings (which can't):
(setq wits (mapcar 'intern (split-string (match-string 1))))
--
Kevin Rodgers
^ permalink raw reply [flat|nested] 9+ messages in thread
* Help with elisp
@ 2003-07-30 18:06 David Chadd
0 siblings, 0 replies; 9+ messages in thread
From: David Chadd @ 2003-07-30 18:06 UTC (permalink / raw)
Apologies for a question demonstrating beginner's total Elisp
incompetence. I want to make lists out of series of
attribute-values in an xml file. (The values are sigla of
manuscripts.) These are e.g. in the form:
wit="CAO-C Alb2 Hyd"
Having found the string of values (CAO-C Alb2 Hyd) with a regexp
search, I simple-mindedly thought I would be able to do something like
(setq wits (split-string (match-string 1)))
This does indeed make a list --- (listp wits) returns T --- but the
lists don't behave as I would expect. For instance, they don't
respond correctly to (set-difference), (intersection) etc. And for
reasons I can guess at, but don't know enough to do anything about,
the lists are in the form ("CAO-C" "Alb2" "Hyd") rather than (CAO-C
Alb2 Hyd).
I'm obviously going totally the wrong way about this. How should I be
trying to make a conventional Lisp list out of a found string of this
kind? Advice and guidance gratefully received.
DC
--
--------------------------
Professor David Chadd
University of East Anglia
Norwich NR4 7TJ, UK
net: <d.chadd@uea.ac.uk>
fax: +44 (0)1263 250454
--------------------------
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2021-10-14 22:24 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-07-31 18:13 Help with elisp David Chadd
-- strict thread matches above, loose matches on Subject: below --
2021-10-14 22:18 help with Elisp Emanuel Berg via Users list for the GNU Emacs text editor
2021-10-14 22:21 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-10-14 22:23 ` Gregory Heytings
2021-10-14 22:24 ` Óscar Fuentes
[not found] <mailman.767.1059641390.8231.help-gnu-emacs@gnu.org>
2003-07-31 11:30 ` Help with elisp lawrence mitchell
2003-07-31 11:59 ` Tom Capey
2003-07-31 15:59 ` Kevin Rodgers
2003-07-30 18:06 David Chadd
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).