Commit graph

1853 commits

Author SHA1 Message Date
Eli Zaretskii
2c4d92d30f ; * lisp/subr.el (posn-col-row): Revert inadvertent change. 2022-12-03 22:09:16 +02:00
Eli Zaretskii
afa4fcb95b Fix "C-h k" when clicking on another frame
* lisp/help.el (help--analyze-key): Don't barf if the key sequence
includes a switch-frame event.  (Bug#59785)
2022-12-03 21:43:36 +02:00
Stefan Kangas
a0dd9fdebe ; Add cross-reference to string-equal docstring
* lisp/subr.el (string-equal-ignore-case):
* src/fns.c (Fstring_equal): Doc fix; add cross-references.
2022-12-03 11:32:23 +01:00
Eli Zaretskii
54633fcd76 ; * lisp/subr.el (string-equal-ignore-case): Doc fix (bug#59779). 2022-12-02 19:08:08 +02:00
Gregory Heytings
849223fba1 Merge branch 'feature/improved-locked-narrowing' 2022-11-27 22:19:41 +01:00
Gregory Heytings
321d4e6155 Minor improvements for locked narrowing
* src/editfns.c (narrowing_lock_pop): Clarify comment, replace
assertion by return.
(narrowing_locks_restore): Add comments.

* lisp/subr.el (with-narrowing, internal--with-narrowing):
Simplify, use a single helper function with an optional argument.
2022-11-26 23:38:40 +01:00
Eli Zaretskii
b84408647c Improve documentation of some posn-* functions
* lisp/subr.el (posn-object-x-y): Doc fix.

* doc/lispref/commands.texi (Click Events): More accurate
documentation of what are DX and DY in POSITION.
2022-11-26 13:56:30 +02:00
Gregory Heytings
16b8b0d1e0 Save and restore narrowing locks in 'save-restriction'.
* src/editfns.c: (Fsave_restriction): Save and restore narrowing
locks.  Suggested by Stefan Monnier.
(narrowing_locks_save, narrowing_locks_restore): Helper functions.

* lisp/subr.el (with-narrowing-1): Simplify.
2022-11-26 01:33:07 +01:00
Gregory Heytings
a246524039 Generic 'with-narrowing' macro.
* lisp/subr.el (with-narrowing): New generic macro, replacing the
'with-locked-narrowing' one.  Suggested by Stefan Monnier.
(with-narrowing-1, with-narrowing-2): Helper functions.
2022-11-25 22:44:14 +01:00
Gregory Heytings
9dee6df39c Reworked locked narrowing.
* src/editfns.c: (narrowing_locks): New alist to hold the narrowing
locks and their buffers.
(narrowing_lock_get_bound, narrowing_lock_peek_tag)
(narrowing_lock_push, narrowing_lock_pop): New functions to access
and update 'narrowing_locks'.
(reset_outermost_narrowings, unwind_reset_outermost_narrowing):
Functions moved from src/xdisp.c, and rewritten with the above
functions.
(Fwiden): Use the above functions. Update docstring.
(Fnarrow_to_region, Fnarrowing_lock, Fnarrowing_unlock): Use the above
functions.
(syms_of_editfns): Remove the 'narrowing-locks' variable.

* src/lisp.h: Make 'reset_outermost_narrowings' externally visible.

* src/xdisp.c (reset_outermost_narrowings)
unwind_reset_outermost_narrowing): Functions moved to src/editfns.c.

* lisp/subr.el (with-locked-narrowing): Improved macro, with a helper
function.
2022-11-25 18:51:39 +01:00
Gregory Heytings
ba9315b164 Merge master into feature/improved-locked-narrowing. 2022-11-24 14:21:30 +01:00
Stefan Kangas
16318bfb51 ; Fix typos 2022-11-20 12:59:39 +01:00
Stefan Kangas
f7ee6609ae ; Fix typos (prefer US spelling) 2022-11-18 13:06:55 +01:00
Juanma Barranquero
d2ba4538cb ; * lisp/subr.el (match-buffers): Fix typo 2022-11-15 23:07:55 +01:00
Eli Zaretskii
23868658a2 ; * lisp/subr.el (setq-local): Fix last doc change. 2022-11-04 09:49:48 +02:00
Juanma Barranquero
116f69d741 ; * lisp/subr.el (setq-local): Doc fix. 2022-11-04 07:05:51 +01:00
Gregory Heytings
aef803d6c3 Merge master into feature/improved-locked-narrowing. 2022-10-30 17:00:35 +01:00
Eli Zaretskii
d53febbd21 ; * lisp/subr.el (keyboard-translate): Doc fix. (Bug#58805) 2022-10-27 19:57:33 +03:00
Stefan Kangas
db2ed9f333 ; Fix several symbol name typos 2022-10-26 23:04:23 +02:00
Stefan Monnier
155ddde4dd (sit-for): Add compiler-macro to warn about obsolete calling convention
* lisp/subr.el (sit-for): Add compiler-macro.
* lisp/eshell/esh-util.el (eshell-redisplay):
* lisp/play/zone.el (zone, zone-pgm-jitter, zone-pgm-whack-chars):
(zone-remove-text): Avoid obsolete calling convention.
2022-10-18 18:43:50 -04:00
Stefan Monnier
13d6e8fa54 cl-generic: Fix advertised-calling-convention declarations
* lisp/emacs-lisp/cl-generic.el (cl-generic-define-method):
Preserve the `advertised-calling-convention`, if any (bug#58563).

* lisp/subr.el (declare): Warn when we hit this.

* lisp/emacs-lisp/byte-run.el (get-advertised-calling-convention): New fun.
* lisp/progmodes/elisp-mode.el (elisp-get-fnsym-args-string):
* lisp/help-fns.el (help-fns--signature):
* lisp/emacs-lisp/bytecomp.el (byte-compile-fdefinition): Use it.

* test/lisp/emacs-lisp/cl-generic-tests.el (cl-generic-tests--acc): New fun.
(cl-generic-tests--advertised-calling-convention-bug58563): New test.
2022-10-16 12:01:47 -04:00
Stefan Monnier
d6831d1b0a subr.el (inhibit-point-motion-hooks): Mark it as obsolete
When Emacs-25 changed the default of `inhibit-point-motion-hooks` to t,
/etc/NEWS declared it as obsolete and so did its docstring, but
it was not marked as obsolete so as not to emit too many warnings
in code where it was impractical to remove the let-binding while
keeping backward compatibility with older Emacsen.
Those backward compatibility issues are not serious any more now that
Emacs-25 is itself considered old.

* lisp/subr.el (inhibit-point-motion-hooks): Mark it as obsolete.
* src/textprop.c (inhibit-point-motion-hooks): Don't mention it being
obsolete in the docstring any more.
* lisp/simple.el (line-move-1, line-move-finish): Silence warnings.
2022-10-07 14:15:40 -04:00
Stefan Kangas
a36ecc408a * lisp/subr.el (y-or-n-p): Use substitute-command-keys. 2022-10-04 17:39:28 +02:00
Lars Ingebrigtsen
f97993ee66 Rename to inhibit-automatic-native-compilation
* src/comp.c (maybe_defer_native_compilation):
(syms_of_comp):
* lisp/subr.el (native-comp-deferred-compilation):
* lisp/startup.el (inhibit-native-compilation):
(normal-top-level):
* lisp/progmodes/elisp-mode.el (emacs-lisp-native-compile-and-load):
* lisp/emacs-lisp/comp.el (comp-trampoline-compile):
* etc/NEWS:
* doc/lispref/compile.texi (Native-Compilation Variables): Rename
inhibit-native-compilation to inhibit-automatic-native-compilation.
2022-10-03 19:50:03 +02:00
Lars Ingebrigtsen
5fec9182db Add new variable 'inhibit-native-compilation'
* doc/lispref/compile.texi (Native-Compilation Variables):
Document it.

* lisp/startup.el (normal-top-level): Set
inhibit-native-compilation from environment variable.

* lisp/subr.el (native-comp-deferred-compilation): Make obsolete.

* lisp/emacs-lisp/comp.el (comp-trampoline-compile): Don't write
trampolines to disk.

* lisp/progmodes/elisp-mode.el
(emacs-lisp-native-compile-and-load): Adjust.

* src/comp.c (syms_of_comp): New variable
inhibit-native-compilation.
(maybe_defer_native_compilation): Use it.
2022-10-03 15:26:13 +02:00
Lars Ingebrigtsen
0e72d4793c Tweak while-let definition
* lisp/subr.el (while-let): Use if-let* since we don't need/want
the backwards compat of if-let.
2022-09-29 12:29:36 +02:00
Lars Ingebrigtsen
12f63c18f6 Add new macro 'while-let'
* doc/lispref/control.texi (Conditionals): Document
when-let/if-let/while-let.
* lisp/subr.el (while-let): New macro.
2022-09-28 13:19:08 +02:00
Stefan Monnier
c1cead89f5 (event-start/end): Fix part of bug#52092
When synthesizing a posn for keyboard events, make sure the `posn-point`
i the same as `point`.

* lisp/subr.el (event--posn-at-point): New function.
(event-start, event-end): Use it.
2022-09-24 10:38:09 -04:00
Mattias Engdegård
60102016e4 Abolish max-specpdl-size (bug#57911)
The max-lisp-eval-depth limit is sufficient to prevent unbounded stack
growth including the specbind stack; simplify matters for the user by
not having them to worry about two different limits.  This change
turns max-specpdl-size into a harmless variable with no effects,
to keep existing code happy.

* lisp/subr.el (max-specpdl-size):
Define as an ordinary (but obsolete) dynamic variable.
* admin/grammars/Makefile.in:
* doc/lispintro/emacs-lisp-intro.texi (Loops & Recursion):
* doc/lispref/control.texi (Cleanups):
* doc/lispref/edebug.texi (Checking Whether to Stop):
* doc/lispref/eval.texi (Eval):
* doc/lispref/variables.texi (Local Variables):
* doc/misc/calc.texi (Recursion Depth):
Update documentation.
* etc/NEWS: Announce.
* src/eval.c
(FletX): Use safe iteration to guard against circular bindings list.
(syms_of_eval): Remove old max-specpdl-size definition.
(init_eval_once, restore_stack_limits, call_debugger)
(signal_or_quit, grow_specpdl_allocation):
* leim/Makefile.in:
* lisp/Makefile.in:
* lisp/calc/calc-stuff.el (calc-more-recursion-depth)
(calc-less-recursion-depth):
* lisp/calc/calc.el (calc-do):
* lisp/cedet/semantic/ede-grammar.el (ede-proj-makefile-insert-rules):
* lisp/cedet/semantic/grammar.el (semantic-grammar-batch-build-one-package):
* lisp/cus-start.el (standard):
* lisp/emacs-lisp/comp.el (comp--native-compile):
* lisp/emacs-lisp/edebug.el (edebug-max-depth):
(edebug-read-and-maybe-wrap-form, edebug-default-enter):
* lisp/emacs-lisp/regexp-opt.el (regexp-opt):
* lisp/eshell/esh-mode.el (eshell-mode):
* lisp/loadup.el (max-specpdl-size):
* lisp/mh-e/mh-e.el (mh-invisible-headers):
* lisp/net/shr.el (shr-insert-document, shr-descend):
* lisp/play/hanoi.el (hanoi-internal):
* lisp/progmodes/cperl-mode.el:
* src/fileio.c (Fdo_auto_save):
Remove references to and modifications of max-specpdl-size.
2022-09-19 19:30:03 +02:00
Mattias Engdegård
d4d6f7a747 * lisp/subr.el (list-of-strings-p): Declare pure and error-free 2022-09-16 18:51:10 +02:00
Mattias Engdegård
4da0fbdc82 Faster and more robust list-of-strings-p
* lisp/subr.el (list-of-strings-p): Speed up by a factor 4 (approx.)
and don't crash on dotted lists.
* test/lisp/subr-tests.el (test-list-of-strings-p): Extend test.
2022-09-16 15:33:12 +02:00
Lars Ingebrigtsen
7d39453fd6 Add new predicate list-of-strings-p
* lisp/subr.el (list-of-strings-p): New function.
2022-09-16 12:29:54 +02:00
Stefan Monnier
c99815fffa combine-change-calls-1: Fix case where body also changes other bufs
* lisp/subr.el (combine-change-calls-1): Only set the current buffer's part
of the `*-change-functions` hooks.
2022-09-15 16:31:18 -04:00
Kévin Le Gouguec
d8f392bccd Restrict replace-*-in-region to the bounds defined by caller
* lisp/subr.el (replace-string-in-region, replace-regexp-in-region):
Narrow to region before iterating over matches, instead of giving a
bound to the search functions.
* test/lisp/subr-tests.el (test-replace-string-in-region): Add
regression tests (bug#57733).
2022-09-11 19:55:36 +02:00
Stefan Kangas
e6dc0cf2d3 * lisp/subr.el (string-split): New alias for split-string. 2022-09-10 01:12:29 +02:00
Stefan Kangas
1f29ee2d21 Delete many items obsolete since 24.3
* lisp/allout.el (allout-exposure-change-hook)
(allout-structure-added-hook, allout-structure-deleted-hook)
(allout-structure-shifted-hook):
* lisp/arc-mode.el (archive-extract-hooks):
* lisp/buff-menu.el (Buffer-menu-buffer+size-width):
* lisp/calendar/timeclock.el (timeclock-modeline-display)
(timeclock-modeline-display, timeclock-update-modeline):
* lisp/cedet/semantic/db-el.el
(semanticdb-elisp-sym-function-arglist):
* lisp/cedet/semantic/db-file.el (semanticdb-save-database-hooks):
* lisp/cedet/semantic/edit.el (semantic-change-hooks)
(semantic-edits-new-change-hooks)
(semantic-edits-delete-change-hooks)
(semantic-edits-reparse-change-hooks):
* lisp/cedet/semantic/lex.el (semantic-lex-reset-hooks):
* lisp/comint.el (comint--unquote&expand-filename)
(comint-unquote-filename):
* lisp/custom.el (user-variable-p):
* lisp/dired.el (dired-shrink-to-fit, dired-pop-to-buffer)
(dired-sort-set-modeline):
* lisp/ebuff-menu.el (Electric-buffer-menu-mode):
* lisp/emacs-lisp/byte-run.el (macro-declaration-function):
* lisp/emacs-lisp/checkdoc.el (custom-print-functions)
(checkdoc-comment-style-hooks):
* lisp/emacs-lisp/cl-lib.el (custom-print-functions):
* lisp/emacs-lisp/edebug.el (gud-inhibit-global-bindings):
* lisp/erc/erc-dcc.el (erc-dcc-chat-filter-hook):
* lisp/eshell/esh-mode.el (eshell-status-in-modeline):
* lisp/eshell/eshell.el (eshell-add-to-window-buffer-names)
(eshell-remove-from-window-buffer-names):
* lisp/faces.el (set-face-underline-p, font-list-limit):
* lisp/files.el (automount-dir-prefix, toggle-read-only):
* lisp/filesets.el (filesets-cache-fill-content-hooks):
* lisp/frame.el (automatic-hscrolling):
* lisp/generic-x.el (javascript-generic-mode)
(javascript-generic-mode-hook):
* lisp/gnus/gnus-start.el (gnus-subscribe-newsgroup-hooks):
* lisp/gnus/nndiary.el (nndiary-request-create-group-hooks)
(nndiary-request-update-info-hooks)
(nndiary-request-accept-article-hooks):
* lisp/htmlfontify.el (hfy-post-html-hooks):
* lisp/international/mule-cmds.el
(inactivate-current-input-method-function)
(inactivate-input-method, input-method-inactivate-hook)
(ucs-insert):
* lisp/international/quail.el (quail-inactivate)
(quail-inactivate-hook):
* lisp/international/robin.el (robin-inactivate)
(robin-inactivate-hook):
* lisp/leim/quail/hangul.el (hangul-input-method-inactivate):
* lisp/leim/quail/uni-input.el (ucs-input-inactivate):
* lisp/mail/emacsbug.el (report-emacs-bug-info):
* lisp/mh-e/mh-e.el (mh-kill-folder-suppress-prompt-hooks):
* lisp/mpc.el (mpc-string-prefix-p):
* lisp/net/rcirc.el (rcirc-print-hooks, rcirc-sentinel-hooks)
(rcirc-receive-message-hooks, rcirc-activity-hooks):
* lisp/obsolete/crisp.el (crisp-mode-modeline-string):
* lisp/pcomplete.el (pcomplete-arg-quote-list)
(pcomplete-quote-argument):
* lisp/progmodes/cc-mode.el (c-prepare-bug-report-hooks):
* lisp/progmodes/python.el (python-info-ppss-context)
(python-info-ppss-context-type)
(python-info-ppss-comment-or-string-p, python-indent)
(python-guess-indent, python-buffer, python-preoutput-result)
(python-proc, python-send-receive, python-send-string)
(python-use-skeletons):
* lisp/progmodes/sh-script.el (sh-maybe-here-document):
* lisp/replace.el (query-replace-interactive):
* lisp/strokes.el (strokes-modeline-string):
* lisp/subr.el (redraw-modeline):
* lisp/term.el (term-default-fg-color, term-default-bg-color):
* lisp/textmodes/tex-mode.el (latex-string-prefix-p)
(tex-string-prefix-p):
* lisp/url/url-parse.el (url-recreate-url-attributes):
* lisp/vc/add-log.el (change-log-acknowledgement):
* lisp/vc/ediff-wind.el
(ediff-choose-window-setup-function-automatically):
* lisp/vc/pcvs-util.el (cvs-string-prefix-p):
* lisp/vc/vc.el (vc-string-prefix-p):
* lisp/window.el (display-buffer-function):
* lisp/winner.el (winner-mode-leave-hook): Remove many functions and
variables obsolete since 24.3.

* lisp/buff-menu.el (list-buffers--refresh):
* lisp/dired.el (dired-mode-map):
* lisp/files.el (abbreviate-file-name):
* lisp/generic-x.el (generic-default-modes):
* lisp/mh-e/mh-funcs.el (mh-kill-folder):
* lisp/progmodes/hideif.el (hide-ifdef-mode-submap):
* lisp/replace.el (query-replace-read-from):
* lisp/term.el (term):
* lisp/window.el (display-buffer): Don't use above deleted
functions and variables.

* src/marker.c (Fbuffer_has_markers_at): Delete DEFUN obsolete
since 24.3.
(syms_of_marker) <Sbuffer_has_markers_at>: Delete defsubr.
* lisp/subr.el (buffer-has-markers-at): Remove obsoletion
of above deleted DEFUN.
* etc/TODO: Doc fix; don't mention above deleted function.

* admin/cus-test.el (cus-test-get-options):
* lisp/pcomplete.el: Doc fixes; don't mention removed items.
; * etc/NEWS: List removed items.
2022-09-09 11:27:30 +02:00
Mattias Engdegård
35b4205dee Improve save-match-data hygiene
* lisp/subr.el (save-match-data): Use uninterned variable symbol.
Remove outdated comments.
2022-09-07 18:02:26 +02:00
Mattias Engdegård
c6c9dfc867 Simplify dolist and dotimes
We no longer care enough about non-lexbind code generation for it
to merit special attention; better to keep the code simple.

Suggested by Philip Kaludercic in
https://lists.gnu.org/archive/html/emacs-devel/2022-09/msg00354.html .

* lisp/subr.el (dolist, dotimes): Use uninterned symbols for variable
bindings generated by the macros, and discard the alternative code
versions for non-lexbind code.  Use sensible variable names.
2022-09-07 14:05:28 +02:00
Philip Kaludercic
2d337ca577
* subr.el (buffer-match-p): Use 'pcase' (bug#57502) 2022-09-03 14:54:40 +02:00
Stefan Kangas
9f692bcd84 Improve point-at-{bol,eol} obsoletion message
* lisp/subr.el (point-at-eol, point-at-bol): Mention 'pos-eol' and
'pos-bol' in obsoletion message.
2022-08-29 19:26:39 +02:00
Gregory Heytings
3bf19c417f Merge master into feature/improved-locked-narrowing. 2022-08-23 17:50:41 +02:00
Stefan Kangas
b7e867b841 Make point-at-eol and point-at-bol obsolete
* lisp/subr.el (point-at-eol, point-at-bol): Make XEmacs compat
aliases obsolete in favor of `pos-bol'/'line-beginning-position' or
'pos-eol'/'line-end-position'.  Update callers.
Ref: https://lists.gnu.org/r/emacs-devel/2022-08/msg00853.html
2022-08-23 04:54:57 +02:00
Gregory Heytings
ea8e0f67bb Minor improvements to locked narrowing.
* lisp/subr.el (with-locked-narrowing): Add 'save-restriction' around
the macro body.  Update docstring.

* src/editfns.c (Fwiden, Fnarrowing_lock): Docstring improvements.
2022-08-21 23:26:14 +02:00
Lars Ingebrigtsen
102258fe1c Simplify `delete-line'
* lisp/subr.el (delete-line): Simplify.
2022-08-21 18:13:12 +02:00
Gregory Heytings
2727af3fd4 Improved locked narrowing.
* src/editfns.c (Fnarrowing_lock, Fnarrowing_unlock,
narrow_to_region_locked, unwind_narrow_to_region_locked):
New functions.
(Fnarrow_to_region, Fwiden): Adapt, and make it possible to use
these functions within the bounds of the locked narrowing.
(syms_of_editfns): Change the name of the variable, make it
buffer-local, and add the two Snarrowing_lock and Snarrowing_unlock
subroutines.

* src/lisp.h: Prototype of 'narrow_to_region_locked'.

* src/xdisp.c (handle_fontified_prop):
* src/keyboard.c (safe_run_hooks_maybe_narrowed): Use
'narrow_to_region_locked'.

* lisp/subr.el (with-locked-narrowing): New macro.
2022-08-20 18:08:41 +02:00
Stefan Kangas
043ae1f53a Delete two functions obsolete since Emacs 23
These were announced as removed in Emacs 28.1 NEWS, but apparently
never actually deleted: only their obsoletion warning was removed.
So the warnings were reintroduced in Emacs 28.2, and we now actually
delete them here instead.

* src/process.c (Fset_process_filter_multibyte)
(Fprocess_filter_multibyte_p): Delete functions obsolete since
Emacs 23.
(syms_of_process): Delete corresponding defsubrs.
* lisp/subr.el (process-filter-multibyte-p)
(set-process-filter-multibyte): Delete obsoletion.
* lisp/erc/erc-dcc.el (erc-dcc-server): Don't use obsolete functions.
2022-08-19 17:57:42 +02:00
Stefan Kangas
d0bb333efc Merge from origin/emacs-28
f2c0fb2615 Resurrect obsoletion warning for two functions
9c0eec4ed8 * src/window.c (select_window): Fix assert for buffer = no...
16dfe04be2 Find libgccjit on macOS with Homebrew differently

# Conflicts:
#	etc/NEWS
2022-08-19 17:30:18 +02:00
Stefan Kangas
f2c0fb2615 Resurrect obsoletion warning for two functions
These were supposed to have been deleted, but never were.  Resurrect
their obsoletion warning and let's delete them in Emacs 29 instead.

* lisp/subr.el (process-filter-multibyte-p)
(set-process-filter-multibyte): Resurrect obsoletion warning.
* etc/NEWS: Don't announce their deletion.
2022-08-19 17:29:05 +02:00
Lars Ingebrigtsen
97da8eeb7c Make update-directory-autoloads available by default again
* lisp/subr.el (make-directory-autoloads)
(update-directory-autoloads): Make available by default again
(bug#57200).

* lisp/obsolete/autoload.el (make-directory-autoloads): Add
obsoletion form.
(batch-update-autoloads): Fix warning.
2022-08-15 07:30:25 +02:00
Stefan Monnier
1faeef7924 (compiled-function-p): New function (bug#56648)
* lisp/subr.el (compiled-function-p): New function.

* test/lisp/international/ucs-normalize-tests.el (ucs-normalize-part1):
* lisp/gnus/gnus.el (gnus):
* lisp/mh-e/mh-e.el (mh-version):
* lisp/emacs-lisp/macroexp.el (emacs-startup-hook):
* lisp/emacs-lisp/cl-macs.el (compiled-function):
* lisp/emacs-lisp/bytecomp.el (byte-compile-fdefinition)
(byte-compile, display-call-tree):
* lisp/emacs-lisp/byte-opt.el (<toplevel-end>):
* lisp/emacs-lisp/advice.el (ad-compiled-p):
* lisp/cedet/semantic/bovine.el (semantic-bovinate-stream):
* lisp/loadup.el (macroexpand-all):
* admin/unidata/unidata-gen.el (unidata--ensure-compiled): Use it.

* lisp/emacs-lisp/pcase.el (pcase-mutually-exclusive-predicates):
Add entries for it.
(pcase--split-pred): Use it.

* lisp/help-fns.el (help-fns-function-description-header): Use `functionp`.
(help-fns--var-safe-local): Use `compiled-function-p`.
2022-08-14 12:30:05 -04:00