1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-21 06:55:39 +00:00

Merge from origin/emacs-29

53481cc954 Fix description of when "\xNNN" is considered a unibyte c...
1ef8b90ae0 Simplify imenu setup for {cmake,dockerfile}-ts-modes
7338af9c98 ; * etc/PROBLEMS: Document that GnuPG 2.4.4 solves the Ea...
5483a1df99 Improve documentation of profiler commands
fb4cf0ab46 ; Fix xref under Output Overrides in Elisp manual.
aa6c24da61 Fix broken links to Freedesktop notifications spec
14d68221d2 Fix nasty cut'n'waste error in Tramp
51ca049608 Fix image-dired-tags-db-file void variable error
c450eec07f typescript-ts-mode: Skip test if tsx grammar missing
9841ced147 ; Fix typos
557ed9c046 * admin/README: Document the run-codespell script.
5701f96335 * admin/README: Fix entry on coccinelle subdirectory.
1805f4bfd6 Add script admin/run-codespell and supporting files
This commit is contained in:
Eli Zaretskii 2024-01-27 08:14:31 -05:00
commit 6176924238
18 changed files with 1774 additions and 98 deletions

View File

@ -39,6 +39,11 @@ Build Emacs in various ways.
Install emacs quickly ("incrementally").
** run-codespell
Run the codespell tool on the Emacs sources. Requires codespell to be
installed first.
** alloc-colors.c
A utility program that allocates a given number of colors on X. Can
@ -57,15 +62,16 @@ Tests for custom types and load problems.
Show files added/removed between two tar files.
Brief description of sub-directories:
* Brief description of sub-directories.
charsets scripts for generating charset map files
in ../etc/charsets
coccinelle patches to make coccinelle work with
the latest Emacs version. Since they
apply a few minor changes in Emacs internals
in multiple places, they are trivial for
copyright purposes.
coccinelle semantic patches for use with the static code
analyzer coccinelle. Since they apply a few
minor changes in Emacs internals in multiple
places, they are trivial for copyright
purposes.
codespell supporting files for the run-codespell script.
grammars wisent and bovine grammars, used to produce
files in lisp/cedet/.
notes miscellaneous notes related to administrative

27
admin/codespell/README Normal file
View File

@ -0,0 +1,27 @@
This directory contains supporting files for running codespell.
See the ./admin/run-codespell script.
codespell.dictionary
This file contains additional, Emacs-specific corrections. When
fixing typos in Emacs, consider adding them to this file.
codespell.exclude
This file contains lines that are correct and should be ignored by
codespell. Add any false positives to this file.
The lines must match lines in the Emacs source tree exactly,
including any whitespace.
codespell.ignore
This file contains any words that are correct in the context of
Emacs, or that we otherwise choose to ignore. Use your best
judgment when adding words to this file. Common typos that are
only correct in highly specific contexts should probably be in
codespell.exclude instead.
codespell.rc
This file contains the Emacs specific codespell configuration.

View File

@ -0,0 +1,17 @@
alis->alist, alias, alas, axis, alms,
boostrap-clean->bootstrap-clean
brunches->branches
defalis->defalias
defalises->defaliases
ecmacs->emacs
ehsell->eshell
emcs->emacs
finis->finish
firs->first
file-writeable-p->file-writable-p
hep->help
least-favourite->least-favorite
lien->line
liens->lines
mecas->emacs
sehell->eshell, shell,

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,41 @@
acknowledgements
afile
ake
analogue
ans
bloc
blocs
callint
clen
crossreference
crossreferences
debbugs
dedented
dependant
doas
ede
grey
gud
ifset
inout
keypair
keyserver
keyservers
lightening
mapp
master
mimicks
mitre
msdos
ot
parm
parms
reenable
reenabled
requestor
sie
spawnve
statics
stdio
texline
typdef

View File

