summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/subr-x.el
Commit message (Collapse)AuthorAgeFilesLines
...
* Add new functions for lax mail address splittingLars Ingebrigtsen2021-08-141-0/+1
| | | | | | * lisp/emacs-lisp/subr-x.el (string-clean-whitespace): Autoload. * lisp/mail/mail-parse.el (mail-header-parse-addresses-lax) (mail-header-parse-address-lax): New functions.
* Attempt to make defclass documentation more legibleLars Ingebrigtsen2021-06-241-0/+1
| | | | | | * lisp/emacs-lisp/cl-extra.el (cl--print-table): Attempt to make defclass documentation more readable (bug#30998). (cl--describe-class-slots): Ditto.
* * lisp/emacs-lisp/subr-x.el (if-let*, if-let): Use looser Edebug specStefan Monnier2021-05-221-12/+5
| | | | | | This makes the same spec work both for `if-let` and `when-let`. (when-let*, and-let*, when-let): Simplify accordingly.
* Give 'when-let' and 'when-let*' their own Edebug specification.Philipp Stephani2021-05-221-2/+7
| | | | | | | | | The Edebug specification of 'if-let' and 'if-let*' doesn't work if the body is empty. While that's a pathological case, it's not wrong per se, and could arguably happen due to macro expansion. * lisp/emacs-lisp/subr-x.el (when-let*, when-let): Don't reuse Edebug specification from 'if-let*' and 'if-let'.
* * lisp/emacs-lisp/subr-x.el (if-let): Swap &or branches (Bug#48489)Philipp Stephani2021-05-181-2/+2
|
* Fix the tests for 'string-limit'Eli Zaretskii2021-05-121-0/+12
| | | | | | | | | * test/lisp/emacs-lisp/subr-x-tests.el (subr-string-limit-coding): Fix the expected results of string-limit when encoding with UTF-16. Add tests for UTF-8 with BOM. (Bug#48324) * lisp/emacs-lisp/subr-x.el (string-limit): Add FIXME comment about the current implementation, which is faulty by design.
* Move string-trim functions to subr.elLars Ingebrigtsen2021-03-241-22/+0
| | | | | | | | | | | | * doc/lispref/strings.texi (Creating Strings): Document them. * lisp/faces.el: Don't require subr-x, because that leads to build errors. * lisp/subr.el (string-trim, string-trim-right) (string-trim-left): Move here from subr-x.el. * lisp/emacs-lisp/shortdoc.el (string): Adjust.
* * lisp/emacs-lisp/subr-x.el (named-let): New macroStefan Monnier2021-01-201-0/+22
|
* Update copyright year to 2021Paul Eggert2021-01-011-1/+1
| | | | Run "TZ=UTC0 admin/update-copyright".
* Allow `string-limit' to work on encoded stringsLars Ingebrigtsen2020-12-251-5/+29
| | | | | | | * doc/lispref/strings.texi (Creating Strings): Document it. * lisp/emacs-lisp/subr-x.el (string-limit): Allow limiting on encoded strings.
* Remove `string-slice' -- it's not very well definedLars Ingebrigtsen2020-12-251-13/+0
| | | | | | * doc/lispref/strings.texi (Creating Strings): Ditto. * lisp/emacs-lisp/subr-x.el (string-slice): Remove.
* Improve the string-limit doc stringLars Ingebrigtsen2020-12-231-1/+5
| | | | | * lisp/emacs-lisp/subr-x.el (string-limit): Mention truncate-string-to-width in the doc string.
* Allow string-slice to take zero-length matchesLars Ingebrigtsen2020-12-231-13/+10
| | | | | * lisp/emacs-lisp/subr-x.el (string-slice): Allow zero-length matches. Code adapted from s.el by Magnar Sveen.
* ; Fix docstrings in last change to subr-x.elBasil L. Contovounesios2020-12-221-3/+3
|
* Make string-pad take an optional START parameterLars Ingebrigtsen2020-12-221-6/+8
| | | | | * lisp/emacs-lisp/subr-x.el (string-pad): Alter the calling convention.
* Change the string-limit parameter semanticsLars Ingebrigtsen2020-12-221-8/+11
| | | | | * lisp/emacs-lisp/subr-x.el (string-limit): Alter the calling convention.
* Further string-clean-whitespace tweaksLars Ingebrigtsen2020-12-221-1/+1
| | | | | * lisp/emacs-lisp/subr-x.el (string-clean-whitespace): Put \r back, which was mistakenly removed.
* Tiny string-clean-whitespace simplificationBasil L. Contovounesios2020-12-211-1/+1
| | | | | * lisp/emacs-lisp/subr-x.el (string-clean-whitespace): Streamline by treating replacement string as being literal and having fixed case.
* Make string-chop-newline more efficientLars Ingebrigtsen2020-12-211-1/+1
| | | | | * lisp/emacs-lisp/subr-x.el (string-chop-newline): Make more efficient.
* Make string-clean-whitespace work on non-ASCII whitespace, tooLars Ingebrigtsen2020-12-211-1/+3
| | | | | * lisp/emacs-lisp/subr-x.el (string-clean-whitespace): Also clean up non-ASCII whitespace.
* Add string-chop-newlineLars Ingebrigtsen2020-12-211-0/+4
| | | | | * doc/lispref/strings.texi (Creating Strings): Document it. * lisp/emacs-lisp/subr-x.el (string-chop-newline): Add new function.
* ; Fix recent string utility additionsBasil L. Contovounesios2020-12-211-9/+9
| | | | | | | | * etc/NEWS: Fix typo. * lisp/emacs-lisp/subr-x.el (string-limit): Fix typos in docstring. Simplify. (string-slice): Improve docstring wording. (string-pad): Simplify.
* Fix shorter-than-length case for string-limitLars Ingebrigtsen2020-12-211-1/+1
| | | | | * lisp/emacs-lisp/subr-x.el (string-limit): Fix shorter-than-length case.
* Rename slice-string to string-sliceLars Ingebrigtsen2020-12-211-1/+1
| | | | | * lisp/emacs-lisp/subr-x.el (string-slice): Rename from slice-string. * doc/lispref/strings.texi (Creating Strings): Ditto.
* Add `string-pad'Lars Ingebrigtsen2020-12-211-0/+20
| | | | | | | * doc/lispref/strings.texi (Creating Strings): Document it. * lisp/emacs-lisp/shortdoc.el (string): Add example. * lisp/emacs-lisp/subr-x.el (string-pad): New function.
* Beef up the Emacs string utility set a bitLars Ingebrigtsen2020-12-211-0/+53
| | | | | | | | | * doc/lispref/strings.texi (Modifying Strings): Document them. * lisp/emacs-lisp/shortdoc.el (string): Add examples. * lisp/emacs-lisp/subr-x.el (string-clean-whitespace) (string-fill, string-limit, string-lines, slice-string): New functions.
* Give better error feedback on wrong password in .gpg filesLars Ingebrigtsen2020-09-301-0/+1
| | | | | | | | | | * lisp/epa-file.el (epa-file--find-file-not-found-function): Do a user-error when there's a wrong password (bug#43704). (epa--wrong-password-p): New function. (epa-file-insert-file-contents): Use it, and stash the error away for later signalling. * lisp/emacs-lisp/subr-x.el (if-let): Autoload.
* gnus-shorten-url: Improve and avoid args-out-of-range errorŠtěpán Němec2020-04-131-0/+9
| | | | | | | | | | | | | | | | | | | 'gnus-shorten-url' (used by 'gnus-summary-browse-url') ignored fragment identifiers and didn't check substring bounds, in some cases leading to runtime errors, e.g.: (gnus-shorten-url "https://some.url.with/path/and#also_a_long_target" 40) ;; => Lisp error: (args-out-of-range "/path/and" -18 nil) This commit makes it account for #fragments and fixes faulty string computation, reusing existing helper function. (bug#39980) * lisp/vc/ediff-init.el (ediff-truncate-string-left): Rename to 'string-truncate-left' and move... * lisp/emacs-lisp/subr-x.el (string-truncate-left): ...here. All callers changed. * lisp/gnus/gnus-sum.el (gnus-shorten-url): Fix args-out-of-range error, don't drop #fragments, use 'string-truncate-left'.
* Update copyright year to 2020Paul Eggert2020-01-011-1/+1
| | | | Run "TZ=UTC0 admin/update-copyright $(git ls-files)".
* Move describe-face to the new help-fns machineryLars Ingebrigtsen2019-09-211-0/+1
| | | | | | | | | | * lisp/help-fns.el (describe-face): Move to here from faces.el and split up (bug#36670). (help-fns--face-custom-version-info): (help-fns--face-attributes): Factored out into own functions. (help-fns-describe-face-functions): New variable. * lisp/emacs-lisp/subr-x.el (when-let): Add autoload cookie.
* Clarify what counts as whitespace in `string-blank-p'Mattias Engdegård2019-09-011-1/+3
| | | | * lisp/emacs-lisp/subr-x.el (string-blank-p): Expand doc string.
* (if-let): Improve docstring by mentioning let*Alex Branham2019-06-231-2/+3
| | | | | * lisp/emacs-lisp/subr-x.el (if-let): Clarify that if-let is like let*, not like let (bug#33550).
* Go back to "Maintainer: emacs-devel@gnu.org"Paul Eggert2019-05-251-0/+1
| | | | | | Restore lines saying "Maintainer: emacs-devel@gnu.org" when there is no special maintainer for a file. Although this wasn't documented it was common practice and removing the lines didn't have consensus.
* Fixes for "Maintainer:" and related linesPaul Eggert2019-05-191-1/+0
| | | | | | Mostly, this just removes "Maintainer: emacs-devel@gnu.org" lines, which are not that useful. It also cleans up and regularizes a few similar lines.
* Improve replace-buffer-contents/replace-region-contentsTassilo Horn2019-02-231-0/+29
| | | | | | | | | | | | | | * src/editfns.c (Freplace_buffer_contents): Add two optional arguments for mitigating performance issues. * lisp/emacs-lisp/subr-x.el (replace-region-contents): Move from subr.el. Add the same two arguments as for replace-buffer-contents. * lisp/json.el (json-pretty-print-max-secs): New variable holding the default MAX-SECS value json-pretty-print passes to replace-buffer-contents. (json-pretty-print): Use it. * doc/lispref/text.texi (Replacing): Add documentation for replace-buffer-contents two new optional arguments. Document replace-region-contents.
* Merge from origin/emacs-26Paul Eggert2018-12-311-1/+1
|\ | | | | | | | | | | 2fcf2df Fix copyright years by hand 26bed8b Update copyright year to 2019 2814292 Fix value of default frame height. (Bug#33921)
| * Update copyright year to 2019Paul Eggert2019-01-011-1/+1
| | | | | | | | Run 'TZ=UTC0 admin/update-copyright $(git ls-files)'.
* | Merge from origin/emacs-26Glenn Morris2018-12-021-16/+13
|\| | | | | | | | | | | 745c9c0 (origin/emacs-26) Revert "Revert "Fix infloop in GC mark_kboa... c418c85 Revert "Fix infloop in GC mark_kboards" 8fa0d96 * lisp/emacs-lisp/subr-x.el (if-let, when-let): Doc fix: acti...
| * * lisp/emacs-lisp/subr-x.el (if-let, when-let): Doc fix: active voice.Glenn Morris2018-12-011-16/+13
| |
* | Tweak subr-x.el substring functionsBasil L. Contovounesios2018-07-131-6/+6
| | | | | | | | | | | | | | | | | | | | * lisp/emacs-lisp/subr-x.el (string-join): #'-quote function symbol. (string-trim-left, string-trim-right): Make better use of substring for minor speedup. * test/lisp/emacs-lisp/subr-x-tests.el (subr-x-test-string-trim-left, subr-x-test-string-trim-right) (subr-x-test-string-remove-prefix) (subr-x-test-string-remove-suffix): New tests.
* | Change errant if to when (Bug#31840)Mark Oteiza2018-06-181-2/+2
|/ | | | * lisp/emacs-lisp/subr-x.el: Expand to 'when' instead of 'if'.
* De-obsolete `if-let' and `when-let'Michael Heerdegen2018-03-271-20/+26
| | | | | | | | | | For the following release it is planned to make `if-let*' and `when-let*' aliases for `if-let' and `when-let'. For now we revert declaring `if-let' and `when-let' obsolete and tweak the docstrings. * lisp/emacs-lisp/subr-x.el (if-let*, when-let*): Make docstrings refer to those of `if-let' and `when-let'. (if-let, when-let): De-obsolete. Rewrite documentation.
* Revert last commitMichael Heerdegen2018-03-061-23/+32
| | | | | This reverts commit af4697faa1f5b643f63a9ea61aa205a4c1432e23. It's too late for this to be in the release.
* Define if-let* and derivatives as aliases for if-let etcMichael Heerdegen2018-03-061-32/+23
| | | | | | | | | | | | | | | | | | This commit reverts declaring `if-let' and `when-let' obsolete in favor of the new `if-let*' and `when-let*' versions because of the compiler warning mess (Bug#30039). Instead we make foo-let* aliases for foo-let. The old single-tuple variable spec case is still supported for backward compatibility. * lisp/emacs-lisp/subr-x.el (if-let, when-let): Don't declare obsolete. Tweak edebug specs. (and-let): Renamed from `and-let*' for compatibility with the names `if-let' and `when-let'. (if-let*, when-let*, and-let*): Define as aliases for `if-let', `when-let' and `and-let'. * test/lisp/emacs-lisp/subr-x-tests.el (if-let-single-tuple-case-test) (when-let-single-tuple-case-test): New tests for the single-binding tuple case. In the whole file, prefer the names without "*".
* Update copyright year to 2018Paul Eggert2018-01-011-1/+1
| | | | Run admin/update-copyright.
* Fix Edebug specs for if-let* and and-let* (Bug#29236)Gemini Lasswell2017-11-261-3/+5
| | | | | | | | | | | * test/lisp/emacs-lisp/subr-x.el (if-let*, if-let): Change Edebug spec to cause Edebug to instrument tests the results of which are not bound to symbols (the (VALUEFORM) case). (and-let*): Change Edebug spec to allow empty body. *test/lisp/emacs-lisp/subr-x-tests.el: (subr-x-and-let*-test-group-1): Add missing quote to erroneous form so Edebug will work on this test.
* maint: shorten https://lists.gnu.org/archive/html/... linksPaul Eggert2017-11-251-1/+1
|
* Move read-multiple-choice to its own libraryMark Oteiza2017-10-061-170/+0
| | | | | | | * lisp/emacs-lisp/rmc.el: New file. * lisp/emacs-lisp/subr-x.el (read-multiple-choice): Remove. * lisp/gnus/message.el: * lisp/net/nsm.el: Change required library.
* Prefer HTTPS to HTTP for gnu.orgPaul Eggert2017-10-011-1/+1
| | | | | | | | | This fixes some URLs I omitted from my previous pass, notably those in lists.gnu.org. Although lists.gnu.org does not yet support TLS 1.1, TLS 1.0 is better than nothing. * lisp/erc/erc.el (erc-official-location): * lisp/mail/emacsbug.el (report-emacs-bug): Use https:, not http:.
* ; Fix typoMark Oteiza2017-09-221-1/+1
| | | | * lisp/emacs-lisp/subr-x.el: Nix extra parenthesis.