Questions tagged [equality]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
3 votes
1 answer
40 views

Strange behaviour involving `display` property

I noticed a rather peculiar behavior when using the display property (using emacs 28.2). I tried to boil things down to a minimal example: The code (defun finsert () (insert (propertize ".&...
dmw64's user avatar
  • 175
0 votes
1 answer
21 views

If-clause on content of variable

Question: I customized the variable user-mail-address on PC 1 and thought, I simply could ask for the content of this variable: (setq org-agenda-files (if (user-mail-address "[email protected]&...
Keks Dose's user avatar
  • 508
7 votes
1 answer
132 views

“(equal a b)⇒t” whereas “(equal b a)⇒error”

GNU Emacs Lisp Reference Manual, 2.8 Equality Predicates: Comparing circular lists may therefore cause deep recursion that leads to an error, and this may result in counterintuitive behavior such as (...
shynur's user avatar
  • 4,583
0 votes
1 answer
23 views

Adding to a list when there is a match only

The following function replaces filenames and places the result in a list. Although the list gets filled, I do not want to add the filename when there is no match. How can I avoid sending non-...
Dilna's user avatar
  • 1
1 vote
1 answer
70 views

How to use markers as keys in a hash map?

I'm creating a hash map and I'd like to use markers as keys. I set the hash map equality test to "equal", but the last line from the below code is returning ("bye" "fly") ...
rclark's user avatar
  • 113
2 votes
2 answers
766 views

setf + alist-get but with "equal" instead of "eq"?

I got a suggestion to use setf to replace value in an alist: Replace element in a list / add in case of absence, with custom test/key functions The example was provided, but it doesn't work if key is ...
gavenkoa's user avatar
  • 3,362
1 vote
2 answers
254 views

How to compare an item against others, that's compatible with string-equal?

When comparing the last-command against multiple possible strings, it doesn't seem possible to use the member function. Is there a way to simplify this using something like member? (when (or (...
ideasman42's user avatar
  • 8,546
5 votes
1 answer
271 views

Set difference for sets of strings

Why the following in emacs-lisp works as expected: (set-difference '(1 2) '(1)) => (2) But if strings used it doesn't: (set-difference '("foo" "bar") '("foo")) => ("foo" "bar") How do can I ...
iLemming's user avatar
  • 1,233
0 votes
1 answer
109 views

Function that returns the name of a Greek vowel

I'm trying to write a function that will return the name of a Greek vowel: alpha or epsilon etc. I was hoping this could be done by extracting it from the second group in the following regexp (in a ...
Toothrot's user avatar
  • 3,254
6 votes
2 answers
475 views

How to make (make-symbol "foo") (make-symbol "foo") equal?

I'm curious why: (equal (make-symbol "foo") (make-symbol "foo")) ends up beeing nil. While (equal 'foo 'foo) is t. Do i have a misconception of symbols? Aren't they just strings without double-...
lordnik22's user avatar
  • 131
4 votes
3 answers
1k views

Why are there multiple ways to test for equality in elisp?

In Logic there is one and only one unambiguously(*) defined notion of equality: two things are equal if and only if they are the same thing. Programming languages of course try to emulate this ...
Ruy's user avatar
  • 839
0 votes
1 answer
57 views

Idiomatic boolean comparators

Are there idiomatic boolean comparators in emacs lisp? Something like: (my/bool< nil t) => t (my/bool< 1 2) => nil For example, a comparator that returns t if the first argument is ...
ebpa's user avatar
  • 7,389
2 votes
1 answer
390 views

Check if buffername is equal to file name

I'm trying to autoexport a file from orgmode to html, so I decided to make a function to check the major mode of the buffer and check if the buffer has open the file that I want to export but when I ...
rafaelleru's user avatar
1 vote
1 answer
62 views

Comparison of quoted symbols fails using equal

I'm trying to compare (quote foo) with 'foo using equal, but the equality is failing. Here is a trace of what is happening with my code. I don't understand why the comparison fails -- does it have ...
Kevin's user avatar
  • 1,308
6 votes
1 answer
88 views

More than two variable for equality predicates?

I see that = is great for "comparing" more than two (numerical) arguments, e.g., (= 1 1 1). But then eq, eql, and equal all only allow two arguments. And nesting is nonsense, i.e., the inner eq ...
147pm's user avatar
  • 2,937