Commit graph

2076 commits

Author SHA1 Message Date
Juri Linkov
03d6644970 * lisp/subr.el (insert-for-yank): Add nil to run-hook-wrapped to keep looping. 2022-05-25 20:45:49 +03:00
Stefan Monnier
5c1c614940 Make yank-transform-functions a proper hook
* lisp/subr.el (insert-for-yank): Use `run-hook-wrapped` to run
`yank-transform-functions`.
* lisp/simple.el (yank-transform-functions): Adjust accordingly.
2022-05-24 12:29:54 -04:00
Lars Ingebrigtsen
be17333ace Tweak remapping fix for set-transient-map
* lisp/subr.el (set-transient-map): The remapping doesn't have to
be in this map.
2022-05-24 14:55:03 +02:00
Lars Ingebrigtsen
250b728284 Improve command-error-function discoverability
* lisp/subr.el (error, user-error): Point to command-error-function.

* src/keyboard.c (syms_of_keyboard): Add an example (bug#40750).
2022-05-23 13:56:12 +02:00
Lars Ingebrigtsen
e5d76634a2 Make remapped keys work in set-transient-map
* lisp/subr.el (set-transient-map): Make remapped keys work in
transient maps (bug#40096).
2022-05-23 13:10:04 +02:00
Lars Ingebrigtsen
9d557d4d4a Rename compare-window-configurations and update doc
* doc/lispref/windows.texi (Window Configurations): Update name.
* lisp/strokes.el (strokes-window-configuration-changed-p):
* lisp/emacs-lisp/byte-opt.el (side-effect-free-fns): Update
callers and references.

* lisp/subr.el (compare-window-configurations): Make into obsolete
alias.

* src/window.c (Fwindow_configuration_equal_p): Rename (bug#14964).
2022-05-20 04:23:32 +02:00
Lars Ingebrigtsen
c9a8a47ba4 Add new user option 'yank-transform-functions'
* doc/lispref/text.texi (Yanking): Mention it.
(Yanking): Document it.

* lisp/simple.el (yank-transform-functions): New user option.
(yank): Mention it.

* lisp/subr.el (insert-for-yank): Use it.
2022-05-20 00:15:38 +02:00
Lars Ingebrigtsen
f38a5e45c8 Fix markup in read-number doc string
* lisp/subr.el (read-number): Fix markup for the letter.
2022-05-10 15:41:27 +02:00
Lars Ingebrigtsen
0bee4cda88 Reimplement recent with-silent-modifications auto-save changes
* doc/lispref/buffers.texi (Buffer Modification): Document
buffer-modified-p returning `autosaved'.
* lisp/subr.el (with-silent-modifications): Use
restore-buffer-modified-p instead of altering the buffer modiff
(since this has other side effects like not updating after async
`display' changes.

* src/buffer.c (Fbuffer_modified_p): Allow returning whether the
buffer has been autosaved after changes.
(Frestore_buffer_modified_p): Allow adjusting whether the buffer
has been autosaved after changes.

* src/fileio.c (Fdo_auto_save): Refill the doc string.
2022-05-10 03:46:43 +02:00
Lars Ingebrigtsen
e8488bcc9c Avoid having font locking triggering unnecessary auto-saving
* lisp/subr.el (with-silent-modifications): Use it to restore the
ticks (bug#11303).

* src/buffer.c (Finternal__set_buffer_modified_tick): New function.
2022-05-07 12:05:59 +02:00
Lars Ingebrigtsen
afc14e4f66 Move buffer-local-set-state to subr because it's used at runtime
* lisp/subr.el (buffer-local-set-state)
(buffer-local-set-state--get, buffer-local-restore-state): Moved
from easy-mmode.el because they have to be available run-time.
2022-05-06 16:09:38 +02:00
Lars Ingebrigtsen
41e946f46e Fix key-parse problem with C-x ( ... sequences
* lisp/keymap.el (key-parse): Move the read-kbd-macro compat code
from here...
* lisp/subr.el (kbd): ... to here.  (And fix the logic, too.)
This allows `key-parse' to have a less puzzling result while
maintaining backwards compatibility (bug#38775).
2022-05-03 16:19:50 +02:00
Lars Ingebrigtsen
ee913faf9a Fix eldoc interaction with when' and unless'
* lisp/subr.el (when, unless): Remove the (fn...) bits from the
doc string, because the advertised calling convention is correct
the way it is (bug#27229).  This also makes eldoc highlight the
arguments correctly.
2022-05-02 12:30:19 +02:00
Lars Ingebrigtsen
e280df0e34 Fix the OMIT-NULLS + "" case in string-lines
* lisp/subr.el (string-lines): Respect OMIT-NULLS when given an
empty string.
2022-05-02 09:56:58 +02:00
Lars Ingebrigtsen
51186ed69c Fix string-lines return for ""
* lisp/subr.el (string-lines): Return the correct result on ""
(bug#55213).
2022-05-01 23:05:06 +02:00
Lars Ingebrigtsen
4f395efa06 Change string-lines semantics slightly
* lisp/subr.el (string-lines): Change the semantics slightly --
don't return an empty string for a trailing newline.
2022-05-01 20:54:11 +02:00
Lars Ingebrigtsen
b05a103ea7 Move the when-let family of macros to subr.el
* 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.
2022-04-30 16:42:44 +02:00
Lars Ingebrigtsen
93549c2b28 Avoid using if-let in subr.el
* lisp/subr.el (string-lines): Avoid using if-let (from subr-x) in
subr (bug#55194).
2022-04-30 16:24:55 +02:00
Lars Ingebrigtsen
aab5d7b3f3 Add a KEEP-NEWLINES argument to string-lines
* doc/lispref/strings.texi (Creating Strings): Document it.

* lisp/subr.el (string-lines): Add a KEEP-NEWLINES argument.
2022-04-30 12:57:20 +02:00
Philip Kaludercic
2a848209df ; * subr.el (buffer-match-p): Ensure that (and) is always satisfied 2022-04-17 14:04:46 +02:00
Philip Kaludercic
ea54062fdf Generalise buffer matching from project.el
* subr.el (buffer-match): Add function to check if a buffer satisfies
a condition.
(match-buffers): Returns all buffers that satisfy a condition.
2022-04-15 10:06:36 +02:00
Michael Albinus
d9851c6df2 Ensure local default-directory' when calling process-attributes'.
* lisp/server.el (server-running-p):
* lisp/subr.el (memory-limit): Ensure local `default-directory'
when calling `process-attributes'.
2022-04-08 12:47:53 +02:00
Lars Ingebrigtsen
781c43de3d Fix bootstrap errors after previous easy-mmode change
* 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.
2022-04-02 16:53:24 +02:00
Michael Albinus
0094dde11d Fix grep-like functions when running on a remote host
* doc/lispref/processes.texi (Shell Arguments):
* etc/NEWS: Describe change in 'shell-quote-argument'.  Fix typos.

* lisp/subr.el (shell-quote-argument): New optional argument POSIX.

* lisp/progmodes/grep.el (grep-compute-defaults)
(grep-default-command, grep-expand-keywords, lgrep)
(rgrep-default-command): Use POSIX argument in
`shell-quote-argument'.  (Bug#54487)
2022-03-22 10:29:16 +01:00
Stefan Kangas
7cee796556 Merge from origin/emacs-28
f15922a57c Update to Org 9.5.2-25-gaf6f12
9fcdd5b63f Improve doc strings of read-char-from-minibuffer-insert-* ...
2022-03-21 06:30:40 +01:00
Eli Zaretskii
9fcdd5b63f Improve doc strings of read-char-from-minibuffer-insert-* commands
* lisp/subr.el (read-char-from-minibuffer-insert-char)
(read-char-from-minibuffer-insert-other): Clarify the doc strings.
(Bug#54479)
2022-03-20 18:21:44 +02:00
Stefan Monnier
dc8a692f97 (with-demoted-errors): Fix bug#54225
* lisp/subr.el (with-demoted-errors): Adjust to argument order of
`macroexp-warn-and-return` changed in f262a6af36.
2022-03-03 10:12:44 -05:00
Stefan Monnier
8adc3672ac (add-hook): Fix regression
* lisp/subr.el (add-hook): When the hook has no local part yet, don't
set `local` to t, so we set the right part of the depth-sym.
(remove-hook): Don't modify the depth alist by side-effect since I'm
not completely sure it's safe.
2022-02-22 22:52:40 -05:00
Stefan Monnier
4bd7963e2e (add-hook, remove-hook): Fix leaks (bug#48666)
* lisp/subr.el (add-hook, remove-hook): Rewrite the hook depth
management so we only keep the info relevant to functions present on
the hook.
2022-02-22 10:18:43 -05:00
Lars Ingebrigtsen
53da8c50fc Don't signal a backtrace on empty --script files
* lisp/startup.el (command-line--load-script): New function that
avoids erroring out if it turns out there's no forms in the buffer
(bug#4616).

* lisp/subr.el (delete-line): New utility function.
* lisp/international/mule.el (load-with-code-conversion): Accept
an eval function.
2022-02-10 13:44:55 +01:00
Stefan Monnier
d52c929e31 (with-demoted-errors): Warn on missing format arg
The `format` arg has been mandatory for a while, but the backward
compatibility code that handled the case of a missing `format` arg
made it hard to notice when using the old calling convention.

* lisp/subr.el (with-demoted-errors): Warn on missing `format` arg.

* lisp/emacs-lisp/smie.el (smie-indent--separator-outdent): Don't abuse
`with-demoted-errors`.
(smie-indent-line, smie-auto-fill):
* test/lisp/emacs-lisp/ert-tests.el (ert-test-with-demoted-errors):
* lisp/vc/vc-hooks.el (vc-refresh-state):
* lisp/vc/vc-annotate.el (vc-annotate-background-mode):
* lisp/vc/diff-mode.el (diff-syntax-fontify-hunk):
* lisp/textmodes/reftex-toc.el (reftex-re-enlarge):
* lisp/progmodes/sh-script.el (sh-smie-sh-rules):
* lisp/progmodes/octave.el (inferior-octave-startup):
* lisp/pcmpl-gnu.el (pcmpl-gnu-make-all-targets):
* lisp/org/org-refile.el (org-refile):
* lisp/org/org-capture.el (org-capture-store-last-position):
* lisp/nxml/nxml-mode.el (nxml-mode):
* lisp/notifications.el (notifications-notify):
* lisp/gnus/mm-view.el (mm-display-inline-fontify):
* lisp/finder.el (finder-unload-function):
* lisp/files.el (safe-local-variable-p, backup-buffer-copy
* lisp/autorevert.el (auto-revert-notify-handler):
Pass `format` arg to `with-demoted-errors`.
2022-02-04 19:39:53 -05:00
Lars Ingebrigtsen
dbf08491a5 Make more ranges sort properly in describe-keymap
* lisp/subr.el (keymap-canonicalize): Don't consider two-character
ranges as a range (bug#11325).
2022-01-31 17:32:26 +01:00
Eli Zaretskii
4320eebb4a ; * lisp/subr.el (use-dialog-box-p): Fix typo. 2022-01-29 19:18:26 +02:00
Eli Zaretskii
bddd9c5f68 ; Fix formatting of last change. 2022-01-29 17:56:30 +02:00
Eli Zaretskii
f7b408ec50 Don't require mouse for prompting via dialog boxes
* lisp/subr.el (use-dialog-box-p): Don't require mouse support,
and allow dialog boxes when invoked via the TTY menus without a
mouse.
(from--tty-menu-p): New internal variable.

* lisp/menu-bar.el (popup-menu): Bind 'from--tty-menu-p' when
invoking a command from the menu.
2022-01-29 17:54:43 +02:00
Lars Ingebrigtsen
b8ddd94aac Make the save buffers prompt from Quit Emacs menu more understandable
* lisp/files.el (save-buffers-kill-emacs): Use a much simpler (and
more understandable) prompt when exiting Emacs from the menu bar
(bug#4980).

* lisp/subr.el (use-dialog-box-p): Separate out into its own
function for reuse...
(y-or-n-p): ... from here.
2022-01-27 19:56:29 +01:00
Lars Ingebrigtsen
f047d3c513 Add new function 'readablep'
* doc/lispref/streams.texi (Input Functions): Document it.
* lisp/subr.el (readablep): New function (bug#52566).
2022-01-22 15:13:27 +01:00
Stefan Monnier
f08dfa9b53 Fix menu-bar mouse clicks in "C-h c" and "C-h k" (bug#53322)
* lisp/subr.el (event-start, event-end): Handle '(menu-bar)'
events.
* lisp/net/browse-url.el (browse-url-interactive-arg): Simplify
accordingly.

(cherry picked from commit 9ceb3070e3)
2022-01-20 14:17:16 +02:00
Lars Ingebrigtsen
7651f044e2 Improve the with-output-to-temp-buffer doc string
* lisp/subr.el (with-output-to-temp-buffer): Clarify the point of
the macro (bug#53265).
2022-01-15 09:30:01 +01:00
Lars Ingebrigtsen
dd3715b0cb Make function-alias-p use a better error symbol
* lisp/subr.el (function-alias-p): Use the same error symbol as
`indirect-function'.
2022-01-14 11:51:24 +01:00
Lars Ingebrigtsen
c8a2af3037 Add new function function-alias-p
* doc/lispref/functions.texi (Defining Functions): Document it.
* lisp/subr.el (function-alias-p): New function (bug#53178).
2022-01-13 09:49:19 +01:00
Juri Linkov
7b139afbf4 * lisp/subr.el (remove-hook): Use set-variable-value-history for value history 2022-01-12 21:08:16 +02:00
Stefan Kangas
7ddfe1cab2 Move define-keymap and defvar-keymap to keymap.el
These functions deal with the "new" keymap binding interface, so they
belong in keymap.el rather than in subr.el.
* lisp/subr.el (define-keymap--compile, define-keymap)
(defvar-keymap): Move from here ...
* lisp/keymap.el (define-keymap--compile, define-keymap)
(defvar-keymap): ... to here.
2022-01-02 23:33:41 +01:00
Eli Zaretskii
dcd76bd48d Merge from origin/emacs-28
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
2022-01-01 07:03:03 -05:00
Eli Zaretskii
19dcb237b5 ; Add 2022 to copyright years. 2022-01-01 02:45:51 -05:00
Stefan Kangas
8df3a71c52 Doc fix; fix terminology in key binding functions
* lisp/keymap.el (keymap-set, key-valid-p):
* lisp/subr.el (define-keymap): Doc fix; improve terminology.
2021-12-27 16:24:18 +01:00
Stefan Kangas
83e0acdf6e ; * lisp/subr.el (define-keymap): Fix typos. 2021-12-26 17:25:31 +01:00
Philipp Stephani
d56b0b4e6b ; * lisp/subr.el (start-process-shell-command): Add missing period. 2021-12-11 19:40:55 +01:00
Lars Ingebrigtsen
a996ddb5e6 Update comment about `declare-function'
* lisp/subr.el (declare-function): Fix comment --
`byte-compile-declare-function' doesn't exist.
2021-12-05 22:12:26 +01:00
Mattias Engdegård
d50e0bdbac Use compiler macros for the key syntax checks
Compile-time key string syntax checks are better written using
compiler macros than with byte-hunk-handlers inside the compiler
proper.

* lisp/emacs-lisp/bytecomp.el (byte-compile-define-keymap)
(byte-compile-define-keymap--define): Remove.
* lisp/keymap.el (keymap--compile-check): New.
(keymap-set, keymap-global-set, keymap-local-set, keymap-global-unset)
(keymap-local-unset, keymap-unset, keymap-substitute)
(keymap-set-after, key-translate, keymap-lookup, keymap-local-lookup)
(keymap-global-lookup): Use compiler-macro for argument checks.
* lisp/subr.el (define-keymap--compile): New.
(define-keymap--define): Fold into define-keymap.
(define-keymap): Use compiler-macro.
(defvar-keymap): Use define-keymap.
2021-11-28 18:10:23 +01:00