@ -0,0 +1,4 @@
[codespell]
skip=.git/*,*.elc,*.eln,*.gpg,*.gz,*.icns,*.jpg,*.kbx,*.key,*.pbm,*.png,*.rnc,*.so,*.tiff,*.tit,*.xml,*.xpm,*.zip,*random_seed
builtin=clear,rare,en-GB_to_en-US
quiet-level=35

68
admin/run-codespell Executable file
View File

@ -0,0 +1,68 @@
#!/bin/bash
### run-codespell - run codespell on Emacs
## Copyright (C) 2023-2024 Free Software Foundation, Inc.
## Author: Stefan Kangas <stefankangas@gmail.com>
## This file is part of GNU Emacs.
## GNU Emacs is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
## GNU Emacs is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
## You should have received a copy of the GNU General Public License
## along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
### Commentary:
## Run codespell on the Emacs source tree.
##
## codespell 2.2.2 or later is recommended. Earlier versions had a
## bug where the line count was incorrect for files containing "^L"
## characters.
source "${0%/*}/emacs-shell-lib"
CODESPELL_DIR="${PD}/codespell"
CODESPELL_RC="${CODESPELL_DIR}/codespell.rc"
CODESPELL_EXCLUDE="${CODESPELL_DIR}/codespell.exclude"
CODESPELL_IGNORE="${CODESPELL_DIR}/codespell.ignore"
CODESPELL_DICTIONARY="${CODESPELL_DIR}/codespell.dictionary"
emacs_run_codespell ()
{
git ls-files |\
grep -v -E -e '^(lib|m4)/.*' |\
grep -v -E -e '^admin/(charsets|codespell|unidata)/.*' |\
grep -v -E -e '^doc/misc/texinfo.tex$' |\
grep -v -E -e '^etc/(AUTHORS|HELLO|publicsuffix.txt)$' |\
grep -v -E -e '^etc/refcards/(cs|de|fr|pl|pt|sk)-.+.tex$' |\
grep -v -E -e '^etc/tutorials/TUTORIAL\..+' |\
grep -v -E -e '^leim/(MISC|SKK)-DIC/.*' |\
grep -v -E -e '^lisp/language/ethio-util.el' |\
grep -v -E -e '^lisp/ldefs-boot.el' |\
grep -v -E -e '^lisp/leim/.*' |\
grep -v -E -e '^test/lisp/net/puny-resources/IdnaTestV2.txt' |\
grep -v -E -e '^test/manual/(etags|indent)/.*' |\
grep -v -E -e '^test/src/regex-resources/.*' |\
xargs codespell \
--config "$CODESPELL_RC" \
--exclude-file "$CODESPELL_EXCLUDE" \
--ignore-words "$CODESPELL_IGNORE" \
--disable-colors \
--write-changes \
$@
}
emacs_run_codespell
emacs_run_codespell --dictionary "$CODESPELL_DICTIONARY"
exit 0

View File

@ -1093,10 +1093,19 @@ argument (@kbd{C-u @key{RET}}) to see the whole call tree below a
function. Pressing @kbd{@key{RET}} again will collapse back to the
original state.
Press @kbd{j} or @kbd{mouse-2} to jump to the definition of a function
at point. Press @kbd{d} to view a function's documentation. You can
save a profile to a file using @kbd{C-x C-w}. You can compare two
profiles using @kbd{=}.
@findex profiler-report-find-entry
@findex profiler-report-describe-entry
@findex profiler-find-profile
@findex profiler-find-profile-other-window
@findex profiler-report-compare-profile
Press @kbd{j} (@code{profiler-report-find-entry}) or @kbd{mouse-2} to
jump to the definition of a function at point. Press @kbd{d}
(@code{profiler-report-describe-entry}) to view a function's
documentation. You can save a profile to a file using @kbd{C-x C-w}
(@code{profiler-report-write-profile}) and read a saved profile with
@w{@kbd{M-x profiler-find-profile}} or @w{@kbd{M-x
profiler-find-profile-other-window}}. You can compare two profiles
using @kbd{=} (@code{profiler-report-compare-profile}).
@c FIXME reversed calltree?

View File

@ -1180,13 +1180,14 @@ character), Emacs automatically assumes that it is multibyte.
You can also use hexadecimal escape sequences (@samp{\x@var{n}}) and
octal escape sequences (@samp{\@var{n}}) in string constants.
@strong{But beware:} If a string constant contains hexadecimal or
octal escape sequences, and these escape sequences all specify unibyte
characters (i.e., less than 256), and there are no other literal
non-@acronym{ASCII} characters or Unicode-style escape sequences in
the string, then Emacs automatically assumes that it is a unibyte
string. That is to say, it assumes that all non-@acronym{ASCII}
characters occurring in the string are 8-bit raw bytes.
@strong{But beware:} If a string constant contains octal escape
sequences or one- or two-digit hexadecimal escape sequences, and these
escape sequences all specify unibyte characters (i.e., codepoints less
than 256), and there are no other literal non-@acronym{ASCII}
characters or Unicode-style escape sequences in the string, then Emacs
automatically assumes that it is a unibyte string. That is to say, it
assumes that all non-@acronym{ASCII} characters occurring in the
string are 8-bit raw bytes.
In hexadecimal and octal escape sequences, the escaped character
code may contain a variable number of digits, so the first subsequent

View File

@ -2945,7 +2945,7 @@ interpreted as icon name.
@item :category @var{category}
The type of notification this is, a string. See the
@uref{https://developer.gnome.org/notification-spec/#categories,
@url{https://specifications.freedesktop.org/notification-spec/notification-spec-latest.html#categories,
Desktop Notifications Specification} for a list of standard
categories.

View File

@ -995,7 +995,7 @@ less natural and is less compact.
@cindex overrides, in output functions
@cindex output variables, overriding
The previous section (@pxref{Output Functions}) lists the numerous
The previous section (@pxref{Output Variables}) lists the numerous
variables that control how the Emacs Lisp printer formats data for
outputs. These are generally available for users to change, but
sometimes you want to output data in the default format, or override

View File

@ -530,11 +530,10 @@ The solution is to use gawk (GNU awk).
*** Saving a file encrypted with GnuPG via EasyPG hangs.
This is known to happen with GnuPG v2.4.1. The only known workaround
is to downgrade to a version of GnuPG older than 2.4.1 (or, in the
future, upgrade to a newer version which solves the problem, when such
a fixed version becomes available). Note that GnuPG v2.2.42 and later
also has this problem, so you should also avoid those later 2.2.4x
versions; v2.2.41 is reported to work fine.
is to downgrade to a version of GnuPG older than 2.4.1, or upgrade to
version 2.4.4 and newer, which reportedly solves the problem. Note
that GnuPG v2.2.42 and later also has this problem, so you should also
avoid those later 2.2.4x versions; v2.2.41 is reported to work fine.
*** EasyPG loopback pinentry does not work with gpgsm.

View File

@ -51,6 +51,7 @@ Return the value of last form in BODY."
"Check if `image-dired-tags-db-file' exists.
If not, try to create it (including any parent directories).
Signal error if there are problems creating it."
(require 'image-dired) ; for `image-dired-dir'
(or (file-exists-p image-dired-tags-db-file)
(let (dir buf)
(unless (file-directory-p (setq dir (file-name-directory

View File

@ -3191,7 +3191,7 @@ Host is always \"localhost\"."
(when (zerop (tramp-call-process nil "getent" nil t nil "passwd"))
(goto-char (point-min))
(cl-loop while (not (eobp)) collect
(tramp-parse-etc-group-group))))
(tramp-parse-passwd-group))))
(tramp-parse-file filename #'tramp-parse-passwd-group))))
(defun tramp-parse-passwd-group ()

View File

@ -23,7 +23,7 @@
;;; Commentary:
;; This package provides an implementation of the Desktop Notifications
;; <https://developer.gnome.org/notification-spec/>.
;; <https://specifications.freedesktop.org/notification-spec/latest/>.
;; In order to activate this package, you must add the following code
;; into your .emacs:

View File

@ -32,10 +32,8 @@
(declare-function treesit-parser-create "treesit.c")
(declare-function treesit-query-capture "treesit.c")
(declare-function treesit-induce-sparse-tree "treesit.c")
(declare-function treesit-node-child "treesit.c")
(declare-function treesit-node-start "treesit.c")
(declare-function treesit-node-type "treesit.c")
(declare-function treesit-search-subtree "treesit.c")
(defcustom cmake-ts-mode-indent-offset 2
"Number of spaces for each indentation step in `cmake-ts-mode'."
@ -195,37 +193,14 @@ Check if a node type is available, then return the right font lock rules."
'((ERROR) @font-lock-warning-face))
"Tree-sitter font-lock settings for `cmake-ts-mode'.")
(defun cmake-ts-mode--imenu ()
"Return Imenu alist for the current buffer."
(let* ((node (treesit-buffer-root-node))
(func-tree (treesit-induce-sparse-tree
node "function_def" nil 1000))
(func-index (cmake-ts-mode--imenu-1 func-tree)))
(append
(when func-index `(("Function" . ,func-index))))))
(defun cmake-ts-mode--imenu-1 (node)
"Helper for `cmake-ts-mode--imenu'.
Find string representation for NODE and set marker, then recurse
the subtrees."
(let* ((ts-node (car node))
(children (cdr node))
(subtrees (mapcan #'cmake-ts-mode--imenu-1
children))
(name (when ts-node
(pcase (treesit-node-type ts-node)
("function_def"
(treesit-node-text
(treesit-node-child (treesit-node-child ts-node 0) 2) t)))))
(marker (when ts-node
(set-marker (make-marker)
(treesit-node-start ts-node)))))
(cond
((or (null ts-node) (null name)) subtrees)
(subtrees
`((,name ,(cons name marker) ,@subtrees)))
(t
`((,name . ,marker))))))
(defun cmake-ts-mode--function-name (node)
"Return the function name of NODE.
Return nil if there is no name or if NODE is not a function node."
(pcase (treesit-node-type node)
("function_command"
(treesit-node-text
(treesit-search-subtree node "^argument$" nil nil 2)
t))))
;;;###autoload
(define-derived-mode cmake-ts-mode prog-mode "CMake"
@ -242,7 +217,8 @@ the subtrees."
(setq-local comment-start-skip (rx "#" (* (syntax whitespace))))
;; Imenu.
(setq-local imenu-create-index-function #'cmake-ts-mode--imenu)
(setq-local treesit-simple-imenu-settings
`(("Function" "\\`function_command\\'" nil cmake-ts-mode--function-name)))
(setq-local which-func-functions nil)
;; Indent.

View File

@ -31,10 +31,8 @@
(eval-when-compile (require 'rx))
(declare-function treesit-parser-create "treesit.c")
(declare-function treesit-induce-sparse-tree "treesit.c")
(declare-function treesit-node-child "treesit.c")
(declare-function treesit-node-child-by-field-name "treesit.c")
(declare-function treesit-node-start "treesit.c")
(declare-function treesit-node-type "treesit.c")
(defvar dockerfile-ts-mode--syntax-table
@ -118,38 +116,15 @@ continuation to the previous entry."
'((ERROR) @font-lock-warning-face))
"Tree-sitter font-lock settings.")
(defun dockerfile-ts-mode--imenu ()
"Return Imenu alist for the current buffer."
(let* ((node (treesit-buffer-root-node))
(stage-tree (treesit-induce-sparse-tree
node "from_instruction"
nil 1000))
(stage-index (dockerfile-ts-mode--imenu-1 stage-tree)))
(when stage-index `(("Stage" . ,stage-index)))))
(defun dockerfile-ts-mode--imenu-1 (node)
"Helper for `dockerfile-ts-mode--imenu'.
Find string representation for NODE and set marker, then recurse
the subtrees."
(let* ((ts-node (car node))
(children (cdr node))
(subtrees (mapcan #'dockerfile-ts-mode--imenu-1
children))
(name (when ts-node
(pcase (treesit-node-type ts-node)
("from_instruction"
(treesit-node-text
(or (treesit-node-child-by-field-name ts-node "as")
(treesit-node-child ts-node 1)) t)))))
(marker (when ts-node
(set-marker (make-marker)
(treesit-node-start ts-node)))))
(cond
((or (null ts-node) (null name)) subtrees)
(subtrees
`((,name ,(cons name marker) ,@subtrees)))
(t
`((,name . ,marker))))))
(defun dockerfile-ts-mode--stage-name (node)
"Return the stage name of NODE.
Return nil if there is no name or if NODE is not a stage node."
(pcase (treesit-node-type node)
("from_instruction"
(treesit-node-text
(or (treesit-node-child-by-field-name node "as")
(treesit-node-child node 1))
t))))
;;;###autoload
(define-derived-mode dockerfile-ts-mode prog-mode "Dockerfile"
@ -166,8 +141,8 @@ the subtrees."
(setq-local comment-start-skip (rx "#" (* (syntax whitespace))))
;; Imenu.
(setq-local imenu-create-index-function
#'dockerfile-ts-mode--imenu)
(setq-local treesit-simple-imenu-settings
`(("Stage" "\\`from_instruction\\'" nil dockerfile-ts-mode--stage-name)))
(setq-local which-func-functions nil)
;; Indent.

View File

@ -24,7 +24,8 @@
(require 'treesit)
(ert-deftest typescript-ts-mode-test-indentation ()
(skip-unless (treesit-ready-p 'typescript))
(skip-unless (and (treesit-ready-p 'typescript)
(treesit-ready-p 'tsx)))
(ert-test-erts-file (ert-resource-file "indent.erts")))
(provide 'typescript-ts-mode-tests)