aboutsummaryrefslogtreecommitdiffstats
path: root/src (follow)
Commit message (Collapse)AuthorAgeFilesLines
* * src/keyboard.c (echo_add_key): Use recently rebound C-h key C-q (bug#60249)Juri Linkov2022-12-291-3/+2
|
* Avoid assertion violations in treesit.c with --enable-checkingEli Zaretskii2022-12-291-4/+3
| | | | | | | * src/treesit.c (Ftreesit_node_first_child_for_pos) (Ftreesit_node_descendant_for_range): Check validity of buffer positions before converting them to byte-positions, to avoid assertion violations in buf_charpos_to_bytepos.
* Call tree-sitter parser notifier on the first parseYuan Fu2022-12-281-9/+19
| | | | | | * src/treesit.c (treesit_call_after_change_functions): Handle NULL old_tree. (treesit_ensure_parsed): Remove check for NULL tree.
* Fix tree-sitter parser notifier recursionYuan Fu2022-12-281-5/+14
| | | | | | | | See the comment for detail. * src/treesit.c (treesit_ensure_parsed): Move the need_reparse short circuit to the very beginning. Move the call to treesit_call_after_change_functions to the very end.
* Make last change of w32 GUI dialogs conditional and reversibleEli Zaretskii2022-12-282-3/+13
| | | | | | | | | | | | * src/w32term.c (syms_of_w32term) <w32-yes-no-dialog-show-cancel>: New boolean variable. (w32_initialize): Fix query for visible system caret: 'bool' is a single-byte data type, whereas SystemParametersInfo wants a BOOL, which is a 32-bit int. * src/w32menu.c (simple_dialog_show): Show "Cancel" button only if 'w32-yes-no-dialog-show-cancel' is non-nil. * etc/NEWS: Announce the change.
* * src/w32menu.c (simple_dialog_show): Use MB_YESNOCANCEL style.Eli Zaretskii2022-12-271-2/+8
|
* ; Improve documentation of TAB/SPC indentationEli Zaretskii2022-12-271-0/+2
| | | | | | * lisp/indent.el (tab-to-tab-stop): * src/indent.c (Findent_to): Mention 'indent-tabs-mode' in doc strings.
* Add a new tree-sitter query predicate 'pred'Yuan Fu2022-12-261-12/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I realized that using an arbitrary function as the predicate in queries is very helpful for some queries I'm writing for python and javascript, and presumably most other languages[1]. Granted, we can already filter out unwanted nodes by using a function instead of a face for the capture name, and (1) determine whether the captured node is valid and (2) fontify that node if it's valid. However, such approach is a bit more cumbersome and more importantly gets in the way of another potential use of the fontification queries: context extraction. For example, I could use the query for the 'variable' feature to get all the variables in a certain region. In this use-case, we want the filtering happen before returning the captured nodes. Besides, the change is relatively small and straightforward: most code are already there, I just need to add some boilerplate. [1] For a code like aa.bb(cc), we want bb to be in function face, because obviously its a function. But for aa.bb, we want bb to be in property face, because it's a property. In the AST, bb is always a property, the difference between the two cases is the enclosing node: in the first case, aa.bb is in a "call_expression" node, indicating that bb is used as a function (a method). So we want a predicate function that checks whether bb is used as a function or a property, and determine whether it should be in function or property face. * doc/lispref/parsing.texi (Pattern Matching): Update manual. * src/treesit.c (Ftreesit_pattern_expand): Handle :pred. (treesit_predicate_capture_name_to_node): A new function extracted from treesit_predicate_capture_name_to_text. (treesit_predicate_capture_name_to_text): Use the newly extracted function. (treesit_predicate_pred): New predicate function. (treesit_eval_predicates): Add new predicate. Also fix a bug: we want to AND the results of each predicate. * test/src/treesit-tests.el (treesit--ert-pred-last-sibling): New helper function. (treesit-query-api): Test #pred predicate.
* Improve handling of tab-bar height.Gregory Heytings2022-12-261-3/+5
| | | | | | * src/xdisp.c (redisplay_tab_bar): When 'auto-resize-tab-bar' is not 'grow-only', also consider the case when the tab-bar height needs to shrink. Fixes bug#60210.
* Simplify last change (bug#60311)Eli Zaretskii2022-12-261-14/+26
| | | | | | | | | | | * 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.
* Fix 'json-available-p' on MS-WindowsMattias Engdegård2022-12-261-52/+39
| | | | | | | | | | * 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.
* Add maintainer stub for tree-sitter filesYuan Fu2022-12-261-0/+2
| | | | | * lisp/treesit.el: * src/treesit.c: Add maintainer.
* ; Fix typosStefan Kangas2022-12-265-6/+6
| | | | (cherry picked from commit a5d39e11443fa30c8e8bc58254a1a59550dcd99e)
* ; * src/process.c (Fprocess_running_child_p): Doc fix.Eli Zaretskii2022-12-251-4/+7
|
* ; * src/xdisp.c (redisplay_internal): Reinstate the FRAME_LIVE_P test.Eli Zaretskii2022-12-241-0/+4
|
* ; Add treesit_recursion_limitYuan Fu2022-12-241-3/+8
| | | | | | | * src/treesit.c (treesit_recursion_limit): New constant. (treesit_cursor_helper) (Ftreesit_search_subtree) (Ftreesit_induce_sparse_tree): Use the new constant.
* Fix treesit_cursor_helper (bug#60267)Yuan Fu2022-12-241-53/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The cause of that bug is that in a particular parse tree, the node treesit_cursor_helper tries to go to is a missing node, not only is it a missing node, it is the first node of a subtree. So when treesit_cursor_helper follows the algorithm and goes down the tree, it goes down the previous subtree (because that subtree's end = end_pos, because the target node has zero width). o | o--+-o | | +-+ +-+-+ | | | | | o x t o o (We ended up in x when the target is t, because t has zero width.) One way to solve it is to go back up the tree if we are at a leaf node and still haven't matched the target node. That's too ugly and finicky so I resorted to recursion. Now one more functions will return give up (treesit_node_parent) if we are in a werid parse tree that is super deep. But since we already kind of give up on this kind of parse trees (bug#59426), it doesn't really hurt. * src/treesit.c (treesit_cursor_helper_1): New function. (treesit_cursor_helper): Use the new function. Change return type to bool, and accept a cursor pointer. (Ftreesit_node_parent) (Ftreesit_search_subtree) (Ftreesit_search_forward) (Ftreesit_induce_sparse_tree): Use the new signature.
* Fix restart-emacs alarms (Bug#60220)Paul Eggert2022-12-241-0/+1
| | | | | * src/emacs.c (Fkill_emacs): Turn timers off before execing, so that the re-execed Emacs doesn’t get a timer alarm.
* Fix crash after X errorPo Lu2022-12-241-5/+7
| | | | | * src/xdisp.c (redisplay_internal): Catch another crash if gcscrollbars after an X error.
* Fix "C-h k" in recursive minibuffersEli Zaretskii2022-12-231-1/+2
| | | | | | | | * 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 c1cead89f5f. Call posn-at-point with the minibuffer-window when in the minibuffer. (Bug#60252)
* ; * src/alloc.c (Fmemory_info): Doc fix.Eli Zaretskii2022-12-221-1/+1
|
* Fix write-region to null device on MS-WindowsEli Zaretskii2022-12-211-3/+7
| | | | | | * src/fileio.c (write_region) [WINDOWSNT]: Ignore EBADF errors from fsync -- this means fsync is not supported for this file. Happens, for example, with the null device. (Bug#59545)
* ; * src/emacs-module.h.in (enum emacs_funcall_exit): Fix typo.Philipp Stephani2022-12-201-1/+1
|
* Fix the MS-DOS buildPo Lu2022-12-181-5/+10
| | | | * src/lread.c (syms_of_lread): Make the MS-DOS build work again.
* Avoid crashes in PGTK build due to signal in 'note_mouse_highlight'Eli Zaretskii2022-12-181-4/+7
| | | | | | | | * src/xdisp.c (string_buffer_position): Make sure the TO argument of 'string_buffer_position_lim' is always inside [BEGV..ZV]. Otherwise 'string_buffer_position_lim' might call 'get-char-property' and friends with invalid position, which will just signal an error and do nothing useful. (Bug#60144)
* Fix MS-Windows build broken by recent treesit.c changesEli Zaretskii2022-12-181-4/+8
| | | | | | | * src/treesit.c (init_treesit_functions, ts_tree_cursor_copy) (ts_tree_cursor_delete): Add boilerplate for using new tree-sitter functions. (ts_node_parent): Delete boilerplate of unused function.
* Use cursor API in treesit-node-parentYuan Fu2022-12-171-6/+13
| | | | | | | | This is the last part of the change that fixes bug#60054. The previous change fixes it for searching functions, this fixes for treesit-node-parent. * src/treesit.c (Ftreesit_node_parent): Use the new cursor API.
* Switch to use cursor API in treesit.cYuan Fu2022-12-171-125/+187
| | | | | | | | | | | | | | | | | | | | | | | | | | | ts_node_parent has bugs (bug#60054), using cursor API avoids that. Tree-sitter's author might remove ts_node_parent in the future, so might as well switch to use cursors now. We are basically reimplementing some of the logic of ts_node_prev_sibling and ts_node_parent in the sibling helper and cursor helper functions. See also https://github.com/tree-sitter/tree-sitter/issues/1992 * src/treesit.c (treesit_traverse_sibling_helper) (treesit_traverse_child_helper) (treesit_traverse_match_predicate): Reimplemented to use the cursor API. (treesit_search_dfs) (treesit_search_forward): Use the new cursor helper functions. (Ftreesit_search_subtree) (Ftreesit_search_forward) (Ftreesit_induce_sparse_tree): Use cursors. * test/src/treesit-tests.el (treesit-search-subtree): New test. (treesit--ert-search-setup): New macro. (treesit-search-forward) (treesit-search-forward-named-only) (treesit-search-backward) (treesit-search-backward-named-only) (treesit-cursor-helper-with-missing-node): New tests.
* Add treesit_assume_true and treesit_cursor_helperYuan Fu2022-12-171-0/+67
| | | | | | | | | This is part 1 of the change to change node API to cursor API. See the second part for more detail. (I splitted the change to make the diff more sane.) * src/treesit.c (treesit_assume_true) (treesit_cursor_helper): New functions.
* Use make-directory handlers uniformlyPaul Eggert2022-12-171-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Formerly, the code supported both make-directory and make-directory-internal handlers. This led to confusion and meant than in a few cases (nnmaildir, ido) remote directories could not be used in some cases. Fix this by using only make-directory handlers. Perhaps there used to be a reason for why there were both make-directory and make-directory-internal handlers, but whatever that reason was, it seems to have vanished even before now. There is no longer any need for make-directory-internal handlers, as the few remaining callers that use make-directory-internal do so only when there are no handlers. However, this change keeps the existing make-directory-internal handlers for now, in case this code is ever used in older Emacs versions that still call those handlers. * lisp/gnus/nnmaildir.el (nnmaildir--mkdir): * lisp/ido.el (ido-file-internal): * lisp/net/tramp-smb.el (tramp-smb-handle-make-directory): Use make-directory, not make-directory-internal. * lisp/net/tramp-smb.el (tramp-smb-handle-make-directory-internal): Now obsolete. * src/fileio.c (Fmake_directory_internal): Do not look for or use a make-directory-internal handler. * test/lisp/files-tests.el: (files-tests-file-name-non-special-make-directory-internal): Remove, as this test incorrectly assumes that make-directory-internal must support handlers.
* Fix resizing of mini-windows by 'set-minibuffer-message'Eli Zaretskii2022-12-171-0/+7
| | | | | * src/xdisp.c (redisplay_window): Always resize mini-windows displaying the active minibuffer. (Bug#60015)
* ; Improve wording of 'format' doc stringEli Zaretskii2022-12-161-12/+12
| | | | | * src/editfns.c (Fformat): Use "produce" instead of "print". (Bug#60125)
* Fix SVG scaling (bug#59802)Manuel Giraud2022-12-161-0/+9
| | | | | | | | Fix SVG scaling with librsvg>2.52 and SVG file with only one known dimension. * src/image.c (svg_load_image): Compute a percentage dimension with the other known dimension.
* ; Fix last changes in buffer.cEli Zaretskii2022-12-161-0/+1
| | | | | * src/buffer.c (other_buffer_safely): Ensure Lisp Interaction mode in *scratch*. (Bug#60096)
* A better fix for bug#60096Eli Zaretskii2022-12-162-2/+21
| | | | | | | | | | | * lisp/startup.el (initial-scratch-message): * lisp/simple.el (get-scratch-buffer-create): Revert last changes. * src/window.c (Fset_window_configuration): Force recalculation of Vwindow_list after restoring the windows. * src/buffer.c (other_buffer_safely): Make sure we always return a valid buffer, even if 'get-scratch-buffer-create' signals an error.
* ; Fix printing Lisp types in .gdbinitEli Zaretskii2022-12-161-1/+2
| | | | | * src/alloc.c (valid_lisp_object_p): Support printing stack-allocated strings and cons cells.
* ; Fix typosStefan Kangas2022-12-163-3/+3
|
* Update the documentation of overlays (bug#59996)Eli Zaretskii2022-12-141-6/+11
| | | | | | | | | | | | | | | | | * 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.
* ; Fix typosStefan Kangas2022-12-131-1/+1
|
* Improve resetting face attributes when looking for suitable fontsEli Zaretskii2022-12-131-29/+52
| | | | | | | | | * src/xfaces.c (syms_of_xfaces)<face-font-lax-matched-attributes>: Change the default value to t. Update doc string. (realize_gui_face): When 'Vface_font_lax_matched_attributes' is t, reset the 3 default font attributes efficiently. Call 'font_maybe_unset_attribute' only if the value is neither nil nor t. (Bug#59347)
* ; Avoid compilation warning on MS-WindowsEli Zaretskii2022-12-121-0/+4
| | | | | * src/timefns.c (sys_clock): Declare, to avoid compilation warning.
* Revert "Revert "Improve last change to xfaces.c" (05ece1eb8b)"Po Lu2022-12-121-52/+59
| | | | | | | This reverts commit b8d2ec920f37f5d77d32440eefc97dd5e8c2c7dc. Not only does it make debugging Emacs harder for users, that change is unsafe for the Haiku port.
* Revert "Improve last change to xfaces.c" (05ece1eb8b)Gregory Heytings2022-12-121-59/+52
| | | | | | * src/xfaces.c: Revert 05ece1eb8b. See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=59347#331.
* ; Minor cleanup of last change in xfaces.c.Eli Zaretskii2022-12-111-24/+24
|
* ; Improve docs of relaxing face-font attribute match (bug#59347)Eli Zaretskii2022-12-111-22/+22
| | | | | * src/xfaces.c (realize_gui_face): Fix typo and coding style. (syms_of_xfaces) <face-font-lax-matched-attributes>: A better name.
* Improve last change to xfaces.cPo Lu2022-12-111-54/+61
| | | | | | | | | * src/xfaces.c (font_unset_attribute): New function. (realize_gui_face): Improve commentary and use list instead of bitmask. (syms_of_xfaces): Get rid of bitmask. Replace it by a list, there is no reason any user should have to think about bitmasks in Emacs lisp.
* Actually improve detection of long linesGregory Heytings2022-12-114-15/+1
| | | | | | | | | | | * src/xdisp.c (redisplay_window): Update condition. * src/xdisp.c (mark_window_display_accurate_1): * src/pdumper.c (dump_buffer): * src/buffer.h (BUF_CHARS_UNCHANGED_MODIFIED): (struct buffer_text): * src/buffer.c (Fget_buffer_create): Revert 1c837c42c2, which was misguided.
* Unset the weight/slant/width in the spec when realizing a fontGregory Heytings2022-12-101-2/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | Between commits bf0d3f76dc (2014) and 6b1ed2f2c9 (2022), realize_gui_face called font_load_for_lface with an empty or partly emptied font spec, i.e. it ignored a part of its attrs argument. The rationale given in bug#17973, which led to bf0d3f76dc, is not clear. However, 6b1ed2f2c9, which passes the full font spec to font_load_for_lface and font_find_for_lface, leads to suboptimal font choices, for example when the font chosen for the default face has a weight, slant or width that is not supported by other available fonts on the system, such as 'medium' or 'heavy'. If these attributes are not unset here, the call to font_list_entities in font_find_for_lface arbitrarily limits the candidate font list to those that are perfect matches for these attributes, which means that the scoring mechanism is bypassed. Note that the size attribute in spec is also unset, in font_find_for_lface. Also allow unsetting the other attributes, for debugging purposes. * src/xfaces.c (realize_gui_face): Unset the weight, slant and width of the font spec. Fixes bug#57555 and bug#59347. (syms_of_xfaces): New variable 'realize-gui-face-ignored-spec-attributes'.
* Make indirect buffers use tree-sitter parsers of their base bufferYuan Fu2022-12-091-17/+44
| | | | | | | | | | | | Fix the problem described in bug#59693. * src/treesit.c (treesit_record_change): Always use the base buffer. (Ftreesit_parser_create): Always use the base buffer. Also change the for loop into FOR_EACH_TAIL (stylistic change). (Ftreesit_parser_list): Always use the base buffer. * doc/lispref/parsing.texi (Using Parser): Update manual. * test/src/treesit-tests.el (treesit-indirect-buffer): New test.
* ; Prefer HTTPS to HTTP in some URLsStefan Kangas2022-12-092-2/+2
|