1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00
Commit graph

1896 commits

Author SHA1 Message Date
Stefan Monnier
4da479920e * lisp/subr.el (with-restriction): Tweak indent rule 2023-06-12 22:43:44 -04:00
Eli Zaretskii
5aadb87d6f Fix 'use-dialog-box-p' and friends
* lisp/subr.el (use-dialog-box-p): Use dialog boxes also when
invoked from some window-system gesture.  (Bug#63655)
(y-or-n-p): Fix the description in the doc string of conditions
under which a dialog box will be used.

* src/fns.c (Fyes_or_no_p): Use the same condition for dialog
boxes as in 'use-dialog-box-p'.  Fix the description in the doc
string of conditions under which a dialog box will be used.

* doc/lispref/minibuf.texi (Multiple Queries, Yes-or-No Queries):
Fix the description of conditions under which a dialog box will be
used.
2023-05-23 17:44:23 +03:00
Gregory Heytings
dcf8c01102 Merge branch 'scratch/long-lines-cleanup' into 'emacs-29' 2023-05-13 00:13:44 +02:00
Eli Zaretskii
b4e90070f9 Fix arguments of xml.c functions as displayed in Help buffers
* lisp/subr.el (libxml-parse-xml-region)
(libxml-parse-html-region): Adjust advertised-calling-convention
to the changes in commit cc33c6cf3a.  (Bug#63291)
2023-05-05 10:08:59 +03:00
Eli Zaretskii
2445100d7d ; Improve documentation of 'match-buffers'
* doc/lispref/buffers.texi (Buffer List):
* lisp/subr.el (match-buffers): Fix documentation of
'buffer-match-p' and 'match-buffers'.
2023-04-10 12:30:23 +03:00
Eli Zaretskii
b63a9eda01 Fix "C-h k" and "C-h c" with Paste from Kill Menu
* lisp/subr.el (event-basic-type, event-modifiers): Return nil if
EVENT is a string.  (Bug#62626)
2023-04-08 15:36:44 +03:00
Eli Zaretskii
6b9f9df945 ; Improve documentation of 'declare-function'
* doc/lispref/functions.texi (Declaring Functions):
* lisp/subr.el (declare-function): Document explicitly that
ARGLIST argument, if provided, should include the parentheses.
2023-04-05 12:31:01 +03:00
Eli Zaretskii
82d0b6c64e ; * lisp/subr.el (use-dialog-box-p): Fix last change. 2023-04-02 11:42:43 +03:00
Eli Zaretskii
cb8d6ab648 * lisp/subr.el (use-dialog-box-p): Fix conditions for GUI dialogs. 2023-04-02 10:34:43 +03:00
Gregory Heytings
85ed1c9ca6 Code cleanup for long line optimizations
This commit does not change any code, it merely renames functions
and clarifies the documentation, to make the code hopefully easier
to grasp.

* src/dispextern.h (struct it): Rename the 'narrowed_begv',
'narrowed_zv', 'locked_narrowing_begv', 'locked_narrowing_zv' to
'medium_narrowing_begv', 'medium_narrowing_zv',
'large_narrowing_begv', 'large_narrowing_zv'.  Clarify the
comments.
Update the prototypes of the functions renamed in xdisp.c.

* src/lisp.h: Update the prototypes of the functions renamed in
editfns.c.  Remove the prototype of
'safe_run_hooks_maybe_narrowed', which is used only in keyboard.c.

* src/xdisp.c
(get_small_narrowing_begv): Renamed from
'get_closer_narrowed_begv'.
(get_medium_narrowing_begv): Renamed from 'get_narrowed_begv'.
(get_medium_narrowing_zv): Renamed from 'get_narrowed_zv'.
(get_large_narrowing_begv): Renamed from 'get_locked_narrowing_begv'.
(get_large_narrowing_zv): Renamed from 'get_locked_narrowing_zv'.
(SET_WITH_NARROWED_BEGV): Use the new field names.
(handle_fontified_prop): Use the new function and new field names.
(back_to_previous_line_start): Use the new field name.
(back_to_previous_visible_line_start): Use the new field name.
(reseat): Use the new function and new field names.
(get_visually_first_element): Use the new field name.
(move_it_vertically_backward): Use the new function name.
(redisplay_internal): Use the new function name.
Also add a large comment to explain how Emacs deals with long lines.

* src/keyboard.c:
(safe_run_hooks_maybe_narrowed): Use the new function names from
xdisp.c and editfns.c.  Make the function static, and add a
prototype.

* src/editfns.c:
(labeled_restrictions): Renamed from 'narrowing_locks'.
(labeled_restrictions_add): Renamed from 'narrowing_locks_add'.
(labeled_restrictions_remove): Renamed from
'narrowing_locks_remove'.
(labeled_restrictions_get_bound): Renamed from
'narrowing_lock_get_bound'.
(labeled_restrictions_peek_label): Renamed from
'narrowing_lock_peek_tag'.
(labeled_restrictions_push): Renamed from 'narrowing_lock_push'.
(labeled_restrictions_pop): Renamed from 'narrowing_lock_pop'.
(unwind_reset_outermost_restriction): Renamed from
'unwind_reset_outermost_narrowing'.
(reset_outermost_restrictions): Renamed from
'reset_outermost_narrowings'.
(labeled_restrictions_save): Renamed from 'narrowing_locks_save'.
(labeled_restrictions_restore): Renamed from
'narrowing_locks_restore'.
(unwind_labeled_narrow_to_region): Renamed from
'unwind_narrow_to_region_locked'.
(labeled_narrow_to_region): Renamed from
'narrow_to_region_locked'.
(Finternal__label_restriction): Renamed from
'Finternal__lock_narrowing'.
(Finternal__unlabel_restriction): Renamed from
'Finternal__unlock_narrowing'.
(Fwiden): Use the new function names.
(Fnarrow_to_region): Use the new function names.
(save_restriction_save): Use the new function names.
(syms_of_editfns): Use the new function names.
<outermost-restriction>: Renamed from 'outermost-narrowing'.

* lisp/subr.el (internal--with-restriction): Use the new internal
function name.
(internal--without-restriction): Use the new internal function
name.

* src/composite.c (composition_compute_stop_pos):
(find_automatic_composition): Use the new function name.

* doc/lispref/positions.texi (Narrowing): Add index entry.
2023-03-29 01:12:31 +02:00
Eli Zaretskii
3965c65d5e ; * lisp/subr.el (read-char-choice): Fix last change. 2023-03-28 21:31:51 +03:00
Eli Zaretskii
c1eac5b658 Improve documentation of 'read-choice' and related symbols
* doc/lispref/commands.texi (Reading One Event):
* lisp/subr.el (read-char-choice-use-read-key, read-char-choice)
(read-char-choice-with-read-key, y-or-n-p-use-read-key): Improve
documentation of these functions and variables.
2023-03-28 21:08:12 +03:00
João Távora
edc460e3b6 Fix accidental backward-incompatible change (bug#62417)
This code used to work, but with the change of 59ecf25fc8 it stopped
working:

   (defun foop (buffer-name _alist) (string-match "foop" buffer-name))
   (add-to-list 'display-buffer-alist '(foop . display-buffer-other-frame))

This change makes it work again, restoring compatibility.

* lisp/subr.el (buffer-match-p): Fix and adjust docstring.
* lisp/window.el (display-buffer-alist): Adjust docstring.
(display-buffer-assq-regexp): Make good on promise of display-buffer-alist.
2023-03-27 12:59:14 +01:00
Arash Esbati
ea87c54f35 ; * lisp/subr.el (setq-local): Add missing period (bug#62242). 2023-03-17 16:54:40 +02:00
Gregory Heytings
971ded31c4 Add 'declare' specs to with- and without-restriction
* lisp/subr.el (with-restriction):
(without-restriction): Add 'declare' specs.
2023-03-08 11:00:40 +01:00
Eli Zaretskii
ea5fd375bb Fix documentation of 'normal-mode' in buffers that don't visit files
* lisp/files.el (normal-mode):
* lisp/subr.el (run-mode-hooks):
* doc/emacs/modes.texi (Choosing Modes): Mention the caveat with
'normal-mode' in buffers not visiting files.  (Bug#61925)
* lisp/files.el (hack-local-variables): Doc fix.
2023-03-04 12:16:51 +02:00
Andrea Corallo
d6e4f24372 Merge 'emacs-29' into 'feature/inhibit-native-comp-cleanup' 2023-02-17 11:14:38 +01:00
Eli Zaretskii
3d572ae0d5 Rename with/without-narrowing to with/without-restriction
* doc/lispref/commands.texi:
* doc/lispref/display.texi:
* doc/lispref/positions.texi:
* etc/NEWS:
* lisp/subr.el:
* src/buffer.c:
* src/editfns.c:
* src/keyboard.c:
* src/xdisp.c:
* test/src/buffer-tests.el: Rename with-narrowing and
without-narrowing to with-restriction and without-restriction.
Likewise with internal--with-narrowing and
internal--without-narrowing.  All callers and documentation
changed.
2023-02-13 20:11:28 +02:00
Andrea Corallo
8d8464bd5a Rename native-comp-deferred-compilation into native-comp-jit-compilation
* src/comp.c (maybe_defer_native_compilation, syms_of_comp):
	Rename native-comp-deferred-compilation into
	native-comp-jit-compilation.

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

	* lisp/startup.el (native-comp-deferred-compilation)
	(normal-top-level): Rename native-comp-deferred-compilation into
	native-comp-jit-compilation.

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

	* lisp/emacs-lisp/generate-lisp-file.el
	(generate-lisp-file-trailer): Likewise.
2023-02-13 17:04:22 +01:00
Andrea Corallo
5d0912f144 Rename comp-enable-subr-trampolines into native-comp-enable-subr-trampolines
* src/data.c (Ffset): Rename comp-enable-subr-trampolines into
	native-comp-enable-subr-trampolines.

	* src/comp.c (syms_of_comp): Likewise.

	* lisp/subr.el (comp-enable-subr-trampolines): Make
	comp-enable-subr-trampolines obsolete.

	* lisp/startup.el (native-comp-enable-subr-trampolines)
	(normal-top-level): Rename comp-enable-subr-trampolines into
	native-comp-enable-subr-trampolines.

	* lisp/loadup.el (dump-mode): Likewise.

	* lisp/emacs-lisp/comp.el (comp-subr-trampoline-install)
	(comp--trampoline-abs-filename): Likewise.
2023-02-13 17:02:38 +01:00
Gregory Heytings
b948d0d7ef Merge branch 'scratch/fix-locked-narrowing' 2023-02-13 11:44:37 +01:00
Gregory Heytings
dcb2379a46 Minor improvements to labeled narrowing
* lisp/subr.el (internal--with-narrowing):
(internal--without-narrowing): Remove unnecessary 'progn'.

* etc/NEWS: Mention 'with-narrowing' in the entry about long
lines.

* doc/lispref/positions.texi (Narrowing): Fix typo.

* doc/lispref/display.texi (Auto Faces): Use @pxref.

* doc/lispref/commands.texi (Command Overview): Use @pxref.
2023-02-13 11:39:46 +01:00
Andrea Corallo
c0681cd347 Revert "Add new variable 'inhibit-native-compilation'"
This reverts commit 5fec9182db.
2023-02-13 10:19:31 +01:00
Andrea Corallo
3969a34fa1 Revert "Rename to inhibit-automatic-native-compilation"
This reverts commit f97993ee66.
2023-02-13 10:15:33 +01:00
Eli Zaretskii
2d1e43436d ; Improve documentation of hash functions.
* src/fns.c (Fsecure_hash, Fmd5): Document the length of the
return values.

* lisp/subr.el (sha1): Describe the return value in more detail.

* doc/lispref/text.texi (Checksum/Hash): Document 'sha1'.
Document the length of the strings returned by each hashing
algorithm.
2023-02-11 12:28:43 +02:00
Gregory Heytings
79ce185ad1 Update the documentation about labeled (locked) narrowing
* src/xdisp.c (syms_of_xdisp) <fontification-functions>: Update
docstring.

* src/keyboard.c (syms_of_keyboard) <pre-command-hook>:
(syms_of_keyboard) <post-command-hook>: Update docstring.

* src/editfns.c:
(narrowing_locks): Explain why an alist is used instead of a
buffer-local variable.
(reset_outermost_narrowings): Point to recipes that demonstrate
why it is necessary to restore the user narrowing bounds when
redisplay starts.
(Fwiden): Update docstring.
(Fnarrow_to_region): Update docstring.
(Finternal__lock_narrowing): Update docstring.
(Finternal__unlock_narrowing): Update docstring.
(Fsave_restriction): Update docstring.

* src/buffer.c (syms_of_buffer)
<long-line-optimizations-region-size>: Update docstring.
(syms_of_buffer) <long-line-optimizations-bol-search-limit>:
Update docstring.

* lisp/subr.el (with-narrowing): Update docstring.
(without-narrowing): Update docstring.

* etc/NEWS: Mention the 'long-line-optimizations-region-size' and
'long-line-optimizations-bol-search-limit' options.
Announce the 'with-narrowing' and 'without-narrowing' forms.

* doc/lispref/positions.texi (Narrowing): Update the documentation
of 'narrow-to-region', 'widen' and 'save-restriction'.  Document
the 'with-narrowing' and 'without-narrowing' special forms.

* doc/lispref/display.texi (Auto Faces): Update the documentation.

* doc/lispref/commands.texi (Command Overview): Document the fact
that the buffer is narrowed around 'pre-command-hook' and
'post-command-hook' when the buffer text includes very long lines.
2023-02-09 02:44:54 +01:00
Gregory Heytings
d8438e2bb4 Add 'without-narrowing' macro
* lisp/subr.el (without-narrowing): New macro, companion (and
almost identical) to 'with-narrowing'.
2023-02-09 02:44:41 +01:00
Gregory Heytings
97314447e6 Make 'narrowing-lock' and 'narrowing-unlock' internal
* src/editfns.c (Finternal__lock_narrowing): Renamed from
'narrowing-lock'.
(Finternal__unlock_narrowing): Renamed from 'narrowing-unlock'.
(unwind_narrow_to_region_locked):
(narrow_to_region_locked):
(syms_of_editfns): Use the new names.

* lisp/subr.el (internal--with-narrowing): Use the new name.
2023-02-09 02:44:36 +01:00
Eli Zaretskii
3a64f81ebc Don't clobber match data in 'y-or-n-p'
* lisp/subr.el (y-or-n-p): Avoid clobbering caller's match data.
(Bug#61091)
2023-02-04 10:15:18 +02:00
Sean Whitton
82ae9caadd * lisp/subr.el (while-let): Fix docs if-let->if-let* (bug#60758). 2023-01-15 10:01:41 -07:00
Sean Whitton
f16bd1ead4 Revert "* lisp/subr.el (while-let): Use if-let, not if-let* (bug#60758)."
This reverts commit 083badc9c1.
2023-01-15 09:57:41 -07:00
Stefan Monnier
59c3c53efa * lisp/subr.el (combine-change-calls-1): Fix bug#60467
Don't stop at timestamps.  Strip them for now, to be on the safe side.
Don't merge into `master` where we'll use a better fix.
2023-01-13 17:38:04 -05:00
Sean Whitton
083badc9c1 * lisp/subr.el (while-let): Use if-let, not if-let* (bug#60758). 2023-01-12 17:09:01 -07:00
Eli Zaretskii
8d530ca654 ; Fix documentation of y-or-n-p/yes-or-no-p
* lisp/subr.el (y-or-n-p):
* src/fns.c (Fyes_or_no_p): Doc fix.
2023-01-04 19:25:47 +02:00
Eli Zaretskii
cae528457c ; Add 2023 to copyright years. 2023-01-01 05:31:12 -05:00
Eli Zaretskii
9a386b682e Revert a recent change which causes errors
* lisp/subr.el (buffer-match-p): Undo last change, as it causes an
error in a timer function of show-paren-mode.
2022-12-31 18:32:54 +02:00
Philip Kaludercic
f309651b67 ; Fix handling of 'not' by 'buffer-match-p'
* lisp/subr.el (buffer-match-p): Look up the cadr instead of the cdr
for the negation in 'not'.
* doc/lispref/buffers.texi (Buffer List): Update documentation.
(Bug#58951)
2022-12-31 15:05:56 +01:00
Eli Zaretskii
26b2ec7cb8 Simplify last change (bug#60311)
* src/json.c (json_available_p): Use original code.  Always return
true for !WINDOWSNT.
(ensure_json_available): Now defined only on WINDOWSNT.
(Fjson_serialize, Fjson_insert, Fjson_parse_string)
(Fjson_parse_buffer): Call ensure_json_available only on
WINDOWSNT.

* lisp/subr.el (json-available-p): Simplify.
2022-12-26 15:26:48 +02:00
Mattias Engdegård
082fc6e308 Fix 'json-available-p' on MS-Windows
* src/json.c (json_available_p, ensure_json_available)
(Fjson__available_p): New functions.
(Fjson_serialize, Fjson_insert, Fjson_parse_string)
(Fjson_parse_buffer): Use ensure_json_available.
(syms_of_json): Defsubr json--available-p.

* lisp/subr.el (json-available-p): Rewrite.
2022-12-26 15:12:04 +02:00
Eli Zaretskii
eccb813a94 Fix "C-h k" in recursive minibuffers
* lisp/subr.el (event--posn-at-point): Leave POSN alone if it
doesn't have at least 6 members.  This follows more faithfully
what 'event-start' and 'event-end' did before they started using
this function, see commit c1cead89f5.  Call posn-at-point with
the minibuffer-window when in the minibuffer.  (Bug#60252)
2022-12-23 16:41:08 +02:00
Eli Zaretskii
d65beb820c ; Revert "; * lisp/subr.el (internal--with-narrowing): Simplify"
This reverts commit d9add66161.

Please install on the release branch only changes that fix
incorrect behavior.  Cleanups don't belong here.
2022-12-17 09:49:43 +02:00
Philip Kaludercic
d9add66161 ; * lisp/subr.el (internal--with-narrowing): Simplify
(Bug#60130)
2022-12-17 00:41:14 +01:00
Eli Zaretskii
f93a5180a6 Update the documentation of overlays (bug#59996)
* src/buffer.c (Foverlay_recenter, Foverlay_lists): Update the doc
strings.

* lisp/subr.el (copy-overlay): Update comment.

* doc/lispref/internals.texi (Buffer Internals): Remove buffer
fields relevant to the old implementation; add the new interval
tree field.
* doc/lispref/display.texi (Overlays, Managing Overlays): Update
text to be consistent with the new implementation of overlays.
(Managing Overlays): Remove documentation of 'overlay-recenter'.

* etc/NEWS: Mention incompatible aspects of overlay
reimplementation.
2022-12-14 20:13:47 +02:00
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