diff options
| author | Nicolas Petton | 2017-07-07 21:21:55 +0200 |
|---|---|---|
| committer | Nicolas Petton | 2017-07-11 10:07:16 +0200 |
| commit | 0bece6c6815cc59e181817a2765a4ea752f34f56 (patch) | |
| tree | 856363b2defed20c97a25c29a7739bce9a6bd9cb | |
| parent | 689c5c20d1174e95be50e674d05632545eb4b9c5 (diff) | |
| download | emacs-0bece6c6815cc59e181817a2765a4ea752f34f56.tar.gz emacs-0bece6c6815cc59e181817a2765a4ea752f34f56.zip | |
Add an optional testfn parameter to assoc
* src/fns.c (assoc): New optional testfn parameter used for comparison
when provided.
* test/src/fns-tests.el (test-assoc-testfn): Add tests for the new
'testfn' parameter.
* src/buffer.c:
* src/coding.c:
* src/dbusbind.c:
* src/font.c:
* src/fontset.c:
* src/gfilenotify.c:
* src/image.c:
* src/keymap.c:
* src/process.c:
* src/w32fns.c:
* src/w32font.c:
* src/w32notify.c:
* src/w32term.c:
* src/xdisp.c:
* src/xfont.c: Add a third argument to Fassoc calls.
* etc/NEWS:
* doc/lispref/lists.texi: Document the new 'testfn' parameter.
| -rw-r--r-- | doc/lispref/lists.texi | 18 | ||||
| -rw-r--r-- | etc/NEWS | 5 | ||||
| -rw-r--r-- | src/buffer.c | 2 | ||||
| -rw-r--r-- | src/coding.c | 6 | ||||
| -rw-r--r-- | src/dbusbind.c | 6 | ||||
| -rw-r--r-- | src/fns.c | 15 | ||||
| -rw-r--r-- | src/font.c | 2 | ||||
| -rw-r--r-- | src/fontset.c | 2 | ||||
| -rw-r--r-- | src/gfilenotify.c | 2 | ||||
| -rw-r--r-- | src/image.c | 2 | ||||
| -rw-r--r-- | src/keymap.c | 2 | ||||
| -rw-r--r-- | src/process.c | 2 | ||||
| -rw-r--r-- | src/w32fns.c | 2 | ||||
| -rw-r--r-- | src/w32font.c | 2 | ||||
| -rw-r--r-- | src/w32notify.c | 4 | ||||
| -rw-r--r-- | src/w32term.c | 2 | ||||
| -rw-r--r-- | src/xdisp.c | 6 | ||||
| -rw-r--r-- | src/xfont.c | 3 | ||||
| -rw-r--r-- | test/src/fns-tests.el | 6 |
19 files changed, 53 insertions, 36 deletions
diff --git a/doc/lispref/lists.texi b/doc/lispref/lists.texi index 8eab2818f97..966d8f18b17 100644 --- a/doc/lispref/lists.texi +++ b/doc/lispref/lists.texi | |||
| @@ -1511,12 +1511,12 @@ respects. A property list behaves like an association list in which | |||
| 1511 | each key can occur only once. @xref{Property Lists}, for a comparison | 1511 | each key can occur only once. @xref{Property Lists}, for a comparison |
| 1512 | of property lists and association lists. | 1512 | of property lists and association lists. |
| 1513 | 1513 | ||
| 1514 | @defun assoc key alist | 1514 | @defun assoc key alist &optional testfn |
| 1515 | This function returns the first association for @var{key} in | 1515 | This function returns the first association for @var{key} in |
| 1516 | @var{alist}, comparing @var{key} against the alist elements using | 1516 | @var{alist}, comparing @var{key} against the alist elements using |
| 1517 | @code{equal} (@pxref{Equality Predicates}). It returns @code{nil} if no | 1517 | @var{testfn} if non-nil, or @code{equal} if nil (@pxref{Equality |
| 1518 | association in @var{alist} has a @sc{car} @code{equal} to @var{key}. | 1518 | Predicates}). It returns @code{nil} if no association in @var{alist} |
| 1519 | For example: | 1519 | has a @sc{car} equal to @var{key}. For example: |
| 1520 | 1520 | ||
| 1521 | @smallexample | 1521 | @smallexample |
| 1522 | (setq trees '((pine . cones) (oak . acorns) (maple . seeds))) | 1522 | (setq trees '((pine . cones) (oak . acorns) (maple . seeds))) |
| @@ -1561,11 +1561,11 @@ this as reverse @code{assoc}, finding the key for a given value. | |||
| 1561 | @defun assq key alist | 1561 | @defun assq key alist |
| 1562 | This function is like @code{assoc} in that it returns the first | 1562 | This function is like @code{assoc} in that it returns the first |
| 1563 | association for @var{key} in @var{alist}, but it makes the comparison | 1563 | association for @var{key} in @var{alist}, but it makes the comparison |
| 1564 | using @code{eq} instead of @code{equal}. @code{assq} returns @code{nil} | 1564 | using @code{eq}. @code{assq} returns @code{nil} if no association in |
| 1565 | if no association in @var{alist} has a @sc{car} @code{eq} to @var{key}. | 1565 | @var{alist} has a @sc{car} @code{eq} to @var{key}. This function is |
| 1566 | This function is used more often than @code{assoc}, since @code{eq} is | 1566 | used more often than @code{assoc}, since @code{eq} is faster than |
| 1567 | faster than @code{equal} and most alists use symbols as keys. | 1567 | @code{equal} and most alists use symbols as keys. @xref{Equality |
| 1568 | @xref{Equality Predicates}. | 1568 | Predicates}. |
| 1569 | 1569 | ||
| 1570 | @smallexample | 1570 | @smallexample |
| 1571 | (setq trees '((pine . cones) (oak . acorns) (maple . seeds))) | 1571 | (setq trees '((pine . cones) (oak . acorns) (maple . seeds))) |
| @@ -100,6 +100,11 @@ required capabilities are found in terminfo. See the FAQ node | |||
| 100 | 100 | ||
| 101 | * Changes in Emacs 26.1 | 101 | * Changes in Emacs 26.1 |
| 102 | 102 | ||
| 103 | +++ | ||
| 104 | ** The function 'assoc' now takes an optional third argument 'testfn'. | ||
| 105 | This argument, when non-nil, is used for comparison instead of | ||
| 106 | 'equal'. | ||
| 107 | |||
| 103 | ** The variable 'emacs-version' no longer includes the build number. | 108 | ** The variable 'emacs-version' no longer includes the build number. |
| 104 | This is now stored separately in a new variable, 'emacs-build-number'. | 109 | This is now stored separately in a new variable, 'emacs-build-number'. |
| 105 | 110 | ||
diff --git a/src/buffer.c b/src/buffer.c index 780e4d7a7d6..e0972aac33c 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -1164,7 +1164,7 @@ buffer_local_value (Lisp_Object variable, Lisp_Object buffer) | |||
| 1164 | { /* Look in local_var_alist. */ | 1164 | { /* Look in local_var_alist. */ |
| 1165 | struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (sym); | 1165 | struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (sym); |
| 1166 | XSETSYMBOL (variable, sym); /* Update In case of aliasing. */ | 1166 | XSETSYMBOL (variable, sym); /* Update In case of aliasing. */ |
| 1167 | result = Fassoc (variable, BVAR (buf, local_var_alist)); | 1167 | result = Fassoc (variable, BVAR (buf, local_var_alist), Qnil); |
| 1168 | if (!NILP (result)) | 1168 | if (!NILP (result)) |
| 1169 | { | 1169 | { |
| 1170 | if (blv->fwd) | 1170 | if (blv->fwd) |
diff --git a/src/coding.c b/src/coding.c index 5682fc015ad..50ad206be69 100644 --- a/src/coding.c +++ b/src/coding.c | |||
| @@ -10539,7 +10539,7 @@ usage: (define-coding-system-internal ...) */) | |||
| 10539 | ASET (this_spec, 2, this_eol_type); | 10539 | ASET (this_spec, 2, this_eol_type); |
| 10540 | Fputhash (this_name, this_spec, Vcoding_system_hash_table); | 10540 | Fputhash (this_name, this_spec, Vcoding_system_hash_table); |
| 10541 | Vcoding_system_list = Fcons (this_name, Vcoding_system_list); | 10541 | Vcoding_system_list = Fcons (this_name, Vcoding_system_list); |
| 10542 | val = Fassoc (Fsymbol_name (this_name), Vcoding_system_alist); | 10542 | val = Fassoc (Fsymbol_name (this_name), Vcoding_system_alist, Qnil); |
| 10543 | if (NILP (val)) | 10543 | if (NILP (val)) |
| 10544 | Vcoding_system_alist | 10544 | Vcoding_system_alist |
| 10545 | = Fcons (Fcons (Fsymbol_name (this_name), Qnil), | 10545 | = Fcons (Fcons (Fsymbol_name (this_name), Qnil), |
| @@ -10554,7 +10554,7 @@ usage: (define-coding-system-internal ...) */) | |||
| 10554 | 10554 | ||
| 10555 | Fputhash (name, spec_vec, Vcoding_system_hash_table); | 10555 | Fputhash (name, spec_vec, Vcoding_system_hash_table); |
| 10556 | Vcoding_system_list = Fcons (name, Vcoding_system_list); | 10556 | Vcoding_system_list = Fcons (name, Vcoding_system_list); |
| 10557 | val = Fassoc (Fsymbol_name (name), Vcoding_system_alist); | 10557 | val = Fassoc (Fsymbol_name (name), Vcoding_system_alist, Qnil); |
| 10558 | if (NILP (val)) | 10558 | if (NILP (val)) |
| 10559 | Vcoding_system_alist = Fcons (Fcons (Fsymbol_name (name), Qnil), | 10559 | Vcoding_system_alist = Fcons (Fcons (Fsymbol_name (name), Qnil), |
| 10560 | Vcoding_system_alist); | 10560 | Vcoding_system_alist); |
| @@ -10662,7 +10662,7 @@ DEFUN ("define-coding-system-alias", Fdefine_coding_system_alias, | |||
| 10662 | 10662 | ||
| 10663 | Fputhash (alias, spec, Vcoding_system_hash_table); | 10663 | Fputhash (alias, spec, Vcoding_system_hash_table); |
| 10664 | Vcoding_system_list = Fcons (alias, Vcoding_system_list); | 10664 | Vcoding_system_list = Fcons (alias, Vcoding_system_list); |
| 10665 | val = Fassoc (Fsymbol_name (alias), Vcoding_system_alist); | 10665 | val = Fassoc (Fsymbol_name (alias), Vcoding_system_alist, Qnil); |
| 10666 | if (NILP (val)) | 10666 | if (NILP (val)) |
| 10667 | Vcoding_system_alist = Fcons (Fcons (Fsymbol_name (alias), Qnil), | 10667 | Vcoding_system_alist = Fcons (Fcons (Fsymbol_name (alias), Qnil), |
| 10668 | Vcoding_system_alist); | 10668 | Vcoding_system_alist); |
diff --git a/src/dbusbind.c b/src/dbusbind.c index d2460fd886e..0d9d3e514fd 100644 --- a/src/dbusbind.c +++ b/src/dbusbind.c | |||
| @@ -955,7 +955,7 @@ xd_get_connection_address (Lisp_Object bus) | |||
| 955 | DBusConnection *connection; | 955 | DBusConnection *connection; |
| 956 | Lisp_Object val; | 956 | Lisp_Object val; |
| 957 | 957 | ||
| 958 | val = CDR_SAFE (Fassoc (bus, xd_registered_buses)); | 958 | val = CDR_SAFE (Fassoc (bus, xd_registered_buses, Qnil)); |
| 959 | if (NILP (val)) | 959 | if (NILP (val)) |
| 960 | XD_SIGNAL2 (build_string ("No connection to bus"), bus); | 960 | XD_SIGNAL2 (build_string ("No connection to bus"), bus); |
| 961 | else | 961 | else |
| @@ -1057,7 +1057,7 @@ xd_close_bus (Lisp_Object bus) | |||
| 1057 | Lisp_Object busobj; | 1057 | Lisp_Object busobj; |
| 1058 | 1058 | ||
| 1059 | /* Check whether we are connected. */ | 1059 | /* Check whether we are connected. */ |
| 1060 | val = Fassoc (bus, xd_registered_buses); | 1060 | val = Fassoc (bus, xd_registered_buses, Qnil); |
| 1061 | if (NILP (val)) | 1061 | if (NILP (val)) |
| 1062 | return; | 1062 | return; |
| 1063 | 1063 | ||
| @@ -1127,7 +1127,7 @@ this connection to those buses. */) | |||
| 1127 | xd_close_bus (bus); | 1127 | xd_close_bus (bus); |
| 1128 | 1128 | ||
| 1129 | /* Check, whether we are still connected. */ | 1129 | /* Check, whether we are still connected. */ |
| 1130 | val = Fassoc (bus, xd_registered_buses); | 1130 | val = Fassoc (bus, xd_registered_buses, Qnil); |
| 1131 | if (!NILP (val)) | 1131 | if (!NILP (val)) |
| 1132 | { | 1132 | { |
| 1133 | connection = xd_get_connection_address (bus); | 1133 | connection = xd_get_connection_address (bus); |
| @@ -1417,17 +1417,22 @@ assq_no_quit (Lisp_Object key, Lisp_Object list) | |||
| 1417 | return Qnil; | 1417 | return Qnil; |
| 1418 | } | 1418 | } |
| 1419 | 1419 | ||
| 1420 | DEFUN ("assoc", Fassoc, Sassoc, 2, 2, 0, | 1420 | DEFUN ("assoc", Fassoc, Sassoc, 2, 3, 0, |
| 1421 | doc: /* Return non-nil if KEY is `equal' to the car of an element of LIST. | 1421 | doc: /* Return non-nil if KEY is equal to the car of an element of LIST. |
| 1422 | The value is actually the first element of LIST whose car equals KEY. */) | 1422 | The value is actually the first element of LIST whose car equals KEY. |
| 1423 | (Lisp_Object key, Lisp_Object list) | 1423 | |
| 1424 | Equality is defined by TESTFN if non-nil or by `equal' if nil. */) | ||
| 1425 | (Lisp_Object key, Lisp_Object list, Lisp_Object testfn) | ||
| 1424 | { | 1426 | { |
| 1425 | Lisp_Object tail = list; | 1427 | Lisp_Object tail = list; |
| 1426 | FOR_EACH_TAIL (tail) | 1428 | FOR_EACH_TAIL (tail) |
| 1427 | { | 1429 | { |
| 1428 | Lisp_Object car = XCAR (tail); | 1430 | Lisp_Object car = XCAR (tail); |
| 1429 | if (CONSP (car) | 1431 | if (CONSP (car) |
| 1430 | && (EQ (XCAR (car), key) || !NILP (Fequal (XCAR (car), key)))) | 1432 | && (NILP (testfn) |
| 1433 | ? (EQ (XCAR (car), key) || !NILP (Fequal | ||
| 1434 | (XCAR (car), key))) | ||
| 1435 | : !NILP (call2 (testfn, XCAR (car), key)))) | ||
| 1431 | return car; | 1436 | return car; |
| 1432 | } | 1437 | } |
| 1433 | CHECK_LIST_END (tail, list); | 1438 | CHECK_LIST_END (tail, list); |
diff --git a/src/font.c b/src/font.c index 5a3f271ef85..a5e5b6a5b9d 100644 --- a/src/font.c +++ b/src/font.c | |||
| @@ -1893,7 +1893,7 @@ otf_tag_symbol (OTF_Tag tag) | |||
| 1893 | static OTF * | 1893 | static OTF * |
| 1894 | otf_open (Lisp_Object file) | 1894 | otf_open (Lisp_Object file) |
| 1895 | { | 1895 | { |
| 1896 | Lisp_Object val = Fassoc (file, otf_list); | 1896 | Lisp_Object val = Fassoc (file, otf_list, Qnil); |
| 1897 | OTF *otf; | 1897 | OTF *otf; |
| 1898 | 1898 | ||
| 1899 | if (! NILP (val)) | 1899 | if (! NILP (val)) |
diff --git a/src/fontset.c b/src/fontset.c index 850558b08a0..74018060b85 100644 --- a/src/fontset.c +++ b/src/fontset.c | |||
| @@ -1186,7 +1186,7 @@ fs_query_fontset (Lisp_Object name, int name_pattern) | |||
| 1186 | { | 1186 | { |
| 1187 | tem = Frassoc (name, Vfontset_alias_alist); | 1187 | tem = Frassoc (name, Vfontset_alias_alist); |
| 1188 | if (NILP (tem)) | 1188 | if (NILP (tem)) |
| 1189 | tem = Fassoc (name, Vfontset_alias_alist); | 1189 | tem = Fassoc (name, Vfontset_alias_alist, Qnil); |
| 1190 | if (CONSP (tem) && STRINGP (XCAR (tem))) | 1190 | if (CONSP (tem) && STRINGP (XCAR (tem))) |
| 1191 | name = XCAR (tem); | 1191 | name = XCAR (tem); |
| 1192 | else if (name_pattern == 0) | 1192 | else if (name_pattern == 0) |
diff --git a/src/gfilenotify.c b/src/gfilenotify.c index 285a253733d..fa4854c664d 100644 --- a/src/gfilenotify.c +++ b/src/gfilenotify.c | |||
| @@ -266,7 +266,7 @@ reason. Removing the watch by calling `gfile-rm-watch' also makes it | |||
| 266 | invalid. */) | 266 | invalid. */) |
| 267 | (Lisp_Object watch_descriptor) | 267 | (Lisp_Object watch_descriptor) |
| 268 | { | 268 | { |
| 269 | Lisp_Object watch_object = Fassoc (watch_descriptor, watch_list); | 269 | Lisp_Object watch_object = Fassoc (watch_descriptor, watch_list, Qnil); |
| 270 | if (NILP (watch_object)) | 270 | if (NILP (watch_object)) |
| 271 | return Qnil; | 271 | return Qnil; |
| 272 | else | 272 | else |
diff --git a/src/image.c b/src/image.c index 91749fb8733..1426e309445 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -4231,7 +4231,7 @@ xpm_load_image (struct frame *f, | |||
| 4231 | color_val = Qnil; | 4231 | color_val = Qnil; |
| 4232 | if (!NILP (color_symbols) && !NILP (symbol_color)) | 4232 | if (!NILP (color_symbols) && !NILP (symbol_color)) |
| 4233 | { | 4233 | { |
| 4234 | Lisp_Object specified_color = Fassoc (symbol_color, color_symbols); | 4234 | Lisp_Object specified_color = Fassoc (symbol_color, color_symbols, Qnil); |
| 4235 | 4235 | ||
| 4236 | if (CONSP (specified_color) && STRINGP (XCDR (specified_color))) | 4236 | if (CONSP (specified_color) && STRINGP (XCDR (specified_color))) |
| 4237 | { | 4237 | { |
diff --git a/src/keymap.c b/src/keymap.c index b568f47cba7..db9aa7cbf38 100644 --- a/src/keymap.c +++ b/src/keymap.c | |||
| @@ -1292,7 +1292,7 @@ silly_event_symbol_error (Lisp_Object c) | |||
| 1292 | base = XCAR (parsed); | 1292 | base = XCAR (parsed); |
| 1293 | name = Fsymbol_name (base); | 1293 | name = Fsymbol_name (base); |
| 1294 | /* This alist includes elements such as ("RET" . "\\r"). */ | 1294 | /* This alist includes elements such as ("RET" . "\\r"). */ |
| 1295 | assoc = Fassoc (name, exclude_keys); | 1295 | assoc = Fassoc (name, exclude_keys, Qnil); |
| 1296 | 1296 | ||
| 1297 | if (! NILP (assoc)) | 1297 | if (! NILP (assoc)) |
| 1298 | { | 1298 | { |
diff --git a/src/process.c b/src/process.c index abd017bb907..19009515336 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -951,7 +951,7 @@ DEFUN ("get-process", Fget_process, Sget_process, 1, 1, 0, | |||
| 951 | if (PROCESSP (name)) | 951 | if (PROCESSP (name)) |
| 952 | return name; | 952 | return name; |
| 953 | CHECK_STRING (name); | 953 | CHECK_STRING (name); |
| 954 | return Fcdr (Fassoc (name, Vprocess_alist)); | 954 | return Fcdr (Fassoc (name, Vprocess_alist, Qnil)); |
| 955 | } | 955 | } |
| 956 | 956 | ||
| 957 | /* This is how commands for the user decode process arguments. It | 957 | /* This is how commands for the user decode process arguments. It |
diff --git a/src/w32fns.c b/src/w32fns.c index b0842b5ee6c..457599fce0e 100644 --- a/src/w32fns.c +++ b/src/w32fns.c | |||
| @@ -467,7 +467,7 @@ if the entry is new. */) | |||
| 467 | block_input (); | 467 | block_input (); |
| 468 | 468 | ||
| 469 | /* replace existing entry in w32-color-map or add new entry. */ | 469 | /* replace existing entry in w32-color-map or add new entry. */ |
| 470 | entry = Fassoc (name, Vw32_color_map); | 470 | entry = Fassoc (name, Vw32_color_map, Qnil); |
| 471 | if (NILP (entry)) | 471 | if (NILP (entry)) |
| 472 | { | 472 | { |
| 473 | entry = Fcons (name, rgb); | 473 | entry = Fcons (name, rgb); |
diff --git a/src/w32font.c b/src/w32font.c index 67d2f6d666d..314d7acdcc6 100644 --- a/src/w32font.c +++ b/src/w32font.c | |||
| @@ -1627,7 +1627,7 @@ x_to_w32_charset (char * lpcs) | |||
| 1627 | Format of each entry is | 1627 | Format of each entry is |
| 1628 | (CHARSET_NAME . (WINDOWS_CHARSET . CODEPAGE)). | 1628 | (CHARSET_NAME . (WINDOWS_CHARSET . CODEPAGE)). |
| 1629 | */ | 1629 | */ |
| 1630 | this_entry = Fassoc (build_string (charset), Vw32_charset_info_alist); | 1630 | this_entry = Fassoc (build_string (charset), Vw32_charset_info_alist, Qnil); |
| 1631 | 1631 | ||
| 1632 | if (NILP (this_entry)) | 1632 | if (NILP (this_entry)) |
| 1633 | { | 1633 | { |
diff --git a/src/w32notify.c b/src/w32notify.c index 25205816bae..e8bdef8bdd3 100644 --- a/src/w32notify.c +++ b/src/w32notify.c | |||
| @@ -642,7 +642,7 @@ WATCH-DESCRIPTOR should be an object returned by `w32notify-add-watch'. */) | |||
| 642 | /* Remove the watch object from watch list. Do this before freeing | 642 | /* Remove the watch object from watch list. Do this before freeing |
| 643 | the object, do that even if we fail to free it, watch_list is | 643 | the object, do that even if we fail to free it, watch_list is |
| 644 | kept free of junk. */ | 644 | kept free of junk. */ |
| 645 | watch_object = Fassoc (watch_descriptor, watch_list); | 645 | watch_object = Fassoc (watch_descriptor, watch_list, Qnil); |
| 646 | if (!NILP (watch_object)) | 646 | if (!NILP (watch_object)) |
| 647 | { | 647 | { |
| 648 | watch_list = Fdelete (watch_object, watch_list); | 648 | watch_list = Fdelete (watch_object, watch_list); |
| @@ -679,7 +679,7 @@ the watcher thread exits abnormally for any other reason. Removing the | |||
| 679 | watch by calling `w32notify-rm-watch' also makes it invalid. */) | 679 | watch by calling `w32notify-rm-watch' also makes it invalid. */) |
| 680 | (Lisp_Object watch_descriptor) | 680 | (Lisp_Object watch_descriptor) |
| 681 | { | 681 | { |
| 682 | Lisp_Object watch_object = Fassoc (watch_descriptor, watch_list); | 682 | Lisp_Object watch_object = Fassoc (watch_descriptor, watch_list, Qnil); |
| 683 | 683 | ||
| 684 | if (!NILP (watch_object)) | 684 | if (!NILP (watch_object)) |
| 685 | { | 685 | { |
diff --git a/src/w32term.c b/src/w32term.c index c37805cb6ca..0f7bb9337f6 100644 --- a/src/w32term.c +++ b/src/w32term.c | |||
| @@ -6110,7 +6110,7 @@ x_calc_absolute_position (struct frame *f) | |||
| 6110 | 6110 | ||
| 6111 | list = CDR(list); | 6111 | list = CDR(list); |
| 6112 | 6112 | ||
| 6113 | geometry = Fassoc (Qgeometry, attributes); | 6113 | geometry = Fassoc (Qgeometry, attributes, Qnil); |
| 6114 | if (!NILP (geometry)) | 6114 | if (!NILP (geometry)) |
| 6115 | { | 6115 | { |
| 6116 | monitor_left = Fnth (make_number (1), geometry); | 6116 | monitor_left = Fnth (make_number (1), geometry); |
diff --git a/src/xdisp.c b/src/xdisp.c index 28ed7685236..abca6a8137a 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -23314,7 +23314,7 @@ display_mode_element (struct it *it, int depth, int field_width, int precision, | |||
| 23314 | props = oprops; | 23314 | props = oprops; |
| 23315 | } | 23315 | } |
| 23316 | 23316 | ||
| 23317 | aelt = Fassoc (elt, mode_line_proptrans_alist); | 23317 | aelt = Fassoc (elt, mode_line_proptrans_alist, Qnil); |
| 23318 | if (! NILP (aelt) && !NILP (Fequal (props, XCDR (aelt)))) | 23318 | if (! NILP (aelt) && !NILP (Fequal (props, XCDR (aelt)))) |
| 23319 | { | 23319 | { |
| 23320 | /* AELT is what we want. Move it to the front | 23320 | /* AELT is what we want. Move it to the front |
| @@ -28788,7 +28788,7 @@ set_frame_cursor_types (struct frame *f, Lisp_Object arg) | |||
| 28788 | 28788 | ||
| 28789 | /* By default, set up the blink-off state depending on the on-state. */ | 28789 | /* By default, set up the blink-off state depending on the on-state. */ |
| 28790 | 28790 | ||
| 28791 | tem = Fassoc (arg, Vblink_cursor_alist); | 28791 | tem = Fassoc (arg, Vblink_cursor_alist, Qnil); |
| 28792 | if (!NILP (tem)) | 28792 | if (!NILP (tem)) |
| 28793 | { | 28793 | { |
| 28794 | FRAME_BLINK_OFF_CURSOR (f) | 28794 | FRAME_BLINK_OFF_CURSOR (f) |
| @@ -28926,7 +28926,7 @@ get_window_cursor_type (struct window *w, struct glyph *glyph, int *width, | |||
| 28926 | /* Cursor is blinked off, so determine how to "toggle" it. */ | 28926 | /* Cursor is blinked off, so determine how to "toggle" it. */ |
| 28927 | 28927 | ||
| 28928 | /* First look for an entry matching the buffer's cursor-type in blink-cursor-alist. */ | 28928 | /* First look for an entry matching the buffer's cursor-type in blink-cursor-alist. */ |
| 28929 | if ((alt_cursor = Fassoc (BVAR (b, cursor_type), Vblink_cursor_alist), !NILP (alt_cursor))) | 28929 | if ((alt_cursor = Fassoc (BVAR (b, cursor_type), Vblink_cursor_alist, Qnil), !NILP (alt_cursor))) |
| 28930 | return get_specified_cursor_type (XCDR (alt_cursor), width); | 28930 | return get_specified_cursor_type (XCDR (alt_cursor), width); |
| 28931 | 28931 | ||
| 28932 | /* Then see if frame has specified a specific blink off cursor type. */ | 28932 | /* Then see if frame has specified a specific blink off cursor type. */ |
diff --git a/src/xfont.c b/src/xfont.c index b73596ce7ce..85fccf0dafd 100644 --- a/src/xfont.c +++ b/src/xfont.c | |||
| @@ -505,7 +505,8 @@ xfont_list (struct frame *f, Lisp_Object spec) | |||
| 505 | Lisp_Object alter; | 505 | Lisp_Object alter; |
| 506 | 506 | ||
| 507 | if ((alter = Fassoc (SYMBOL_NAME (registry), | 507 | if ((alter = Fassoc (SYMBOL_NAME (registry), |
| 508 | Vface_alternative_font_registry_alist), | 508 | Vface_alternative_font_registry_alist, |
| 509 | Qnil), | ||
| 509 | CONSP (alter))) | 510 | CONSP (alter))) |
| 510 | { | 511 | { |
| 511 | /* Pointer to REGISTRY-ENCODING field. */ | 512 | /* Pointer to REGISTRY-ENCODING field. */ |
diff --git a/test/src/fns-tests.el b/test/src/fns-tests.el index 2e463455f0c..e294859226c 100644 --- a/test/src/fns-tests.el +++ b/test/src/fns-tests.el | |||
| @@ -373,6 +373,12 @@ | |||
| 373 | (should-error (assoc 3 d1) :type 'wrong-type-argument) | 373 | (should-error (assoc 3 d1) :type 'wrong-type-argument) |
| 374 | (should-error (assoc 3 d2) :type 'wrong-type-argument))) | 374 | (should-error (assoc 3 d2) :type 'wrong-type-argument))) |
| 375 | 375 | ||
| 376 | (ert-deftest test-assoc-testfn () | ||
| 377 | (let ((alist '(("a" . 1) ("b" . 2)))) | ||
| 378 | (should-not (assoc "a" alist #'ignore)) | ||
| 379 | (should (eq (assoc "b" alist #'string-equal) (cadr alist))) | ||
| 380 | (should-not (assoc "b" alist #'eq)))) | ||
| 381 | |||
| 376 | (ert-deftest test-cycle-rassq () | 382 | (ert-deftest test-cycle-rassq () |
| 377 | (let ((c1 (cyc1 '(0 . 1))) | 383 | (let ((c1 (cyc1 '(0 . 1))) |
| 378 | (c2 (cyc2 '(0 . 1) '(0 . 2))) | 384 | (c2 (cyc2 '(0 . 1) '(0 . 2))) |