Commit graph

53 commits

Author SHA1 Message Date
Glenn Morris
1b075a9e38 ; Fix some tiny doc typos 2018-03-27 17:02:04 -04:00
Paul Eggert
5c7dd8a783 Update copyright year to 2018
Run admin/update-copyright.
2018-01-01 00:57:59 -08:00
Gemini Lasswell
928a106939 Fix Edebug specs for map-let and with-maps-do
* lisp/emacs-lisp/map.el (map-let): Fix Edebug spec (bug#24777).
* test/lisp/emacs-lisp/map-tests.el (with-maps-do): Fix Edebug spec.
2017-10-24 08:17:33 -07:00
Paul Eggert
bc511a64f6 Prefer HTTPS to FTP and HTTP in documentation
Most of this change is to boilerplate commentary such as license URLs.
This change was prompted by ftp://ftp.gnu.org's going-away party,
planned for November.  Change these FTP URLs to https://ftp.gnu.org
instead.  Make similar changes for URLs to other organizations moving
away from FTP.  Also, change HTTP to HTTPS for URLs to gnu.org and
fsf.org when this works, as this will further help defend against
man-in-the-middle attacks (for this part I omitted the MS-DOS and
MS-Windows sources and the test tarballs to keep the workload down).
HTTPS is not fully working to lists.gnu.org so I left those URLs alone
for now.
2017-09-13 15:54:37 -07:00
Tino Calancha
5e2ae74df5 * lisp/emacs-lisp/map.el (map-put): Fix redundancy in docstring. 2017-07-17 22:01:17 +09:00
Tino Calancha
76e1f7d00f alist-get: Add optional arg TESTFN
If TESTFN is non-nil, then it is the predicate to lookup
the alist.  Otherwise, use 'eq' (Bug#27584).
* lisp/subr.el (alist-get): Add optional arg FULL.
* lisp/emacs-lisp/map.el (map-elt, map-put): Add optional arg TESTFN.
* lisp/emacs-lisp/gv.el (alist-get): Update expander.
* doc/lispref/lists.texi (Association Lists): Update manual.
* etc/NEWS: Announce the changes.
* test/lisp/emacs-lisp/map-tests.el (test-map-put-testfn-alist)
(test-map-elt-testfn): New tests.
2017-07-17 21:30:50 +09:00
Paul Eggert
bcf244ef9b Merge from origin/emacs-25
2e2a806 Fix copyright years by hand
5badc81 Update copyright year to 2017
2017-01-01 01:10:47 -08:00
Paul Eggert
5badc81c1c Update copyright year to 2017
Run admin/update-copyright.
2016-12-31 19:42:26 -08:00
Robert Cochran
a4ba426d25 * lisp/emacs-lisp/map.el (map--dispatch): Fix docstring
The docstring referenced a non-existant parameter, as well as a
parameter that has been renamed since the docstring was written. Fix
both errors, fixing (Bug#24182).
2016-08-20 00:41:43 +02:00
Paul Eggert
8419f0d166 ; Spelling fixes 2016-06-26 13:38:48 +02:00
Nicolas Petton
87c9d8fcec * lisp/emacs-lisp/map.el (map-contains-key): Better docstring 2016-06-18 10:10:00 +02:00
Nicolas Petton
2aebb0dd1f Add new function map-do
* lisp/emacs-lisp/map.el (map-do, map--do-alist, map--do-array): New
  functions.
* test/lisp/emacs-lisp/map-tests.el: Add a unit test for map-do.
2016-06-18 10:10:00 +02:00
Stefan Monnier
44eca25a4b map.el (map-merge*): Use `map-into' at beginning rather than end
* lisp/emacs-lisp/map.el (map-merge): Use `map-into' for the first map,
and don't use of an intermediate alist.
(map-merge-with): Same, plus use `cl-callf' to try and avoid performing
3 lookups per inner iteration.
2016-06-18 00:52:58 -04:00
Nicolas Petton
3a13472ade Fix map-put and map-delete for alists (Bug#23105)
* lisp/emacs-lisp/map.el (map-put): Do not bind the evaluated place
expression to a new symbol.
* test/lisp/emacs-lisp/map-tests.el: Add a regression test.
2016-03-25 15:11:23 +01:00
Paul Eggert
91557f5e2d Quoting fixes in doc strings and diagnostics
* lisp/emacs-lisp/bytecomp.el (byte-compile-setq, byte-compile-funcall):
* lisp/gnus/mml-smime.el (mml-smime-get-dns-cert)
(mml-smime-get-ldap-cert):
Follow user style preference when quoting diagnostics.
2016-02-03 17:20:17 -08:00
Nicolas Petton
8b87ecb77d * lisp/emacs-lisp/map.el: Improvements to the docstring of the pcase macro 2016-02-03 15:18:36 +01:00
Paul Eggert
0e963201d0 Update copyright year to 2016
Run admin/update-copyright.
2016-01-01 01:34:24 -08:00
Nicolas Petton
51d840a8a1 Rename seq-p and map-p to seqp and mapp
* lisp/emacs-lisp/seq.el (seqp): New name.
* lisp/emacs-lisp/map.el (mapp): New name.
* doc/lispref/sequences.texi: Update the documentation for seqp.
* test/automated/map-tests.el: Update the tests for mapp.
2015-11-11 18:20:03 +01:00
Artur Malabarba
cbaa04014e * lisp/emacs-lisp/map.el (map-merge-with): New function
* test/automated/map-tests.el (test-map-merge-with): New test
2015-11-10 13:04:30 +00:00
Nicolas Petton
22579baf62 * lisp/emacs-lisp/map.el: Better docstrings. 2015-10-26 22:23:02 +01:00
Nicolas Petton
17d4f60b55 Fix typos in docstrings
* lisp/emacs-lisp/map.el:
* lisp/emacs-lisp/seq.el: Fix typos in the docstrings of the pcase
  macros.
2015-10-14 17:57:32 +02:00
Nicolas Petton
b5e2d74950 Better docstrings in seq.el and map.el
* lisp/emacs-lisp/map.el:
* lisp/emacs-lisp/seq.el: Improve the docstring for the pcase patterns.
2015-10-14 09:40:10 +02:00
Nicolas Petton
1b5fda5cbc Improve the semantic of map-some
Update map-some to return the returned by the predicate, similar to
seq-some.

* lisp/emacs-lisp/map.el (map-some): Update the function to return the
  return value of the predicate.
* test/automated/map-tests.el (test-map-some): Update the test to check
  for non-nil values only.
2015-09-06 00:51:35 +02:00
Nicolas Petton
a1535f9381 Rename map-contains-key-p and map-some-p
Remove the "-p" suffix from both function names.

* lisp/emacs-lisp/map.el (map-contains-key, map-some): Rename the functions.
* test/automated/map-tests.el (test-map-contains-key, test-map-some):
  Update both test functions.
2015-09-06 00:48:06 +02:00
Nicolas Petton
5509e2f93e Add support for gv.el in map.el
* lisp/emacs-lisp/map.el (map-elt, map-delete): Declare a gv-expander.
* lisp/emacs-lisp/map.el (map-put): Refactor using `setf' and `map-elt'.
* test/automated/map-tests.el: Update tests to work with the new
implementations of map-elt and map-put.
2015-07-09 19:49:47 +02:00
Nicolas Petton
fa52edd4c4 Revert "Define `map-elt' as a generalized variable"
This reverts commit 8b6d82d3ca.
2015-06-21 23:44:50 +02:00
Nicolas Petton
8b6d82d3ca Define `map-elt' as a generalized variable
* lisp/emacs-lisp/map.el (map-elt): Define a gv-expander.

* lisp/emacs-lisp/map.el (map--dispatch): Tighten the code.

* lisp/emacs-lisp/map.el (map-put): Redefine it as a function using a
`setf' with `map-elt'.

* test/automated/map-tests.el: Comment out `test-map-put-literal'.
2015-06-21 20:49:16 +02:00
Nicolas Petton
a94202b78a Reuse `alist-get' in map.el
* lisp/emacs-lisp/map.el (map-elt): Use `alist-get' to retrieve alist
elements.
2015-06-21 20:26:52 +02:00
Nicolas Petton
7d5c120fed * lisp/emacs-lisp/map.el (map-into): Fix a byte-compiler warning. 2015-06-16 23:04:03 +02:00
Nicolas Petton
c8dc4d6804 * lisp/emacs-lisp/map.el (map-let): Better docstring. 2015-06-15 12:43:09 +02:00
Nicolas Petton
30e518379e * lisp/emacs-lisp/map.el (map-let): Better docstring. 2015-06-06 01:54:11 +02:00
Nicolas Petton
2a54e8dfff Better syntax for the map pcase pattern
* lisp/emacs-lisp/map.el: Improves the map pcase pattern to take
bindings of the form (KEY PAT) or SYMBOL. KEY is not quoted.
2015-06-06 01:50:32 +02:00
Nicolas Petton
cd22663b85 * lisp/emacs-lisp/map.el (map--dispatch): Better docstring. 2015-06-06 01:26:25 +02:00
Nicolas Petton
431fca48a8 ; * lisp/emacs-lisp/map.el: Fix formatting. 2015-06-06 01:26:25 +02:00
Nicolas Petton
8fe836abbd Fix a byte-compiler error in map-put and map-delete
* lisp/emacs-lisp/map.el (map-put, map-delete): Ensure that `setq' is
called with a symbol.
2015-06-06 01:26:25 +02:00
Glenn Morris
b0eb66823f * lisp/emacs-lisp/map.el (map--dispatch): Move before use.
(map--delete-array): Fix typo.
2015-06-05 16:30:39 -04:00
Nicolas Petton
cfb35800a8 * lisp/emacs-lisp/map.el: Better docstring for the map pcase macro. 2015-06-04 22:26:22 +02:00
Nicolas Petton
988d721186 Add a pcase pattern for maps and `map-let' based on it
* lisp/emacs-lisp/map.el (map-let): New macro.
(map--make-pcase-bindings, map--make-pcase-patterns): New functions.
* test/automated/map-tests.el: New test for `map-let'.
2015-06-02 22:19:48 +02:00
Nicolas Petton
3fe404ca66 Improve the docstring of functions in map.el
Since a map is not a data structure but a concept, adding information
about the possible types of maps can be useful information.

* lisp/emacs-lisp/map.el: Add documentation about the type of MAP to
each public function.
2015-05-16 11:30:12 +02:00
Nicolas Petton
a5237a0499 Faster implementation of map-empty-p
* lisp/emacs-lisp/map.el (map-empty-p): Faster implementation using
specific tests depending on the type of the map.
2015-04-29 19:05:44 +02:00
Nicolas Petton
12a3ea52c4 * lisp/emacs-lisp/map.el: Better docstrings. 2015-04-29 19:01:40 +02:00
Artur Malabarba
c576ab54b5 * lisp/emacs-lisp/map.el (map-pairs): Dump redundant lambda 2015-04-25 17:27:13 +01:00
Nicolas Petton
5e52b0a076 * lisp/emacs-lisp/map.el (map--elt-list): Better docstring. 2015-04-25 16:56:19 +02:00
Nicolas Petton
40a8a12a26 * lisp/emacs-lisp/map.el (map--elt-list): Minor refactoring. 2015-04-25 16:53:09 +02:00
Nicolas Petton
62879799ea Fix a false negative in `map-elt' with alists and values being nil
* lisp/emacs-lisp/map.el (map-elt): If map is an alist and key is
found but its associated value is nil, do not return the default
value.

* test/automated/map-tests.el: Add a regression test.
2015-04-25 12:07:12 +02:00
Nicolas Petton
eea2e83138 * lisp/emacs-lisp/map.el (map--dispatch): Improve the docstring. 2015-04-24 19:33:18 +02:00
Nicolas Petton
d75151a671 Do not signal an error when trying to delete a key from an array
* lisp/emacs-lisp/map.el (map-delete): When map is an array, check if
the key is present to avoid signaling an error.

* test/automated/map-tests.el: Add a test for deleting non-existing
keys from maps.
2015-04-24 19:29:59 +02:00
Nicolas Petton
79d9757c23 * lisp/emacs-lisp/map.el: Better docstring. 2015-04-24 19:15:23 +02:00
Nicolas Petton
f37e265ea9 Minor improvement in map-elt.
* lisp/emacs-lisp/map.el (map-elt): Do not use `ignore-errors' when
doing a lookup in arrays, but check the boundaries of the array
instead.

* test/automated/map-tests.el: Adds a test for `map-elt' with arrays
and a negative integer as key.
2015-04-24 19:10:45 +02:00
Nicolas Petton
a76628fd56 * lisp/emacs-lisp/map.el (map-into): Better error message. 2015-04-18 20:07:34 +02:00