summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/subr-x.el
Commit message (Collapse)AuthorAge
* Add some `pure` and `side-effect-free` declarationsMattias Engdegård2023-02-15
| | | | | | | | | | * lisp/subr.el (string-to-list, string-to-vector, string-or-null-p) (booleanp, special-form-p, plistp, macrop, compiled-function-p) (flatten-tree): * lisp/emacs-lisp/subr-x.el (string-join, string-truncate-left) (string-blank-p, string-remove-prefix, string-remove-suffix) (string-pad, string-chop-newline): Declare functions pure, side-effect-free, and/or error-free.
* ; Add 2023 to copyright years.Eli Zaretskii2023-01-01
|
* ; Fix typosStefan Kangas2022-12-31
|
* ; Review and fix NEWS and related documentationEli Zaretskii2022-12-25
| | | | | | | | | * etc/NEWS: Fix wording, punctuation, and markup. * lisp/emacs-lisp/subr-x.el (string-glyph-split): Doc fix. * doc/lispref/display.texi (Displaying Messages): Document 'set-message-functions'.
* ; Don't quote nil in commentsStefan Kangas2022-12-15
|
* Fix 'add-display-text-property' when OBJECT is non-nilEli Zaretskii2022-12-06
| | | | | | | | * lisp/emacs-lisp/subr-x.el (add-display-text-property): Fix the case where OBJECT is not nil. (Bug#59857) * test/lisp/emacs-lisp/subr-x-tests.el (subr-x-test-add-display-text-property): Add test for this case.
* Disable display-line-numbers-mode in string-pixel-width (bug#59311)Juri Linkov2022-11-20
| | | | | * lisp/emacs-lisp/subr-x.el (string-pixel-width): Turn off display-line-numbers-mode when it's enabled.
* Autoload string-joinLars Ingebrigtsen2022-09-17
| | | | | * lisp/emacs-lisp/subr-x.el (string-join): Autoload since it's being used more now.
* Hide local variable section in emacs-news-modesStefan Kangas2022-08-12
| | | | | | | | | | | | | | * lisp/textmodes/emacs-authors-mode.el (emacs-authors-mode--hide-local-variables): Move from here... * lisp/emacs-lisp/subr-x.el (emacs-etc--hide-local-variables): ...to here. * lisp/textmodes/emacs-authors-mode.el (subr-x): Require. (emacs-authors-mode): Use above renamed function. * lisp/textmodes/emacs-news-mode.el (subr-x): Require. (emacs-news--mode-common): Call 'emacs-etc--hide-local-variables' to hide local variables section.
* ; * lisp/emacs-lisp/subr-x.el (string-pad): Optimise.Mattias Engdegård2022-08-10
|
* Autoload string-blank-pStefan Kangas2022-08-09
| | | | | | * lisp/eshell/em-hist.el (subr-x): * lisp/net/eudc.el (subr-x): Don't require. * lisp/emacs-lisp/subr-x.el (string-blank-p): Autoload.
* Fix off-by-one error in string-truncate-leftLars Ingebrigtsen2022-07-23
| | | | | * lisp/emacs-lisp/subr-x.el (string-truncate-left): Fix off-by-one error (bug#56685).
* Autoload named-letLars Ingebrigtsen2022-07-11
| | | | | * lisp/emacs-lisp/subr-x.el (named-let): Autoload `named-let' for easier use (bug#56473).
* ; * lisp/emacs-lisp/subr-x.el (string-limit): Clarify doc string.Eli Zaretskii2022-07-05
|
* Mention byte order marks in string-limit doc stringLars Ingebrigtsen2022-07-05
| | | | | * lisp/emacs-lisp/subr-x.el (string-limit): Mention byte order marks (bug#48324).
* Make string-limit with encoding return complete glyphsLars Ingebrigtsen2022-07-03
| | | | | | | * lisp/emacs-lisp/subr-x.el (string-limit): Return more correct results in the CODING-SYSTEM case for coding systems with BOM and charset designations (bug#48324). Also amend the algorithm to return complete glyphs, not just complete code points.
* Re-fix build warnings about subr-x defsubstsLars Ingebrigtsen2022-06-25
| | | | | | | | | | | | * lisp/term/haiku-win.el (require): * lisp/progmodes/elisp-mode.el (require): * lisp/isearch.el (require): Require subr-x at compile time, since these use defsubsts/macros from there. * lisp/emacs-lisp/subr-x.el (string-empty-p): Move from here... * lisp/simple.el (string-empty-p): ... to here. This is to help with a build problem where files.el is using the defsubst, but requiring subr-x.el at compile time leads to load errors.
* Fix cl-generic bootstrap problemsLars Ingebrigtsen2022-06-24
| | | | | | | | | | | | | | | | | | | | | * lisp/sqlite-mode.el (require): * lisp/net/eudc.el (require): * lisp/arc-mode.el (require): Require subr-x, since these files are using macros from there. * lisp/emacs-lisp/subr-x.el (with-memoization): Move from here... * lisp/subr.el (with-memoization): ... to here, as it's used from the preloaded cl-generic.el file. * lisp/emacs-lisp/cl-generic.el (cl--generic-compiler): Don't use the autoloaded `byte-compile' function during bootstrap. (cl--generic-get-dispatcher): Don't require subr-x, either. cl-generic has been preloaded since 2015, and most usages of it (in preloaded files) work fine. In particular, using `cl-defgeneric' is unproblematic. However, `cl-defmethod' would end up pulling in the byte compiler (at load time), which would make it impossible to use `cl-defmethod' in pre-loaded files, and this change fixes that (but possibly not in the most self-evidently correct way).
* Slightly faster hash-table-keys and hash-table-valuesMattias Engdegård2022-06-17
| | | | | | | * lisp/emacs-lisp/subr-x.el (hash-table-keys, hash-table-values): Omit the reversal of the returned list. It is not ordered anyway. * test/lisp/emacs-lisp/subr-x-tests.el (subr-x--hash-table-keys-and-values): New test.
* ; Re-fix last change in doc of 'with-buffer-unmodified-if-unchanged'.Robert Pluim2022-05-04
|
* ; Fix last change in doc string of 'with-buffer-unmodified-if-unchanged'.Eli Zaretskii2022-05-04
|
* Clarify the doc string of 'with-buffer-unmodified-if-unchanged'Eli Zaretskii2022-05-04
| | | | | * lisp/emacs-lisp/subr-x.el (with-buffer-unmodified-if-unchanged): Describe better what is meant by "buffer changes". (Bug#4587)
* Make with-buffer-unmodified-if-unchanged more efficientLars Ingebrigtsen2022-05-03
| | | | | * lisp/emacs-lisp/subr-x.el (with-buffer-unmodified-if-unchanged): Make more efficient.
* Make with-buffer-unmodified-if-unchanged more resilientLars Ingebrigtsen2022-05-03
| | | | | * lisp/emacs-lisp/subr-x.el (with-buffer-unmodified-if-unchanged): Make more resilient.
* with-buffer-unmodified-if-unchanged: Tweak the implementationStefan Monnier2022-05-03
| | | | | | | * lisp/emacs-lisp/subr-x.el (with-buffer-unmodified-if-unchanged): Skip the hash if the buffer was not modified at all. Use `restore-buffer-modified-p`. Also mention that it's imperative that the current buffer is preserved.
* Add new macro with-buffer-unmodified-if-unchangedLars Ingebrigtsen2022-05-03
| | | | | | | * lisp/emacs-lisp/subr-x.el (with-buffer-unmodified-if-unchanged): New macro. * lisp/textmodes/fill.el (fill-paragraph): Macro code copied from here. Adjust and use the macro.
* Move the when-let family of macros to subr.elLars Ingebrigtsen2022-04-30
| | | | | | | | | | * lisp/subr.el (internal--build-binding) (internal--build-bindings): Moved from subr-x.el and rewritten to not use the threading macro. (if-let*, when-let*, and-let*, if-let, when-let): Moved from subr-x.el. This avoids breaking the build every time somebody uses these macros in functions that end up being called during bootstrap.
* Fix bootstrap errors after previous easy-mmode changeLars Ingebrigtsen2022-04-02
| | | | | | | | * lisp/subr.el (ensure-empty-lines, string-lines): Moved from subr-x so that they can be used in early bootstrap files. * lisp/emacs-lisp/easy-mmode.el (easy-mmode--mode-docstring): Don't use string-empty-p because of bootstrap issues.
* Make string-pixel-width about 40% fasterLars Ingebrigtsen2022-02-20
| | | | * lisp/emacs-lisp/subr-x.el (string-pixel-width): Speed up.
* Make string-pixel-width slightly speedierLars Ingebrigtsen2022-02-19
| | | | | * lisp/emacs-lisp/subr-x.el (string-pixel-width): Speed up string-pixel-width in the zero-length string case.
* Add new function to prompt a user for a process namePhil Sainty2022-01-23
| | | | | * lisp/emacs-lisp/subr-x.el (read-process-name): New function (bug#32640).
* Merge from origin/emacs-28Eli Zaretskii2022-01-01
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 836be7a112 ; * etc/refcards/ru-refcard.tex: Update Copyright year. 86cbc6ee4a * lisp/net/tramp-sh.el: Adapt copyright year ebe8772f65 ; Minor fixes related to copyright years 23c1ee6989 ; * test/manual/etags/ETAGS.good_N: Adjust to copyright ye... 8d3fc7ec89 * src/xfaces.c (face_for_font): Make 'hash' be uintptr_t. 19dcb237b5 ; Add 2022 to copyright years. # Conflicts: # etc/NEWS # etc/refcards/ru-refcard.tex # lib/cdefs.h # lisp/erc/erc-dcc.el # lisp/erc/erc-imenu.el # lisp/erc/erc-replace.el # lisp/image-dired.el # lisp/progmodes/xref.el # m4/alloca.m4 # m4/byteswap.m4 # m4/errno_h.m4 # m4/getopt.m4 # m4/gnulib-common.m4 # m4/inttypes.m4 # m4/stddef_h.m4 # m4/stdint.m4 # m4/sys_socket_h.m4
| * ; Add 2022 to copyright years.Eli Zaretskii2022-01-01
| |
* | Remove APPEND argument from add-display-text-propertyLars Ingebrigtsen2021-11-24
| | | | | | | | | | | | * doc/lispref/display.texi (Display Property): Update doc. * lisp/emacs-lisp/subr-x.el (add-display-text-property): Remove the append argument -- it's nonsensical.
* | Add new function 'add-display-text-property'Lars Ingebrigtsen2021-11-24
| | | | | | | | | | * doc/lispref/display.texi (Display Property): Document it. * lisp/emacs-lisp/subr-x.el (add-display-text-property): New function.
* | Fix string-glyph-split infloopLars Ingebrigtsen2021-11-24
| | | | | | | | | | * lisp/emacs-lisp/subr-x.el (string-glyph-split): Fix infloop when applied to (string-glyph-split "✈️🌍") (bug#52067).
* | Add new function buffer-text-pixel-sizemartin rudalics2021-11-22
| | | | | | | | | | | | | | | | | | | | | | * doc/lispref/display.texi (Size of Displayed Text): Document it. * lisp/emacs-lisp/subr-x.el (string-pixel-width): Use buffer-text-pixel-size (bug#51995). * src/xdisp.c (window_text_pixel_size): Factor out from Fwindow_text_pixel_size. (Fbuffer_text_pixel_size): New function.
* | Improve 'ensure-empty-lines' docstringRobert Pluim2021-11-10
| | | | | | | | | | * lisp/emacs-lisp/subr-x.el (ensure-empty-lines): Fix typo and improve wording.
* | Add new function string-glyph-splitLars Ingebrigtsen2021-10-30
| | | | | | | | | | | | | | * doc/lispref/strings.texi (Creating Strings): Document it. * lisp/emacs-lisp/shortdoc.el (string): Mention it. * lisp/emacs-lisp/subr-x.el (string-glyph-split): New function.
* | Merge from origin/emacs-28Eli Zaretskii2021-10-30
|\| | | | | | | | | 20ebd91a73 Improve documentation of string truncation APIs 3f998a3fc8 * lisp/textmodes/css-mode.el: Fix typo. (Bug#51488)
| * Improve documentation of string truncation APIsEli Zaretskii2021-10-30
| | | | | | | | | | | | | | | | | | | | | | * doc/lispref/display.texi (Size of Displayed Text): * lisp/international/mule-util.el (truncate-string-to-width): Document caveats of using 'truncate-string-to-width' when character composition is involved. * lisp/emacs-lisp/subr-x.el (string-limit): * doc/lispref/strings.texi (Creating Strings): Improve the documentation of 'string-limit'.
* | (string-pixel-width): Rewrite to avoid side effectsStefan Monnier2021-10-27
| | | | | | | | | | * src/xdisp.c (Fwindow_text_pixel_size): Allow `window` to be a buffer. * lisp/emacs-lisp/subr-x.el (string-pixel-width): Simplify accordingly.
* | Simplify string-pixel-widthLars Ingebrigtsen2021-10-27
| | | | | | | | | | | | * lisp/emacs-lisp/subr-x.el (string-pixel-width): Simplify -- save-window-excursion saves dedication status (and the code was buggy).
* | Add new function 'string-pixel-width'Lars Ingebrigtsen2021-10-27
| | | | | | | | | | | | | | * doc/lispref/display.texi (Size of Displayed Text): Mention it. * lisp/emacs-lisp/shortdoc.el (string): Mention it. * lisp/emacs-lisp/subr-x.el (string-pixel-width): New function.
* | Make 'mapconcat' argument 'separator' optionalStefan Kangas2021-10-05
| | | | | | | | | | | | | | | | | | | | | | | | * src/fns.c (Fmapconcat): Make third 'separator' argument optional. (Bug#50965) * doc/lispref/functions.texi (Mapping Functions): Update documentation for above change. * test/src/fns-tests.el (fns-tests-mapconcat): New test. * doc/misc/cl.texi (Obsolete Setf Customization): Don't use third mapconcat argument in example. * lisp/emacs-lisp/subr-x.el (string-join): Doc fix.
* | Add new command 'ensure-empty-lines'.Lars Ingebrigtsen2021-10-04
| | | | | | | | | | | | * doc/lispref/text.texi (Commands for Insertion): Document it. * lisp/emacs-lisp/subr-x.el (ensure-empty-lines): New command.
* | * lisp/emacs-lisp/subr-x.el (with-memoization): New macroStefan Monnier2021-10-01
|/ | | | | | | | Extracted from `cl-generic.el`. * lisp/emacs-lisp/cl-generic.el (cl--generic-get-dispatcher) (cl--generic-build-combined-method, cl-generic-generalizers): Use it. (cl--generic-with-memoization): Delete.
* Change how thread-first/thread-last indent the first argumentLars Ingebrigtsen2021-09-22
| | | | | | | | | | | | | | * lisp/doc-view.el (doc-view--current-cache-dir): Reindent. * lisp/emacs-lisp/subr-x.el (thread-first): (thread-last): Change indentation to match examples. (internal--build-binding): Reindent. * test/lisp/emacs-lisp/subr-x-tests.el (subr-x-test-thread-first-function-names-are-threaded): (subr-x-test-thread-first-examples): (subr-x-test-thread-last-function-names-are-threaded): (subr-x-test-thread-last-examples): Reindent.
* Add new functions for lax mail address splittingLars Ingebrigtsen2021-08-14
| | | | | | * 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-24
| | | | | | * lisp/emacs-lisp/cl-extra.el (cl--print-table): Attempt to make defclass documentation more readable (bug#30998). (cl--describe-class-slots): Ditto.