Merge from origin/emacs-29

72a81e2022 ; * lisp/treesit.el (treesit-simple-indent-presets): Fix t...
ddfeee3e8a Build recipe interactively in treesit-install-language-gra...
6837469780 ; Add REVISION to treesit-language-source-alist
0dc788aa01 ; Remove GRAMMAR-DIR from treesit-language-source-alist
f9aef67c36 Tweak csharp-mode font-lock-settings (bug#60376)
46362c0a3a ; * doc/lispref/tips.texi (Documentation Tips): Add indexing.
9a386b682e Revert a recent change which causes errors
9871ee8b14 ; More fixes for documentation of 'defalias'
f309651b67 ; Fix handling of 'not' by 'buffer-match-p'
9292f595a7 ; Fix typos
43c7e05a2a Fix misspelled functions in shortdoc groups
01acecc79c Simplify introduction of use-package manual
2a7e072e53 ; Fix documentation of 'defalias'
eee2aeca25 Fix python-shell-buffer-substring when retrieving a single...
bfdad6c4e5 ; Fix recent treesit-related changes
This commit is contained in:
Eli Zaretskii 2023-01-01 05:46:24 -05:00
commit 861d3db634
33 changed files with 269 additions and 146 deletions

View file

@ -4302,7 +4302,7 @@
(install-arch-indep): Don't install-etc for self-contained ns builds.
* configure.in (GCC_TEST_OPTIONS, NON_GCC_TEST_OPTIONS) <darwin>:
No longer unconditonally add /sw directories. (Bug#2280)
No longer unconditionally add /sw directories. (Bug#2280)
* Makefile.in (install-arch-dep): Depend on install-arch-indep.
(install-arch-indep): Depend on install-leim.

View file

@ -11843,7 +11843,7 @@
2016-01-05 Alan Mackenzie <acm@muc.de>
Make C++ buffers writeable when writing their initial text properties.
Make C++ buffers writable when writing their initial text properties.
This is a correction to yesterday's CC Mode patch.

View file

@ -10733,7 +10733,7 @@
Bump lisp/progmodes/project.el version to 0.7.1
Amont other things exposes the new project-buffers generic function to
Among other things exposes the new project-buffers generic function to
ELPA users.
* lisp/progmodes/project.el (Version): Bump to 0.7.1
@ -25218,7 +25218,7 @@
2021-05-12 Richard Stallman <rms@gnu.org>
Little improvements in rmail.el. Recognize encryped override headers.
Little improvements in rmail.el. Recognize encrypted override headers.
* lisp/mail/rmail.el (rmail-simplified-subject): Delete `[External] :'.
(rmail-reply): In encrypted message, search for other header fields
@ -27333,7 +27333,7 @@
2021-04-24 Glenn Morris <rgm@gnu.org>
Simlify top-level Makefile since admin is always included
Simplify top-level Makefile since admin is always included
* Makefile.in (clean_dirs, distclean_dirs, maintainer_clean_dirs):
Add admin directories.
@ -27668,7 +27668,7 @@
* lisp/international/mule-cmds.el (ucs-names):
* lisp/progmodes/ebrowse.el (ebrowse-read):
* test/src/coding-tests.el (benchmark-decoder): Avoid lowering
gc-cons-treshold.
gc-cons-threshold.
2021-04-22 Stefan Kangas <stefan@marxist.se>
@ -46569,7 +46569,7 @@
Fix syntax of symbol and punctuation characters
* lisp/international/characters.el: Adjust syntax of punctuation
and symbol charcaters to follow that of Unicode properties.
and symbol characters to follow that of Unicode properties.
(Bug#44974)
2021-01-02 Andrea Corallo <akrl@sdf.org>
@ -63457,9 +63457,9 @@
2020-09-30 Lars Ingebrigtsen <larsi@gnus.org>
Fix isearch-group-* colors on low-colour displays
Fix isearch-group-* colors on low-color displays
* lisp/isearch.el (isearch-group-1): On low-colour displays, just
* lisp/isearch.el (isearch-group-1): On low-color displays, just
use the normal isearch color (bug#43702).
(isearch-group-2 etc): Ditto.
@ -123828,7 +123828,7 @@
* doc/lispref/text.texi (Special Properties): For the hook property
modification-hooks, state that inhibit-modification-hooks is NOT bound to
non-nil when calling its functions. For the hooks insert-in-fron-hooks and
non-nil when calling its functions. For the hooks insert-in-front-hooks and
insert-behind-hooks, state that that variable does get bound to non-nil.
2019-06-24 Hong Xu <hong@topbug.net>
@ -156545,7 +156545,7 @@
Obsolete Flymake's flymake-diagnostic-types-alist
That variable was an association between symbols and properties,
effecively duplicating symbol's property lists. It is simpler to just
effectively duplicating symbol's property lists. It is simpler to just
put properties on symbols. Backward compatibility to the old variable
has been kept.
@ -190693,7 +190693,7 @@
Support multi-lingual detection of SEE ALSO man sections
* lisp/man.el (Man-see-also-regexp): Add support for SEE ALSO
section detection in several langages: French, German, Spanish,
section detection in several languages: French, German, Spanish,
Portuguese, Italian, Polish, Turkish, Japanese, Chinese. (Bug#28142)
2017-08-26 Paul Eggert <eggert@cs.ucla.edu>

View file

@ -240,7 +240,7 @@
the comment node.
</p>
</dd>
<dt id='index-coment_002dstart_002dskip'><span><code>coment-start-skip</code><a href='#index-coment_002dstart_002dskip' class='copiable-anchor'> &para;</a></span></dt>
<dt id='index-coment_002dstart_002dskip'><span><code>comment-start-skip</code><a href='#index-coment_002dstart_002dskip' class='copiable-anchor'> &para;</a></span></dt>
<dd><p>This anchor is a function that is called with 3 arguments: <var>node</var>,
<var>parent</var>, and <var>bol</var>, and returns the position after the
comment-start token and any whitespace characters following that

View file

@ -2201,7 +2201,7 @@
* doclicense.texi: Update to latest version from FSF.
These are just minor editorial changes.
* elisp.texi (GNU Free Documentation License)
(GNU General Public Licens):
(GNU General Public License):
Provide sectioning, since doclicense.texi no longer does that.
* loading.texi (Named Features): @ -> @@ to fix typo.

View file

@ -977,17 +977,15 @@ first argument is @var{buffer-or-name} and the second is @var{arg}
A cons-cell @code{(@var{oper} . @var{expr})} where @var{oper} is one
of
@table @code
@item not
Satisfied if @var{expr} doesn't satisfy @code{buffer-match-p} with
@item (not @var{cond})
Satisfied if @var{cond} doesn't satisfy @code{buffer-match-p} with
the same buffer and @code{arg}.
@item or
Satisfied if @var{expr} is a list and @emph{any} condition in
@var{expr} satisfies @code{buffer-match-p}, with the same buffer and
@code{arg}.
@item and
Satisfied if @var{expr} is a list and @emph{all} conditions in
@var{expr} satisfy @code{buffer-match-p}, with the same buffer and
@code{arg}.
@item (or @var{conds}@dots{})
Satisfied if @emph{any} condition in @var{conds} satisfies
@code{buffer-match-p}, with the same buffer and @code{arg}.
@item (and @var{conds}@dots{})
Satisfied if @emph{all} the conditions in @var{conds} satisfy
@code{buffer-match-p}, with the same buffer and @code{arg}.
@item derived-mode
Satisfied if the buffer's major mode derives from @var{expr}.
@item major-mode

View file

@ -700,8 +700,10 @@ redefinition from unintentional redefinition.
@defun defalias name definition &optional doc
@anchor{Definition of defalias}
This function defines the symbol @var{name} as a function, with
definition @var{definition} (which can be any valid Lisp function).
Its return value is @emph{undefined}.
definition @var{definition}. @var{definition} can be any valid Lisp
function or macro, or a special form (@pxref{Special Forms}), or a
keymap (@pxref{Keymaps}), or a vector or string (a keyboard macro).
The return value of @code{defalias} is @emph{undefined}.
If @var{doc} is non-@code{nil}, it becomes the function documentation
of @var{name}. Otherwise, any documentation provided by
@ -713,10 +715,10 @@ If @var{name} has a @code{defalias-fset-function} property, however,
the associated value is used as a function to call in place of @code{fset}.
The proper place to use @code{defalias} is where a specific function
name is being defined---especially where that name appears explicitly in
the source file being loaded. This is because @code{defalias} records
which file defined the function, just like @code{defun}
(@pxref{Unloading}).
or macro name is being defined---especially where that name appears
explicitly in the source file being loaded. This is because
@code{defalias} records which file defined the function, just like
@code{defun} (@pxref{Unloading}).
By contrast, in programs that manipulate function definitions for other
purposes, it is better to use @code{fset}, which does not keep such

View file

@ -154,9 +154,9 @@ them.
@end defun
@defun treesit-language-abi-version language
This function returns the language grammar @acronym{ABI} version of
language grammar for @var{language} loaded by Emacs. If
@var{language} is unavailable, this function returns @code{nil}.
This function returns the @acronym{ABI} version of the language
grammar library loaded by Emacs for @var{language}. If @var{language}
is unavailable, this function returns @code{nil}.
@end defun
@heading Concrete syntax tree

View file

@ -689,6 +689,10 @@ line. This looks nice in the source code, but looks bizarre when users
view the documentation. Remember that the indentation before the
starting double-quote is not part of the string!
@cindex quoting apostrophe and grave accent in doc strings
@cindex apostrophe, quoting in documentation strings
@cindex grave accent, quoting in documentation strings
@cindex escaping apostrophe and grave accent in doc strings
@item
When documentation should display an ASCII apostrophe or grave accent,
use @samp{\\='} or @samp{\\=`} in the documentation string literal so

View file

@ -132,19 +132,9 @@ do.
@cindex quick-start instructions
This chapter provides instructions and examples for quickly getting
started with use-package. The first thing you need to do is make sure
that @file{use-package} itself is loaded. To do that, put this at the
top of your init file:
@lisp
(require 'use-package)
@end lisp
@cindex declaration
The above makes the @code{use-macro} available for us in the rest of
your init file. In this manual, we say that each call to
@code{use-macro} is a @dfn{declaration}, to highlight the declarative
nature of its syntax.
started with use-package. In this manual, we say that each call to
the @code{use-package} macro in your init file is a @dfn{declaration},
to highlight the declarative nature of its syntax.
To unconditionally load a package named @samp{foo}, add the following
declaration to your init file:

View file

@ -10968,8 +10968,8 @@
* comint.el (comint-history-isearch-end):
Use `isearch-search-fun-default'.
(comint-history-isearch-search): Use `isearch-search-fun-default'
and remove spacial case for `isearch-word'.
(comint-history-isearch-wrap): Remove spacial case for
and remove special case for `isearch-word'.
(comint-history-isearch-wrap): Remove special case for
`isearch-word'.
* hexl.el (hexl-isearch-search-function):
@ -10982,13 +10982,13 @@
Use `isearch-search-fun-default'.
* simple.el (minibuffer-history-isearch-search):
Use `isearch-search-fun-default' and remove spacial case for
Use `isearch-search-fun-default' and remove special case for
`isearch-word'.
(minibuffer-history-isearch-wrap): Remove spacial case for
(minibuffer-history-isearch-wrap): Remove special case for
`isearch-word'.
* textmodes/reftex-global.el (reftex-isearch-wrap-function):
Remove spacial case for `isearch-word'.
Remove special case for `isearch-word'.
(reftex-isearch-isearch-search): Use `isearch-search-fun-default'.
2012-05-28 Agustín Martín Domingo <agustin.martin@hispalinux.es>

View file

@ -15465,7 +15465,7 @@
2013-12-12 Fabián Ezequiel Gallina <fgallina@gnu.org>
* progmodes/python.el (python-indent-context)
(python-indent-calculate-indentation): Fix auto-identation
(python-indent-calculate-indentation): Fix auto-indentation
behavior for comment blocks. (Bug#15916)
2013-12-12 Nathan Trapuzzano <nbtrap@nbtrap.com> (tiny change)

View file

@ -517,7 +517,7 @@ cons cells of the form (NAME . NUM). See `sort' for more details."
(if (eobp) (newline num))
(if (< x 0) (setq x 0))
(if (< y 0) (setq y 0))
;; Now, a quicky column moveto/forceto method.
;; Now, a quickie column moveto/forceto method.
(or (= (move-to-column x) x)
(let ((p (point)))
(indent-to x)

View file

@ -421,8 +421,8 @@ A FUNC form can have any number of `:no-eval' (or `:no-value'),
(file-readable-p
:no-eval (file-readable-p "/tmp/foo")
:eg-result t)
(file-writeable-p
:no-eval (file-writeable-p "/tmp/foo")
(file-writable-p
:no-eval (file-writable-p "/tmp/foo")
:eg-result t)
(file-accessible-directory-p
:no-eval (file-accessible-directory-p "/tmp")
@ -652,8 +652,8 @@ A FUNC form can have any number of `:no-eval' (or `:no-value'),
:eval (mapcan #'list '(1 2 3)))
(mapc
:eval (mapc #'insert '("1" "2" "3")))
(reduce
:eval (reduce #'+ '(1 2 3)))
(seq-reduce
:eval (seq-reduce #'+ '(1 2 3) 0))
(mapconcat
:eval (mapconcat #'identity '("foo" "bar") "|"))
"Predicates"

View file

@ -334,7 +334,7 @@ as the new values of the bound variables in the recursive invocation."
(defun string-glyph-split (string)
"Split STRING into a list of strings representing separate glyphs.
This takes into account combining characters and grapheme clusters:
if compositions are enbaled, each sequence of characters composed
if compositions are enabled, each sequence of characters composed
on display into a single grapheme cluster is treated as a single
indivisible unit."
(let ((result nil)

View file

@ -216,7 +216,7 @@ nil. If SIMPLE-FUNCTION is non-nil, call the function with no
arguments and then pass its return value to `eshell-apply-indices'.
When VALUE is a function, it's read-only by default. To make it
writeable, use the (GET . SET) form described above. If SET is a
writable, use the (GET . SET) form described above. If SET is a
function, it takes two arguments: a list of indices (currently
always nil, but reserved for future enhancement), and the new
value to set.

View file

@ -8859,7 +8859,7 @@
signencrypt.
* mml-sec.el (mml-secure-message-encrypt-pgpmime): Ditto.
* mml.el (mml-generate-mime-1): Change logic so a part which is
both signed & encryped is processed in one operation (rather than
both signed & encrypted is processed in one operation (rather than
two separate ops: sign, then encrypt).
* mml2015.el (mml2015-gpg-extract-signature-details): Give some
indication if a message is signed by an expired key.

View file

@ -17348,7 +17348,7 @@
* rfc2047.el (rfc2047-quote-special-characters-in-quoted-strings):
New function.
(rfc2047-encode-message-header, rfc2047-encode-region): Use it.
(rfc2047-strip-backslashes-in-quoted-strings): New fnction.
(rfc2047-strip-backslashes-in-quoted-strings): New function.
(rfc2047-decode-region): Use it; add optional argument `address-mime'.
(rfc2047-decode-string): Ditto.
(rfc2047-decode-address-region): New function.

View file

@ -2822,7 +2822,7 @@ systematically send encrypted emails when possible."
The value must be a list of three elements, all strings:
- Key ID, in hexadecimal form;
- Key URL or ASCII armoured key; and
- Key URL or ASCII armored key; and
- Protection preference, one of: \"unprotected\", \"sign\",
\"encrypt\" or \"signencrypt\".

View file

@ -761,7 +761,7 @@
below, docstring was usually completely rewritten. Use "on"
instead of "t" in docstring to match what is seen in customization
buffer. Use headline capitalization. Standardize on "Auto-detect"
text when option has that capibility.
text when option has that capability.
(mh): Since we work on more than one type of Emacs, use Emacs
instead of GNU Emacs. Prefer GNU mailutils over GNU Mailutils.
(mh-variant): s/Autodetect at startup/Auto-detect/.

View file

@ -95,7 +95,7 @@ This variable becomes local to a buffer when set in any fashion for it.
It is better to use the function of the same name to change the behavior of
directory tracking in an rlogin session once it has begun, rather than
simply setting this variable, since the function does the necessary
re-synching of directories."
re-syncing of directories."
:type '(choice (const :tag "off" nil)
(const :tag "ftp" t)
(other :tag "local" local))

View file

@ -1700,7 +1700,7 @@ Expansion occurs in a temporary Org mode buffer."
(condition-case error
(insert-file-contents filename)
(error
(insert (format "%%![couldn not insert %s: %s]"
(insert (format "%%![could not insert %s: %s]"
filename
error))))))))
;; Mark %() embedded elisp for later evaluation.

View file

@ -5299,7 +5299,7 @@ indentation removed from its contents."
;; mechanism is robust enough to preserve total order among elements
;; even when the tree is only partially synchronized.
;;
;; The cache code debuggin is fairly complex because cache request
;; The cache code debugging is fairly complex because cache request
;; state is often hard to reproduce. An extensive diagnostics
;; functionality is built into the cache code to assist hunting bugs.
;; See `org-element--cache-self-verify', `org-element--cache-self-verify-frequency',

View file

@ -692,25 +692,47 @@ compilation and evaluation time conflicts."
(defvar csharp-ts-mode--font-lock-settings
(treesit-font-lock-rules
:language 'c-sharp
:feature 'expression
'((conditional_expression (identifier) @font-lock-variable-name-face)
(postfix_unary_expression (identifier)* @font-lock-variable-name-face)
(assignment_expression (identifier) @font-lock-variable-name-face))
:language 'c-sharp
:feature 'bracket
'((["(" ")" "[" "]" "{" "}"]) @font-lock-bracket-face)
:language 'c-sharp
:feature 'delimiter
'((["," ":" ";"]) @font-lock-delimiter-face)
:language 'c-sharp
:feature 'error
'((ERROR) @font-lock-warning-face)
:language 'c-sharp
:override t
:feature 'comment
'((comment) @font-lock-comment-face)
'((comment) @font-lock-comment-face)
:language 'c-sharp
:override t
:feature 'keyword
`([,@csharp-ts-mode--keywords] @font-lock-keyword-face
(modifier) @font-lock-keyword-face
(this_expression) @font-lock-keyword-face)
:language 'c-sharp
:override t
:feature 'attribute
:feature 'property
`((attribute (identifier) @font-lock-property-face (attribute_argument_list))
(attribute (identifier) @font-lock-property-face))
:language 'c-sharp
:override t
:feature 'escape-sequence
'((escape_sequence) @font-lock-escape-face)
:language 'c-sharp
:override t
:feature 'literal
@ -718,6 +740,7 @@ compilation and evaluation time conflicts."
(real_literal) @font-lock-number-face
(null_literal) @font-lock-constant-face
(boolean_literal) @font-lock-constant-face)
:language 'c-sharp
:override t
:feature 'string
@ -730,6 +753,7 @@ compilation and evaluation time conflicts."
"$\""
"@$\""
"$@\""] @font-lock-string-face)
:language 'c-sharp
:override t
:feature 'type
@ -750,14 +774,14 @@ compilation and evaluation time conflicts."
target: (identifier) @font-lock-type-face)
(type_of_expression (identifier) @font-lock-type-face)
(object_creation_expression (identifier) @font-lock-type-face))
:language 'c-sharp
:feature 'definition
:override t
'((qualified_name (identifier) @font-lock-type-face)
(using_directive (identifier) @font-lock-type-face)
(using_directive (name_equals
(identifier) @font-lock-type-face
["="] @default-face))
(identifier) @font-lock-type-face))
(enum_declaration (identifier) @font-lock-type-face)
(enum_member_declaration (identifier) @font-lock-variable-name-face)
@ -820,24 +844,11 @@ compilation and evaluation time conflicts."
(binary_expression (identifier) @font-lock-variable-name-face)
(argument (identifier) @font-lock-variable-name-face))
:language 'c-sharp
:feature 'expression
'((conditional_expression (identifier) @font-lock-variable-name-face)
(postfix_unary_expression (identifier)* @font-lock-variable-name-face)
(assignment_expression (identifier) @font-lock-variable-name-face))
:language 'c-sharp
:feature 'bracket
'((["(" ")" "[" "]" "{" "}"]) @font-lock-bracket-face)
:language 'c-sharp
:feature 'delimiter
'((["," ":" ";"]) @font-lock-delimiter-face)
:language 'c-sharp
:feature 'escape-sequence
:override t
'((escape_sequence) @font-lock-escape-face
(ERROR) @font-lock-warning-face)))
'((escape_sequence) @font-lock-escape-face)))
;;;###autoload
(add-to-list 'auto-mode-alist '("\\.cs\\'" . csharp-mode))
@ -908,9 +919,9 @@ Key bindings:
(setq-local treesit-font-lock-settings csharp-ts-mode--font-lock-settings)
(setq-local treesit-font-lock-feature-list
'(( comment definition)
( keyword string escape-sequence type)
( attribute constant expression literal)
( bracket delimiter)))
( keyword string type)
( constant escape-sequence expression literal property)
( bracket delimiter error)))
;; Imenu.
(setq-local treesit-simple-imenu-settings

View file

@ -1192,7 +1192,7 @@ fontified."
"Check whether NODE is a variable.
NODE's type should be \"identifier\"."
;; An identifier can be a function/class name, a property, or a
;; variables. This funtion filters out function/class names and
;; variables. This function filters out function/class names and
;; properties.
(pcase (treesit-node-type (treesit-node-parent node))
((or "function_definition" "class_definition") nil)
@ -3736,19 +3736,35 @@ the python shell:
appending extra empty lines so tracebacks are correct.
3. When the region sent is a substring of the current buffer, a
coding cookie is added.
4. Wraps indented regions under an \"if True:\" block so the
interpreter evaluates them correctly."
(let* ((start (save-excursion
;; If we're at the start of the expression, and
;; there's just blank space ahead of it, then expand
;; the region to include the start of the line.
;; This makes things work better with the rest of
;; the data we're sending over.
4. When the region consists of a single statement, leading
whitespaces will be removed. Otherwise, wraps indented
regions under an \"if True:\" block so the interpreter
evaluates them correctly."
(let* ((single-p (save-restriction
(narrow-to-region start end)
(= (progn
(goto-char start)
(python-nav-beginning-of-statement))
(progn
(goto-char end)
(python-nav-beginning-of-statement)))))
(start (save-excursion
;; If we're at the start of the expression, and if
;; the region consists of a single statement, then
;; remove leading whitespaces, else if there's just
;; blank space ahead of it, then expand the region
;; to include the start of the line. This makes
;; things work better with the rest of the data
;; we're sending over.
(goto-char start)
(if (string-blank-p
(buffer-substring (line-beginning-position) start))
(line-beginning-position)
start)))
(if single-p
(progn
(skip-chars-forward "[:space:]" end)
(point))
(if (string-blank-p
(buffer-substring (line-beginning-position) start))
(line-beginning-position)
start))))
(substring (buffer-substring-no-properties start end))
(starts-at-point-min-p (save-restriction
(widen)
@ -3772,7 +3788,7 @@ the python shell:
(python-mode)
(when fillstr
(insert fillstr))
(when (not toplevel-p)
(when (and (not single-p) (not toplevel-p))
(forward-line -1)
(insert "if True:\n")
(delete-region (point) (line-end-position)))
@ -3816,7 +3832,8 @@ code inside blocks delimited by \"if __name__== \\='__main__\\=':\".
When called interactively SEND-MAIN defaults to nil, unless it's
called with prefix argument. When optional argument MSG is
non-nil, forces display of a user-friendly message if there's no
process running; defaults to t when called interactively."
process running; defaults to t when called interactively. The
substring to be sent is retrieved using `python-shell-buffer-substring'."
(interactive
(list (region-beginning) (region-end) current-prefix-arg t))
(let* ((string (python-shell-buffer-substring start end (not send-main)

View file

@ -7063,7 +7063,7 @@ CONDITION is either:
* `major-mode': the buffer matches if the buffer's major mode
is eq to the cons-cell's cdr. Prefer using `derived-mode'
instead when both can work.
* `not': the cdr is interpreted as a negation of a condition.
* `not': the cadr is interpreted as a negation of a condition.
* `and': the cdr is a list of recursive conditions, that all have
to be met.
* `or': the cdr is a list of recursive condition, of which at

View file

@ -4093,7 +4093,7 @@ move point to the beginning of buffer. Return the new location of point."
(interactive)
(beginning-of-line)
;; `bibtex-any-valid-entry-type' would fail if users "disable"
;; an entry by chosing an invalid entry type.
;; an entry by choosing an invalid entry type.
(or (looking-at bibtex-any-entry-maybe-empty-head)
(re-search-backward bibtex-any-entry-maybe-empty-head nil 'move))
(point))

View file

@ -1177,7 +1177,6 @@ See `treesit-simple-indent-presets'.")
fns)))))
(cons 'not (lambda (fn)
(lambda (node parent bol &rest _)
(debug)
(not (funcall fn node parent bol)))))
(cons 'list (lambda (&rest fns)
(lambda (node parent bol &rest _)
@ -1649,7 +1648,7 @@ friends."
;; TODO: I'm not entirely sure how would this go, so I only documented
;; the "defun" functions and didn't document any "thing" functions.
;; We should also document `treesit-block-type-regexp' and support it
;; in major modes if we can meaningfully intergrate hideshow: I tried
;; in major modes if we can meaningfully integrate hideshow: I tried
;; and failed, we need SomeOne that understands hideshow to look at
;; it. (BTW, hideshow should use its own
;; `treesit-hideshow-block-type-regexp'.)
@ -2653,23 +2652,47 @@ window."
;;; Install & build language grammar
(defvar treesit-language-source-alist nil
"Configures how to download tree-sitter language grammars.
This should be an alist of
"Configuration for downloading and installing tree-sitter language grammars.
(LANG . (URL SOURCE-DIR GRAMMAR-DIR CC C++))
The value should be an alist where each element has the form
(LANG . (URL REVISION SOURCE-DIR CC C++))
Only LANG and URL are mandatory. LANG is the language symbol.
URL is the repository's url.
URL is the Git repository URL for the grammar.
SOURCE-DIR is the relative directory in the repository in which
the grammar.c file resides, default to \"src\".
REVISION is the Git tag or branch of the desired version,
defaulting to the latest default branch.
GRAMMAR-DIR is the relative grammar directory in the repository
in which the grammar.js file resides, default to \"\".
SOURCE-DIR is the relative subdirectory in the repository in which
the grammar's parser.c file resides, defaulting to \"src\".
CC and C++ are C and C++ compilers, default to \"cc\" and
CC and C++ are C and C++ compilers, defaulting to \"cc\" and
\"c++\", respectively.")
(defun treesit--install-language-grammar-build-recipe (lang)
"Interactively build a recipe for LANG and return it.
See `treesit-language-source-alist' for details."
(when (y-or-n-p (format "There is no recipe for %s, do you want to build it interactively?" lang))
(cl-labels ((empty-string-to-nil (string)
(if (equal string "") nil string)))
(list
lang
(read-string
"Enter the URL of the Git repository of the language grammar: ")
(empty-string-to-nil
(read-string
"Enter the tag or branch (default: default branch): "))
(empty-string-to-nil
(read-string
"Enter the subdirectory in which the parser.c file resides (default: \"src\"): "))
(empty-string-to-nil
(read-string
"Enter the C compiler to use (default: auto-detect): "))
(empty-string-to-nil
(read-string
"Enter the C++ compiler to use (default: auto-detect): "))))))
(defun treesit-install-language-grammar (lang)
"Build and install the tree-sitter language grammar library for LANG.
@ -2682,17 +2705,21 @@ executable programs, such as the C/C++ compiler and linker."
(interactive (list (intern
(completing-read
"Language: "
(mapcar #'car treesit-language-source-alist)
nil t))))
(condition-case err
(apply #'treesit--install-language-grammar-1
;; The nil is OUT-DIR.
(cons nil (assoc lang treesit-language-source-alist)))
(error
(display-warning
'treesit
(format "Error encountered when installing language grammar: %s"
err))))
(mapcar #'car treesit-language-source-alist)))))
(when-let ((recipe
(or (assoc lang treesit-language-source-alist)
(treesit--install-language-grammar-build-recipe
lang))))
(condition-case err
(apply #'treesit--install-language-grammar-1
;; The nil is OUT-DIR.
(cons nil recipe))
(error
(display-warning
'treesit
(format "Error encountered when installing language grammar: %s"
err)))))
;; Check that the installed language grammar is loadable.
(pcase-let ((`(,available . ,err)
(treesit-language-available-p lang t)))
@ -2720,22 +2747,21 @@ content as signal data, and erase buffer afterwards."
(erase-buffer)))
(defun treesit--install-language-grammar-1
(out-dir lang url &optional source-dir grammar-dir cc c++)
(out-dir lang url &optional revision source-dir cc c++)
"Install and compile a tree-sitter language grammar library.
OUT-DIR is the directory to put the compiled library file. If it
is nil, the \"tree-sitter\" directory under user's Emacs
configuration directory is used (and automatically created if not
exist).
configuration directory is used (and automatically created if it
does not exist).
For LANG, URL, SOURCE-DIR, GRAMMAR-DIR, CC, C++, see
For LANG, URL, REVISION, SOURCE-DIR, GRAMMAR-DIR, CC, C++, see
`treesit-language-source-alist'. If anything goes wrong, this
function signals an error."
(let* ((lang (symbol-name lang))
(default-directory (make-temp-file "treesit-workdir" t))
(workdir (expand-file-name "repo"))
(source-dir (expand-file-name (or source-dir "src") workdir))
(grammar-dir (expand-file-name (or grammar-dir "") workdir))
(cc (or cc (seq-find #'executable-find '("cc" "gcc" "c99"))
;; If no C compiler found, just use cc and let
;; `call-process' signal the error.
@ -2750,14 +2776,16 @@ function signals an error."
(unwind-protect
(with-temp-buffer
(message "Cloning repository")
;; git clone xxx --depth 1 --quiet workdir
(treesit--call-process-signal
"git" nil t nil "clone" url "--depth" "1" "--quiet"
workdir)
;; cp "${grammardir}"/grammar.js "${sourcedir}"
(copy-file (expand-file-name "grammar.js" grammar-dir)
(expand-file-name "grammar.js" source-dir)
t t)
;; git clone xxx --depth 1 --quiet [-b yyy] workdir
(if revision
(treesit--call-process-signal
"git" nil t nil "clone" url "--depth" "1" "--quiet"
"-b" revision workdir)
(treesit--call-process-signal
"git" nil t nil "clone" url "--depth" "1" "--quiet"
workdir))
;; We need to go into the source directory because some
;; header files use relative path (#include "../xxx").
;; cd "${sourcedir}"
(setq default-directory source-dir)
(message "Compiling library")

View file

@ -435,7 +435,7 @@ The remaining KEYS are passed directly to `cvs-create-fileinfo'."
;; Conflict
(and
(cvs-match (concat "C \\(.*" qfile "\\)$") (path 1) (type 'CONFLICT))
;; C might be followed by a "spurious" U for non-mergable files
;; C might be followed by a "spurious" U for non-mergeable files
(cvs-or (cvs-match (concat "U \\(.*" qfile "\\)$")) t))
;; Successful merge
(cvs-match (concat "M \\(.*" qfile "\\)$") (path 1))

View file

@ -3294,7 +3294,7 @@
2010-10-09 Lars Magne Ingebrigtsen <larsi@gnus.org>
* gnutls.c (syms_of_gnutls): All the bootprops are keywords.
(emacs_gnutls_write): Remove the debuggin fsync call.
(emacs_gnutls_write): Remove the debugging fsync call.
(emacs_gnutls_read): Return -1 if we got an error from
gnutls_read. This allows us to actually read lots of data from
the GnuTLS stream.

View file

@ -632,7 +632,7 @@ treesit_load_language (Lisp_Object language_symbol,
return lang;
}
DEFUN ("treesit-language-available-p", Ftreesit_langauge_available_p,
DEFUN ("treesit-language-available-p", Ftreesit_language_available_p,
Streesit_language_available_p,
1, 2, 0,
doc: /* Return non-nil if LANGUAGE exists and is loadable.
@ -679,14 +679,14 @@ is non-nil, return the oldest compatible ABI version. */)
return make_fixnum (TREE_SITTER_MIN_COMPATIBLE_LANGUAGE_VERSION);
}
DEFUN ("treesit-language-version", Ftreesit_language_abi_version,
DEFUN ("treesit-language-abi-version", Ftreesit_language_abi_version,
Streesit_language_abi_version,
0, 1, 0,
doc: /* Return the language ABI version of the tree-sitter LANGUAGE.
Return nil if LANGUAGE is not available. */)
doc: /* Return the ABI version of the tree-sitter grammar for LANGUAGE.
Return nil if a grammar library for LANGUAGE is not available. */)
(Lisp_Object language)
{
if (NILP (Ftreesit_langauge_available_p (language, Qnil)))
if (NILP (Ftreesit_language_available_p (language, Qnil)))
return Qnil;
else
{

View file

@ -21,6 +21,7 @@
(require 'ert)
(require 'shortdoc)
(require 'subr-x) ; `string-pad' in shortdoc group needed at run time
(defun shortdoc-tests--tree-contains (tree fun)
"Whether TREE contains a call to FUN."
@ -44,6 +45,14 @@
(should (shortdoc-tests--tree-contains expr fun))))
(setq props (cddr props))))))))
(ert-deftest shortdoc-all-functions-fboundp ()
"Check that all functions listed in shortdoc groups are `fboundp'."
(dolist (group shortdoc--groups)
(dolist (item group)
(when (consp item)
(let ((fun (car item)))
(should (fboundp fun)))))))
(ert-deftest shortdoc-all-groups-work ()
"Test that all defined shortdoc groups display correctly."
(dolist (group (mapcar (lambda (x) (car x)) shortdoc--groups))

View file

@ -4456,6 +4456,70 @@ def foo():
(point-max))
"# -*- coding: utf-8 -*-\n\nif True:\n # Whitespace\n\n print ('a')\n\n"))))
(ert-deftest python-shell-buffer-substring-13 ()
"Check substring from indented single statement."
(python-tests-with-temp-buffer
"
def foo():
a = 1
"
(should (string= (python-shell-buffer-substring
(python-tests-look-at "a = 1")
(pos-eol))
"# -*- coding: utf-8 -*-\n\na = 1"))))
(ert-deftest python-shell-buffer-substring-14 ()
"Check substring from indented single statement spanning multiple lines."
(python-tests-with-temp-buffer
"
def foo():
a = \"\"\"Some
string\"\"\"
"
(should (string= (python-shell-buffer-substring
(python-tests-look-at "a = \"\"\"Some")
(pos-eol 2))
"# -*- coding: utf-8 -*-\n\na = \"\"\"Some\n string\"\"\""))))
(ert-deftest python-shell-buffer-substring-15 ()
"Check substring from partial statement."
(python-tests-with-temp-buffer
"
def foo():
a = 1
"
(should (string= (python-shell-buffer-substring
(python-tests-look-at " a = 1")
(python-tests-look-at " = 1"))
"# -*- coding: utf-8 -*-\n\na"))))
(ert-deftest python-shell-buffer-substring-16 ()
"Check substring from partial statement."
(python-tests-with-temp-buffer
"
def foo():
a = 1
"
(should (string= (python-shell-buffer-substring
(python-tests-look-at "1")
(1+ (point)))
"# -*- coding: utf-8 -*-\n\n1"))))
(ert-deftest python-shell-buffer-substring-17 ()
"Check substring from multiline string."
(python-tests-with-temp-buffer
"
def foo():
s = \"\"\"
a = 1
b = 2
\"\"\"
"
(should (string= (python-shell-buffer-substring
(python-tests-look-at "a = 1")
(python-tests-look-at "\"\"\""))
"# -*- coding: utf-8 -*-\n\nif True:\n a = 1\n b = 2\n\n"))))
;;; Shell completion