Merge remote-tracking branch 'savannah/master' into HEAD

This commit is contained in:
Andrea Corallo 2020-10-17 08:00:34 +02:00
commit d5791ba5fe
78 changed files with 5235 additions and 1419 deletions

View file

@ -195,6 +195,17 @@ pt-br Rodrigo Real
ru Alex Ott
sk Miroslav Vaško
** Update some files from their upstream.
Some files in Emacs are copies of data files maintained elsewhere.
Make sure that they are reasonably up-to-date.
- etc/publicsuffix.txt
https://publicsuffix.org/list/public_suffix_list.dat
- leim/SKK-DIC/SKK-JISYO.L
https://raw.githubusercontent.com/skk-dev/dict/master/SKK-JISYO.L
* BUGS
** Check for modes which bind M-s that conflicts with a new global binding M-s

View file

@ -13,16 +13,15 @@ written substantial portions. Others too numerous to mention have
reported and fixed bugs, and added features to many parts of Emacs.
We thank them for their generosity as well.
This list is intended to mention every contributor of a major package or
feature we currently distribute; if you know of someone we have omitted,
please make a bug report. More comprehensive information is
available in the @file{ChangeLog} files, summarized in the file
@file{etc/AUTHORS} in the distribution.
This list is intended to mention every contributor of a major package
or feature; if you know of someone we have omitted, please make a bug
report. More comprehensive information is available in the
@file{ChangeLog} files, summarized in the file @file{etc/AUTHORS} in
the distribution.
@c We should list here anyone who has contributed a new package,
@c and anyone who has made major enhancements in Emacs
@c that many users would notice and consider important.
@c Remove things that are no longer distributed.
@c Note this file is only used ifnottex; otherwise a shorter version in
@c emacs.texi is used.

View file

@ -1672,21 +1672,26 @@ abbreviation of the output according to the variables
argument of @code{-1} overrides the effect of
@code{eval-expression-print-length}.
@kbd{C-x C-e} (@code{eval-last-sexp}) treats @code{defvar}
expressions specially. Normally, evaluating a @code{defvar}
expression does nothing if the variable it defines already has a
value. But this command unconditionally resets the variable to the
initial value specified by the @code{defvar}; this is convenient for
debugging Emacs Lisp programs. @code{defcustom} and @code{defface}
expressions are treated similarly. Note the other commands documented
in this section, except @code{eval-defun}, do not have this special
feature.
@kindex C-M-x @r{(Emacs Lisp mode)}
@findex eval-defun
The @code{eval-defun} command is bound to @kbd{C-M-x} in Emacs Lisp
mode. It evaluates the top-level Lisp expression containing or
following point, and prints the value in the echo area. In this
context, a top-level expression is referred to as a ``defun'', but it
need not be an actual @code{defun} (function definition). In
particular, this command treats @code{defvar} expressions specially.
Normally, evaluating a @code{defvar} expression does nothing if the
variable it defines already has a value. But this command
unconditionally resets the variable to the initial value specified by
the @code{defvar}; this is convenient for debugging Emacs Lisp
programs. @code{defcustom} and @code{defface} expressions are treated
similarly. Note that the other commands documented in this section do
not have this special feature.
need not be an actual @code{defun} (function definition).
This command handles @code{defvar}/@code{defcustom}/@code{defface}
forms the same way that @code{eval-last-sexp} does.
With a prefix argument, @kbd{C-M-x} instruments the function
definition for Edebug, the Emacs Lisp Debugger. @xref{Instrumenting,

View file

@ -1662,6 +1662,7 @@ reused.
@cindex @code{query-replace} face
@cindex @code{lazy-highlight} face, in replace
@vindex query-replace-highlight
@vindex query-replace-highlight-submatches
@vindex query-replace-lazy-highlight
@vindex query-replace-show-replacement
These commands highlight the current match using the face
@ -1674,6 +1675,10 @@ other matches using @code{lazy-highlight} just like incremental search
string for the current match in the minibuffer. If you want to keep
special sequences @samp{\&} and @samp{\@var{n}} unexpanded, customize
@code{query-replace-show-replacement} variable.
Like @code{search-highlight-submatches} highlights subexpressions in
incremental search (@pxref{Search Customizations}), the variable
@code{query-replace-highlight-submatches} defines whether to highlight
subexpressions in the regexp replacement commands.
@vindex query-replace-skip-read-only
The variable @code{query-replace-skip-read-only}, if set

View file

@ -17523,7 +17523,7 @@ Here is the definition:
;;; Line to top of window;
;;; replace three keystroke sequence C-u 0 C-l
(defun line-to-top-of-window ()
"Move the line point is on to top of window."
"Move the line that point is on to top of window."
(interactive)
(recenter 0))
@end group

View file

@ -934,6 +934,7 @@ Lisp programs.
* Dynamic Binding Tips:: Avoiding problems with dynamic binding.
* Lexical Binding:: A different type of local variable binding.
* Using Lexical Binding:: How to enable lexical binding.
* Converting to Lexical Binding:: Convert existing code to lexical binding.
@end menu
@node Dynamic Binding
@ -1242,9 +1243,10 @@ for those that are only special in the current lexical scope.
@end defun
The use of a special variable as a formal argument in a function is
discouraged. Doing so gives rise to unspecified behavior when lexical
binding mode is enabled (it may use lexical binding sometimes, and
dynamic binding other times).
not supported.
@node Converting to Lexical Binding
@subsection Converting to Lexical Binding
Converting an Emacs Lisp program to lexical binding is easy. First,
add a file-local variable setting of @code{lexical-binding} to
@ -1264,9 +1266,21 @@ variable. If a non-special variable is bound but not used within a
variable. The byte-compiler will also issue a warning if you use a
special variable as a function argument.
(To silence byte-compiler warnings about unused variables, just use
a variable name that starts with an underscore. The byte-compiler
interprets this as an indication that this is a variable known not to
A warning about a reference or an assignment to a free variable is
usually a clear sign that that variable should be marked as
dynamically scoped, so you need to add an appropriate @code{defvar}
before the first use of that variable.
A warning about an unused variable may be a good hint that the
variable was intended to be dynamically scoped (because it is actually
used, but in another function), but it may also be an indication that
the variable is simply really not used and could simply be removed.
So you need to find out which case it is, and based on that, either
add a @code{defvar} or remove the variable altogether. If removal is
not possible or not desirable (typically because it is a formal
argument and that we cannot or don't want to change all the callers),
you can also add a leading underscore to the variable's name to
indicate to the compiler that this is a variable known not to
be used.)
@node Buffer-Local Variables

View file

@ -1,5 +1,5 @@
.\" See section COPYING for conditions for redistribution.
.TH EMACSCLIENT 1 "2019-08-02" "GNU Emacs" "GNU"
.TH EMACSCLIENT 1 "2020-10-15" "GNU Emacs" "GNU"
.\" NAME should be all caps, SECTION should be 1-8, maybe w/ subsection
.\" other params are allowed: see man(7), man(1)
.SH NAME
@ -12,8 +12,6 @@ This manual page documents briefly the
.BR emacsclient
command. Full documentation is available in the GNU Info format; see
below.
This manual page was originally written for the Debian GNU/Linux
distribution, but is not specific to that system.
.PP
.B emacsclient
works in conjunction with the built-in Emacs server.
@ -110,8 +108,9 @@ The program is documented fully in
.IR "Using Emacs as a Server"
available via the Info system.
.SH AUTHOR
This manual page was written by Stephane Bortzmeyer <bortzmeyer@debian.org>,
for the Debian GNU/Linux system (but may be used by others).
This manual page was originally written by Stephane Bortzmeyer
<bortzmeyer@debian.org>, for the Debian GNU/Linux system, but is not
specific to that system.
.SH COPYING
This manual page is in the public domain.

View file

@ -69,7 +69,7 @@ INFO_COMMON = auth autotype bovine calc ccmode cl \
dbus dired-x ebrowse ede ediff edt eieio \
emacs-mime epa erc ert eshell eudc efaq eww \
flymake forms gnus emacs-gnutls htmlfontify idlwave ido info.info \
mairix-el message mh-e newsticker nxml-mode octave-mode \
mairix-el message mh-e modus-themes newsticker nxml-mode octave-mode \
org pcl-cvs pgg rcirc remember reftex sasl \
sc semantic ses sieve smtpmail speedbar srecode todo-mode tramp \
url vhdl-mode vip viper widget wisent woman

View file

@ -27,7 +27,7 @@ The same conditions apply to any derivative of the FAQ as apply to the FAQ
itself. Every copy of the FAQ must include this notice or an approved
translation, information on who is currently maintaining the FAQ and how to
contact them (including their e-mail address), and information on where the
latest version of the FAQ is archived (including FTP information).
latest version of the FAQ is archived.
The FAQ may be copied and redistributed under these conditions, except that
the FAQ may not be embedded in a larger literary work unless that work
@ -1525,13 +1525,12 @@ customize, with completion.
@cindex Syntax highlighting on a TTY
@cindex Console, colors
In Emacs 21.1 and later, colors and faces are supported in non-windowed mode,
i.e., on Unix and GNU/Linux text-only terminals and consoles, and when
invoked as @samp{emacs -nw} on X, and MS-Windows. (Colors and faces were
supported in the MS-DOS port since Emacs 19.29.) Emacs automatically
detects color support at startup and uses it if available. If you think
that your terminal supports colors, but Emacs won't use them, check the
@code{termcap} entry for your display type for color-related
Colors and faces are supported in non-windowed mode, i.e., on Unix and
GNU/Linux text-only terminals and consoles, and when invoked as
@samp{emacs -nw} on X, MS-DOS and MS-Windows. Emacs automatically
detects color support at startup and uses it if available. If you
think that your terminal supports colors, but Emacs won't use them,
check the @code{termcap} entry for your display type for color-related
capabilities.
The command @kbd{M-x list-colors-display} pops up a window which
@ -2540,12 +2539,12 @@ To disable or change the way backups are made,
@pxref{Backup Names,,, emacs, The GNU Emacs Manual}.
@cindex Backup files in a single directory
Beginning with Emacs 21.1, you can control where Emacs puts backup files
by customizing the variable @code{backup-directory-alist}. This
variable's value specifies that files whose names match specific patters
should have their backups put in certain directories. A typical use is
to add the element @code{("." . @var{dir})} to force Emacs to put
@strong{all} backup files in the directory @file{dir}.
You can control where Emacs puts backup files by customizing the
variable @code{backup-directory-alist}. This variable's value
specifies that files whose names match specific patters should have
their backups put in certain directories. A typical use is to add the
element @code{("." . @var{dir})} to force Emacs to put @strong{all}
backup files in the directory @file{dir}.
@node Disabling auto-save-mode
@section How do I disable @code{auto-save-mode}?
@ -3054,7 +3053,7 @@ if ("$term" == emacs) set term=dumb
@cindex Debugging @file{.emacs} file
An error occurred while loading either your @file{.emacs} file or the
system-wide file @file{site-lisp/default.el}. Emacs 21.1 and later pops the
system-wide file @file{site-lisp/default.el}. Emacs pops the
@file{*Messages*} buffer, and puts there some additional information
about the error, to provide some hints for debugging.
@ -3869,12 +3868,11 @@ You may be able to get a keyboard that is completely programmable, or a
terminal emulator that supports remapping of any key to any other key.
@item
With Emacs 21.1 and later, you can control the effect of the
@key{Backspace} and @key{Delete} keys, on both dumb terminals and a
windowed displays, by customizing the option
@code{normal-erase-is-backspace-mode}, or by invoking @kbd{M-x
normal-erase-is-backspace}. See the documentation of these symbols
(@pxref{Emacs Lisp documentation}) for more info.
You can control the effect of the @key{Backspace} and @key{Delete}
keys, on both dumb terminals and a windowed displays, by customizing
the option @code{normal-erase-is-backspace-mode}, or by invoking
@kbd{M-x normal-erase-is-backspace}. See the documentation of these
symbols (@pxref{Emacs Lisp documentation}) for more info.
@item
It is possible to swap the @key{Backspace} and @key{DEL} keys inside
@ -3925,9 +3923,9 @@ many modes that have local bindings of @key{DEL} that will interfere.
@end itemize
When Emacs 21 or later runs on a windowed display, it binds the
@key{Delete} key to a command which deletes the character at point, to
make Emacs more consistent with keyboard operation on these systems.
When Emacs runs on a windowed display, it binds the @key{Delete} key
to a command which deletes the character at point, to make Emacs more
consistent with keyboard operation on these systems.
For more information about troubleshooting this problem, see @ref{DEL
Does Not Delete, , If @key{DEL} Fails to Delete, emacs, The GNU Emacs

View file

@ -658,15 +658,6 @@ displayed record. You cannot delete or modify the fixed, explanatory
text that comes from string formatting elements, but you can modify the
actual field contents.
@ignore
@c This is for the Emacs 18 version only.
If the contents of the forms cannot be recognized properly, this is
signaled using a descriptive text. @xref{Error Messages}, for more info.
The cursor will indicate the last part of the forms which was
successfully parsed. It's important to avoid entering field contents
that would cause confusion with the field-separating fixed text.
@end ignore
If the variable @code{forms-modified-record-filter} is non-@code{nil},
it is called as a function before the new data is written to the data
file. The function receives one argument, a vector that contains the
@ -795,23 +786,6 @@ The first element of a list which is an element of
A list element was supplied in @code{forms-format-list} which was not a
string, number or list.
@ignore
@c This applies to Emacs 18 only.
@c Error messages generated while a modified form is being analyzed.
@item Parse error: not looking at `...'
When re-parsing the contents of a forms, the text shown could not
be found.
@item Parse error: cannot find `...'
When re-parsing the contents of a forms, the text shown, which
separates two fields, could not be found.
@item Parse error: cannot parse adjacent fields @var{xx} and @var{yy}
Fields @var{xx} and @var{yy} were not separated by text, so could not be
parsed again.
@end ignore
@item Warning: this record has @var{xx} fields instead of @var{yy}
The number of fields in this record in the data file did not match
@code{forms-number-of-fields}. Missing fields will be made empty.

View file

@ -19489,6 +19489,11 @@ Variable to control whether use the locally stored @acronym{NOV} and
articles when plugged, e.g., essentially using the Agent as a cache.
The default is non-@code{nil}, which means to use the Agent as a cache.
@item gnus-agent-eagerly-store-articles
@vindex gnus-agent-eagerly-store-articles
If non-@code{nil} (which is the default), store all articles read in
agentized groups in the Agent cache.
@item gnus-agent-go-online
@vindex gnus-agent-go-online
If @code{gnus-agent-go-online} is @code{nil}, the Agent will never

2837
doc/misc/modus-themes.texi Normal file

File diff suppressed because it is too large Load diff

View file

@ -180,6 +180,12 @@ file during parsing" and dropping out of the minibuffer. The user
would have to type 'M-: M-p' to edit and redo the expression. Now
Emacs will echo the message and allow the user to continue editing.
+++
** 'eval-last-sexp' now handles 'defvar'/'defcustom'/'defface' specially.
This command would previously not redefine values defined by these
forms, but this command has now been changed to work more like
'eval-defun', and reset the values as specified.
+++
** New command 'undo-redo'.
It undoes previous undo commands, but doesn't record itself as an
@ -428,6 +434,11 @@ tags to be considered as well.
** Gnus
+++
*** New user option 'gnus-agent-eagerly-store-articles'.
If non-nil (which is the default), the Gnus Agent will store all read
articles in the Agent cache.
+++
*** New user option 'gnus-global-groups'.
Gnus handles private groups differently from public (i.e., NNTP-like)
@ -572,9 +583,7 @@ skipped.
*** New command 'describe-keymap' describes keybindings in a keymap.
---
*** New keybinding in 'help-for-help' to display a manual.
The 'R' keybinding after 'C-h C-h' will prompt for a manual name and
then display it.
*** New keybinding 'C-h R' prompts for a manual to display and displays it.
+++
** New command 'lossage-size'.
@ -1134,6 +1143,14 @@ window after starting). This variable defaults to nil.
** Miscellaneous
---
*** New user option 'compilation-search-all-directories'.
When doing parallel builds, directories and compilation errors may
arrive in the *compilation* buffer out-of-order. If this variable is
non-nil (the default), Emacs will now search backwards in the buffer
for any directory the file with errors may be in. If nil, this won't
be done (and this restores how this previously worked).
+++
*** New user option 'next-error-message-highlight'.
In addition to a fringe arrow, 'next-error' error may now optionally
@ -1163,6 +1180,11 @@ This is controlled by the 'search-highlight-submatches' user option.
This feature is available only on terminals that have enough colors to
distinguish between sub-expression highlighting.
+++
*** Interactive regular expression replace now uses faces for sub-groups.
Like 'search-highlight-submatches', this is controlled by the new user option
'query-replace-highlight-submatches'.
---
*** New user option 'reveal-auto-hide'.
If non-nil (the default), revealed text is automatically hidden when

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -41,8 +41,7 @@
;; changes will first take effect when the archive buffer
;; is saved. You will be warned about this.
;;
;; * dos-fns.el: (Part of Emacs 19). You get automatic ^M^J <--> ^J
;; conversion.
;; * dos-fns.el: You get automatic ^M^J <--> ^J conversion.
;;
;; arc-mode.el does not work well with crypt++.el; for the archives as
;; such this could be fixed (but wouldn't be useful) by declaring such

View file

@ -493,12 +493,17 @@ butting, use the `button-describe' command."
t))))
(defun button--help-echo (button)
"Evaluate BUTTON's `help-echo' property and return its value."
(let ((help (button-get button 'help-echo)))
(if (functionp help)
(let ((obj (if (overlayp button) button (current-buffer))))
(funcall help (selected-window) obj (button-start button)))
"Evaluate BUTTON's `help-echo' property and return its value.
If the result is non-nil, pass it through `substitute-command-keys'
before returning it, as is done for `show-help-function'."
(let* ((help (button-get button 'help-echo))
(help (if (functionp help)
(funcall help
(selected-window)
(if (overlayp button) button (current-buffer))
(button-start button))
(eval help lexical-binding))))
(and help (substitute-command-keys help))))
(defun forward-button (n &optional wrap display-message no-error)
"Move to the Nth next button, or Nth previous button if N is negative.

View file

@ -3094,6 +3094,7 @@ If X is not an error form, return 1."
(defvar math-read-big-baseline)
(defvar math-read-big-h2)
(defvar math-read-big-err-msg)
(defvar math-read-big-lines)
(defun math-read-big-expr (str)
(and (> (length calc-left-label) 0)
@ -3138,11 +3139,12 @@ If X is not an error form, return 1."
(defvar math-rb-h2)
(defun math-read-big-bigp (math-read-big-lines)
(and (cdr math-read-big-lines)
(let ((matrix nil)
(defun math-read-big-bigp (read-big-lines)
(when (cdr read-big-lines)
(let ((math-read-big-lines read-big-lines)
(matrix nil)
(v 0)
(height (if (> (length (car math-read-big-lines)) 0) 1 0)))
(height (if (> (length (car read-big-lines)) 0) 1 0)))
(while (and (cdr math-read-big-lines)
(let* ((i 0)
j

View file

@ -313,6 +313,7 @@
(defvar calc-graph-blank)
(defvar calc-graph-non-blank)
(defvar calc-graph-curve-num)
(defvar math-arglist)
(defun calc-graph-plot (flag &optional printing)
(interactive "P")

View file

@ -493,6 +493,8 @@
(defvar calc-get-operator-history nil
"History for calc-get-operator.")
(defvar math-arglist)
(defun calc-get-operator (msg &optional nargs)
(setq calc-aborted-prefix nil)
(let ((inv nil) (hyp nil) (prefix nil) (forcenargs nil)

View file

@ -757,19 +757,21 @@ loaded and the keystroke automatically re-typed."
;; The variable math-trunc-prec is local to math-trunc, but used by
;; math-trunc-fancy in calc-arith.el, which is called by math-trunc.
(defvar math-trunc-prec)
;;;###autoload
(defun math-trunc (a &optional math-trunc-prec)
(cond (math-trunc-prec
(defun math-trunc (a &optional trunc-prec)
(cond (trunc-prec
(require 'calc-ext)
(math-trunc-special a math-trunc-prec))
(math-trunc-special a trunc-prec))
((Math-integerp a) a)
((Math-looks-negp a)
(math-neg (math-trunc (math-neg a))))
((eq (car a) 'float)
(math-scale-int (nth 1 a) (nth 2 a)))
(t (require 'calc-ext)
(math-trunc-fancy a))))
(let ((math-trunc-prec trunc-prec))
(math-trunc-fancy a)))))
;;;###autoload
(defalias 'calcFunc-trunc 'math-trunc)
@ -777,12 +779,13 @@ loaded and the keystroke automatically re-typed."
;; The variable math-floor-prec is local to math-floor, but used by
;; math-floor-fancy in calc-arith.el, which is called by math-floor.
(defvar math-floor-prec)
;;;###autoload
(defun math-floor (a &optional math-floor-prec) ; [Public]
(cond (math-floor-prec
(defun math-floor (a &optional floor-prec) ; [Public]
(cond (floor-prec
(require 'calc-ext)
(math-floor-special a math-floor-prec))
(math-floor-special a floor-prec))
((Math-integerp a) a)
((Math-messy-integerp a) (math-trunc a))
((Math-realp a)
@ -790,7 +793,9 @@ loaded and the keystroke automatically re-typed."
(math-add (math-trunc a) -1)
(math-trunc a)))
(t (require 'calc-ext)
(math-floor-fancy a))))
(let ((math-floor-prec floor-prec))
(math-floor-fancy a)))))
;;;###autoload
(defalias 'calcFunc-floor 'math-floor)

View file

@ -665,6 +665,8 @@
(calc-handle-whys))
(defvar calc-curve-nvars)
(defvar calc-curve-varnames)
(defvar calc-curve-coefnames)
(defun math-nlfit-fit-curve (fn grad solnexpr initparms &optional sdv)
(calc-slow-wrapper

View file

@ -419,6 +419,7 @@
;; The variable math-comp-sel-tag is local to calc-find-selected-part,
;; but is used by math-comp-sel-flat-term and math-comp-add-string-sel
;; in calccomp.el, which are called (indirectly) by calc-find-selected-part.
(defvar math-comp-sel-tag)
(defun calc-find-selected-part ()
(let* ((math-comp-sel-hpos (- (current-column) calc-selection-cache-offset))
@ -437,7 +438,8 @@
(current-indentation))
lcount (1+ lcount)))
(- lcount (math-comp-ascent
calc-selection-cache-comp) -1))))
calc-selection-cache-comp)
-1))))
(math-comp-sel-cpos (- (point) toppt calc-selection-cache-offset
spaces lcount))
(math-comp-sel-tag nil))

View file

@ -3259,16 +3259,16 @@
(let ((math-solve-simplifying t))
(math-solve-system-rec exprs math-solve-vars nil)))))
;;; The following backtracking solver works by choosing a variable
;;; and equation, and trying to solve the equation for the variable.
;;; If it succeeds it calls itself recursively with that variable and
;;; equation removed from their respective lists, and with the solution
;;; added to solns as well as being substituted into all existing
;;; equations. The algorithm terminates when any solution path
;;; manages to remove all the variables from var-list.
;; The following backtracking solver works by choosing a variable
;; and equation, and trying to solve the equation for the variable.
;; If it succeeds it calls itself recursively with that variable and
;; equation removed from their respective lists, and with the solution
;; added to solns as well as being substituted into all existing
;; equations. The algorithm terminates when any solution path
;; manages to remove all the variables from `var-list'.
;;; To support calcFunc-roots, entries in eqn-list and solns are
;;; actually lists of equations.
;; To support calcFunc-roots, entries in eqn-list and solns are
;; actually lists of equations.
;; The variables math-solve-system-res and math-solve-system-vv are
;; local to math-solve-system-rec, but are used by math-solve-system-subst.

View file

@ -34,6 +34,7 @@
;; The variable calc-sel-reselect is local to the methods below,
;; but is used by some functions in calc-sel.el which are called
;; by the functions below.
(defvar calc-sel-reselect)
(defun calc-commute-left (arg)
(interactive "p")

View file

@ -195,13 +195,13 @@ during a flush when the cache is given a new value of nil.")
(make-variable-buffer-local 'semantic-parse-tree-state)
(defmacro semantic-parse-tree-unparseable ()
"Indicate that the current buffer is unparsable.
"Indicate that the current buffer is unparseable.
It is also true that the parse tree will need either updating or
a rebuild. This state will be changed when the user edits the buffer."
'(setq semantic-parse-tree-state 'unparseable))
(defmacro semantic-parse-tree-unparseable-p ()
"Return non-nil if the current buffer has been marked unparsable."
"Return non-nil if the current buffer has been marked unparseable."
'(eq semantic-parse-tree-state 'unparseable))
(defmacro semantic-parse-tree-set-needs-update ()
@ -539,14 +539,14 @@ If the buffer cache is out of date, attempt an incremental reparse.
If the buffer has not been parsed before, or if the incremental reparse
fails, then parse the entire buffer.
If a lexical error had been previously discovered and the buffer
was marked unparsable, then do nothing, and return the cache."
was marked unparseable, then do nothing, and return the cache."
(and
;; Is this a semantic enabled buffer?
(semantic-active-p)
;; Application hooks say the buffer is safe for parsing
(run-hook-with-args-until-failure
'semantic--before-fetch-tags-hook)
;; If the buffer was previously marked unparsable,
;; If the buffer was previously marked unparseable,
;; then don't waste our time.
(not (semantic-parse-tree-unparseable-p))
;; The parse tree actually needs to be refreshed
@ -617,7 +617,7 @@ Does nothing if the current buffer doesn't need reparsing."
;; do them here, then all the bovination hooks are not run, and
;; we save lots of time.
(cond
;; If the buffer was previously marked unparsable,
;; If the buffer was previously marked unparseable,
;; then don't waste our time.
((semantic-parse-tree-unparseable-p)
nil)

View file

@ -3205,6 +3205,7 @@ face attributes (as specified by a `default' defface entry)."
:convert-widget 'custom-face-edit-convert-widget
:args (mapcar (lambda (att)
(list 'group :inline t
:format "%v"
:sibling-args (widget-get (nth 1 att) :sibling-args)
(list 'const :format "" :value (nth 0 att))
(nth 1 att)))

View file

@ -1,4 +1,4 @@
;;; backquote.el --- implement the ` Lisp construct
;;; backquote.el --- implement the ` Lisp construct -*- lexical-binding: t -*-
;; Copyright (C) 1990, 1992, 1994, 2001-2020 Free Software Foundation,
;; Inc.

View file

@ -4461,7 +4461,6 @@ reinstrument it."
(defun edebug-temp-display-freq-count ()
"Temporarily display the frequency count data for the current definition.
It is removed when you hit any char."
;; This seems not to work with Emacs 18.59. It undoes too far.
(interactive)
(let ((inhibit-read-only t))
(undo-boundary)

View file

@ -30,6 +30,7 @@
(eval-when-compile (require 'cl-lib))
(require 'ert)
(require 'subr-x) ; string-trim
;;; Test buffers.
@ -353,6 +354,45 @@ convert it to a string and pass it to COLLECTOR first."
(funcall func object)))
(funcall func object printcharfun))))
(defvar ert-resource-directory-format "%s-resources/"
"Format for `ert-resource-directory'.")
(defvar ert-resource-directory-trim-left-regexp ""
"Regexp for `string-trim' (left) used by `ert-resource-directory'.")
(defvar ert-resource-directory-trim-right-regexp "\\(-tests?\\)?\\.el"
"Regexp for `string-trim' (right) used by `ert-resource-directory'.")
;; Has to be a macro for `load-file-name'.
(defmacro ert-resource-directory ()
"Return absolute file name of the resource directory for this file.
The path to the resource directory is the \"resources\" directory
in the same directory as the test file.
If that directory doesn't exist, use the directory named like the
test file but formatted by `ert-resource-directory-format' and trimmed
using `string-trim' with arguments
`ert-resource-directory-trim-left-regexp' and
`ert-resource-directory-trim-right-regexp'. The default values mean
that if called from a test file named \"foo-tests.el\", return
the absolute file name for \"foo-resources\"."
`(let* ((testfile ,(or (bound-and-true-p byte-compile-current-file)
(and load-in-progress load-file-name)
buffer-file-name))
(default-directory (file-name-directory testfile)))
(file-truename
(if (file-accessible-directory-p "resources/")
(expand-file-name "resources/")
(expand-file-name
(format ert-resource-directory-format
(string-trim testfile
ert-resource-directory-trim-left-regexp
ert-resource-directory-trim-right-regexp)))))))
(defmacro ert-resource-file (file)
"Return file name of resource file named FILE.
A resource file is in the resource directory as per
`ert-resource-directory'."
`(expand-file-name ,file (ert-resource-directory)))
(provide 'ert-x)

View file

@ -2152,6 +2152,7 @@ Downloads and installs required packages as needed."
(unless (package--user-selected-p name)
(package--save-selected-packages
(cons name package-selected-packages)))
(package--quickstart-maybe-refresh)
pkg-desc))
;;;###autoload

View file

@ -164,8 +164,11 @@ With argument, pretty-print output into current buffer.
Ignores leading comment characters."
(interactive "P")
(if arg
(insert (pp-to-string (eval (pp-last-sexp) lexical-binding)))
(pp-eval-expression (pp-last-sexp))))
(insert (pp-to-string (eval (elisp--eval-defun-1
(macroexpand (pp-last-sexp)))
lexical-binding)))
(pp-eval-expression (elisp--eval-defun-1
(macroexpand (pp-last-sexp))))))
;;;###autoload
(defun pp-macroexpand-last-sexp (arg)

View file

@ -294,7 +294,7 @@ entirely by setting `warning-suppress-types' or
message)
;; Don't output the buttons when doing batch compilation
;; and similar.
(unless noninteractive
(unless (or noninteractive (eq type 'bytecomp))
(insert " ")
(insert-button "Disable showing"
'type 'warning-suppress-warning

View file

@ -244,6 +244,11 @@ If no one is selected, symmetric encryption will be performed. "
(or coding-system-for-write
(select-safe-coding-system (point) (point-max)))))
;; Insert contents of requested attachments, if any.
(when (and (eq major-mode 'mail-mode) mail-encode-mml)
(mml-to-mime)
(setq mail-encode-mml nil))
;; Don't let some read-only text stop us from encrypting.
(let ((inhibit-read-only t))
(with-suppressed-warnings ((interactive-only epa-encrypt-region))

View file

@ -5472,6 +5472,10 @@ submitted line to be intentional."
(time-less-p erc-accidental-paste-threshold-seconds
(time-subtract now erc-last-input-time)))
(save-restriction
;; If there's an abbrev at the end of the line, expand it.
(when (and abbrev-mode
(eolp))
(expand-abbrev))
(widen)
(if (< (point) (erc-beg-of-input-line))
(erc-error "Point is not in the input area")

View file

@ -7094,6 +7094,7 @@ If given a prefix, show the hidden text instead."
(gnus-backlog-enter-article
group article (current-buffer)))
(when (and gnus-agent
gnus-agent-eagerly-store-articles
(gnus-agent-group-covered-p group))
(gnus-agent-store-article article group)))
(setq result 'article))

View file

@ -227,6 +227,7 @@ that was fetched."
(narrow-to-region mark (point-max))
;; Put the articles into the agent, if they aren't already.
(when (and gnus-agent
gnus-agent-eagerly-store-articles
(gnus-agent-group-covered-p group))
(save-restriction
(narrow-to-region mark (point-max))

View file

@ -205,7 +205,7 @@ different input formats."
(defun gnus-convert-face-to-png (face)
"Convert FACE (which is base64-encoded) to a PNG.
The PNG is returned as a string."
(let ((face (gnus-base64-repad face)))
(let ((face (gnus-base64-repad face nil nil t)))
(mm-with-unibyte-buffer
(insert face)
(ignore-errors

View file

@ -264,7 +264,14 @@
(map-property ical-property))
args)))))
(mapc #'accumulate-args prop-map)
(apply #'make-instance event-class args))))
(apply
#'make-instance
event-class
(cl-loop for slot in (eieio-class-slots event-class)
for keyword = (intern
(format ":%s" (eieio-slot-descriptor-name slot)))
when (plist-member args keyword)
append (list keyword (plist-get args keyword)))))))
(defun gnus-icalendar-event-from-buffer (buf &optional attendee-name-or-email)
"Parse RFC5545 iCalendar in buffer BUF and return an event object.

View file

@ -1343,7 +1343,7 @@ forbidden in URL encoding."
(setq tmp (concat tmp str))
tmp))
(defun gnus-base64-repad (str &optional reject-newlines line-length)
(defun gnus-base64-repad (str &optional reject-newlines line-length no-check)
"Take a base 64-encoded string and return it padded correctly.
Existing padding is ignored.
@ -1353,7 +1353,9 @@ If LINE-LENGTH is set and the string (or any line in the string
if REJECT-NEWLINES is nil) is longer than that number, raise an
error. Common line length for input characters are 76 plus CRLF
(RFC 2045 MIME), 64 plus CRLF (RFC 1421 PEM), and 1000 including
CRLF (RFC 5321 SMTP)."
CRLF (RFC 5321 SMTP).
If NOCHECK, don't check anything, but just repad."
;; RFC 4648 specifies that:
;; - three 8-bit inputs make up a 24-bit group
;; - the 24-bit group is broken up into four 6-bit values
@ -1372,6 +1374,8 @@ CRLF (RFC 5321 SMTP)."
;; RFC 5322 section 2.2.3 consideration:
;; Because base 64-encoded strings can appear in long header fields, remove
;; folding whitespace while still observing the RFC 4648 decisions above.
(when no-check
(setq str (replace-regexp-in-string "[\n\r \t]+" "" str)));
(let ((splitstr (split-string str "[ \t]*[\r\n]+[ \t]?" t)))
(when (and reject-newlines (> (length splitstr) 1))
(error "Invalid Base64 string"))

View file

@ -2285,6 +2285,14 @@ a string, be sure to use a valid format, see RFC 2616."
(gnus-message 1 "Edit your init file to make this change permanent.")
(sit-for 2)))
(defcustom gnus-agent-eagerly-store-articles t
"If non-nil, cache articles eagerly.
When using the Gnus Agent and reading an agentized newsgroup,
automatically cache the article in the agent cache."
:type 'boolean
:version "28.1")
;;; Internal variables

View file

@ -493,6 +493,8 @@ the major mode specifies support for Font Lock."
'regexp-history-last)))
(hi-lock-read-face-name)
current-prefix-arg))
(when (stringp face)
(setq face (intern face)))
(or (facep face) (setq face 'hi-yellow))
(unless hi-lock-mode (hi-lock-mode 1))
(hi-lock-set-pattern

View file

@ -249,7 +249,8 @@ It is activated by calling `indent-rigidly' interactively.")
If called interactively with no prefix argument, activate a
transient mode in which the indentation can be adjusted interactively
by typing \\<indent-rigidly-map>\\[indent-rigidly-left], \\[indent-rigidly-right], \\[indent-rigidly-left-to-tab-stop], or \\[indent-rigidly-right-to-tab-stop].
Typing any other key deactivates the transient mode.
Typing any other key exits this mode. If `transient-mark-mode' is enabled,
exiting also deactivates the mark.
If called from a program, or interactively with prefix ARG,
indent all lines starting in the region forward by ARG columns.

View file

@ -2877,9 +2877,9 @@ The current mail message becomes the message displayed."
(rmail-display-labels)
(rmail-swap-buffers)
(setq rmail-buffer-swapped t)
(run-hooks 'rmail-show-message-hook)
(when showing-message
(setq blurb (format "Showing message %d...done" msg)))))
(setq blurb (format "Showing message %d...done" msg)))
(run-hooks 'rmail-show-message-hook)))
blurb))
(defun rmail-copy-headers (beg _end &optional ignored-headers)
@ -4147,22 +4147,12 @@ The variable `rmail-retry-ignored-headers' is a regular expression
specifying headers which should not be copied into the new message."
(interactive)
(require 'mail-utils)
;; FIXME This does not handle rmail-mime-feature != 'rmailmm.
;; There is no API defined for rmail-mime-feature to provide
;; rmail-mime-message-p, rmail-mime-toggle-raw equivalents.
;; But does anyone actually use rmail-mime-feature != 'rmailmm?
(if (and rmail-enable-mime
(eq rmail-mime-feature 'rmailmm)
(featurep rmail-mime-feature))
(with-current-buffer rmail-buffer
(if (rmail-mime-message-p)
(let ((rmail-mime-mbox-buffer rmail-view-buffer)
(rmail-mime-view-buffer rmail-buffer))
(rmail-mime-toggle-raw 'raw)))))
(let ((rmail-this-buffer (current-buffer))
(let (bounce-buffer ;; Buffer we found it in
bounce-start ;; Position of start of failed message in that buffer
bounce-end ;; Position of end of failed message in that buffer
bounce-indent ;; Number of columns we need to de-indent it.
(msgnum rmail-current-message)
bounce-start bounce-end bounce-indent resending
resending
(content-type (rmail-get-header "Content-Type")))
(save-excursion
(goto-char (point-min))
@ -4171,19 +4161,27 @@ specifying headers which should not be copied into the new message."
(string-match
";[\n\t ]*boundary=\"?\\([-0-9a-z'()+_,./:=? ]+\\)\"?"
content-type))
;; Handle a MIME multipart bounce message.
;; Handle a MIME multipart bounce message
;; by scanning the raw buffer.
(let ((codestring
(concat "\n--"
(substring content-type (match-beginning 1)
(match-end 1)))))
(match-end 1))))
(beg (rmail-msgbeg msgnum))
(end (rmail-msgend msgnum)))
(with-current-buffer rmail-view-buffer
(save-restriction
(narrow-to-region beg end)
(goto-char (point-min))
(unless (re-search-forward mail-mime-unsent-header nil t)
(error "Cannot find beginning of header in failed message"))
(unless (search-forward "\n\n" nil t)
(error "Cannot find start of Mime data in failed message"))
(setq bounce-start (point))
(setq bounce-buffer (current-buffer))
(if (search-forward codestring nil t)
(setq bounce-end (match-beginning 0))
(setq bounce-end (point-max))))
(setq bounce-end (point-max))))))
;; Non-MIME bounce.
(or (re-search-forward mail-unsent-separator nil t)
(error "Cannot parse this as a failure message"))
@ -4198,6 +4196,7 @@ specifying headers which should not be copied into the new message."
(setq bounce-indent (- (current-column)))
(goto-char (point-max))
(re-search-backward "^End of returned message$" nil t)
(setq bounce-buffer (current-buffer))
(setq bounce-end (point)))
;; One message contained a few random lines before
;; the old message header. The first line of the
@ -4214,8 +4213,10 @@ specifying headers which should not be copied into the new message."
(setq bounce-start (point))
(goto-char (point-max))
(search-backward (concat "\n\n" boundary) bounce-start t)
(setq bounce-buffer (current-buffer))
(setq bounce-end (point)))
(setq bounce-start (point)
bounce-buffer (current-buffer)
bounce-end (point-max)))
(unless (search-forward "\n\n" nil t)
(error "Cannot find end of header in failed message"))))))
@ -4224,9 +4225,9 @@ specifying headers which should not be copied into the new message."
;; Turn off the usual actions for initializing the message body
;; because we want to get only the text from the failure message.
(let (mail-signature mail-setup-hook)
(if (rmail-start-mail nil nil nil nil nil rmail-this-buffer
(if (rmail-start-mail nil nil nil nil nil rmail-buffer
(list (list 'rmail-mark-message
rmail-this-buffer
rmail-buffer
(aref rmail-msgref-vector msgnum)
rmail-retried-attr-index)))
;; Insert original text as initial text of new draft message.
@ -4235,7 +4236,7 @@ specifying headers which should not be copied into the new message."
(let ((inhibit-read-only t)
eoh)
(erase-buffer)
(insert-buffer-substring rmail-this-buffer
(insert-buffer-substring bounce-buffer
bounce-start bounce-end)
(goto-char (point-min))
(if bounce-indent

View file

@ -146,6 +146,14 @@ same domain as the main data."
:version "24.4"
:type 'boolean)
(defcustom shr-offer-extend-specpdl t
"Non-nil means offer to extend the specpdl if the HTML nests deeply.
Complicated HTML can require more nesting than the current specpdl
size permits. If this variable is t, ask the user whether to increase
the specpdl size. If nil, just give up."
:version "28.1"
:type 'boolean)
(defvar shr-content-function nil
"If bound, this should be a function that will return the content.
This is used for cid: URLs, and the function is called with the
@ -527,7 +535,8 @@ size, and full-buffer size."
(start (point)))
;; shr uses many frames per nested node.
(if (and (> shr-depth (/ max-specpdl-size 15))
(not (and (y-or-n-p "Too deeply nested to render properly; increase `max-specpdl-size'?")
(not (and shr-offer-extend-specpdl
(y-or-n-p "Too deeply nested to render properly; increase `max-specpdl-size'?")
(setq max-specpdl-size (* max-specpdl-size 2)))))
(setq shr-warning
"Not rendering the complete page because of too-deep nesting")

View file

@ -745,6 +745,18 @@ variable, and you might not notice. Therefore, `compile-command'
is considered unsafe if this variable is nil."
:type 'boolean)
(defcustom compilation-search-all-directories t
"Whether further upward directories should be used when searching a file.
When doing a parallel build, several files from different
directories can be compiled at the same time. This makes it
difficult to determine the base directory for a relative file
name in a compiler error or warning. If this variable is
non-nil, instead of just relying on the previous directory change
in the compilation buffer, all other directories further upwards
will be used as well."
:type 'boolean
:version "28.1")
;;;###autoload
(defcustom compilation-ask-about-save t
"Non-nil means \\[compile] asks which buffers to save before compiling.
@ -2916,6 +2928,28 @@ attempts to find a file whose name is produced by (format FMT FILENAME)."
(find-file-noselect name))
fmts (cdr fmts)))
(setq dirs (cdr dirs)))
;; If we haven't found it, this might be a parallel build.
;; Search the directories further up the buffer.
(when (and (null buffer)
compilation-search-all-directories)
(with-current-buffer (marker-buffer marker)
(save-excursion
(goto-char (marker-position marker))
(when-let ((prev (compilation--previous-directory (point))))
(goto-char prev))
(setq dirs (cdr (or (get-text-property
(1- (point)) 'compilation-directory)
(get-text-property
(point) 'compilation-directory))))))
(while (and dirs (null buffer))
(setq thisdir (car dirs)
fmts formats)
(while (and fmts (null buffer))
(setq name (expand-file-name (format (car fmts) filename) thisdir)
buffer (and (file-exists-p name)
(find-file-noselect name))
fmts (cdr fmts)))
(setq dirs (cdr dirs))))
(while (null buffer) ;Repeat until the user selects an existing file.
;; The file doesn't exist. Ask the user where to find it.
(save-excursion ;This save-excursion is probably not right.

View file

@ -48,6 +48,10 @@
;; DO NOT FORGET to read micro-docs (available from `Perl' menu) <<<<<<
;; or as help on variables `cperl-tips', `cperl-problems', <<<<<<
;; `cperl-praise', `cperl-speed'. <<<<<<
;;
;; Or search for "Short extra-docs" further down in this file for
;; details on how to use `cperl-mode' instead of `perl-mode' and lots
;; of other details.
;; The mode information (on C-h m) provides some customization help.
;; If you use font-lock feature of this mode, it is advisable to use

View file

@ -1190,7 +1190,8 @@ character)."
;; Setup the lexical environment if lexical-binding is enabled.
(elisp--eval-last-sexp-print-value
(eval (macroexpand-all
(eval-sexp-add-defvars (elisp--preceding-sexp)))
(eval-sexp-add-defvars
(elisp--eval-defun-1 (macroexpand (elisp--preceding-sexp)))))
lexical-binding)
(if insert-value (current-buffer) t) no-truncate char-print-limit)))
@ -1246,6 +1247,10 @@ POS specifies the starting position where EXP was found and defaults to point."
Interactively, with a non `-' prefix argument, print output into
current buffer.
This commands handles `defvar', `defcustom' and `defface' the
same way that `eval-defun' does. See the doc string of that
function for details.
Normally, this function truncates long output according to the
value of the variables `eval-expression-print-length' and
`eval-expression-print-level'. With a prefix argument of zero,

View file

@ -940,6 +940,7 @@ Arguments the same as in `compile'."
(interactive
(list
(let ((command (eval compile-command)))
(require 'compile)
(if (or compilation-read-command current-prefix-arg)
(compilation-read-command command)
command))

View file

@ -501,6 +501,52 @@ The type returned can be `comment', `string' or `paren'."
font-lock-string-face)
font-lock-comment-face))
(defun python--f-string-p (ppss)
"Return non-nil if the pos where PPSS was found is inside an f-string."
(and (nth 3 ppss)
(let ((spos (1- (nth 8 ppss))))
(and (memq (char-after spos) '(?f ?F))
(or (< (point-min) spos)
(not (memq (char-syntax (char-before spos)) '(?w ?_))))))))
(defun python--font-lock-f-strings (limit)
"Mark {...} holes as being code.
Remove the (presumably `font-lock-string-face') `face' property from
the {...} holes that appear within f-strings."
;; FIXME: This will fail to properly highlight strings appearing
;; within the {...} of an f-string.
;; We could presumably fix it by running
;; `font-lock-fontify-syntactically-region' (as is done in
;; `sm-c--cpp-fontify-syntactically', for example) after removing
;; the `face' property, but I'm not sure it's worth the effort and
;; the risks.
(let ((ppss (syntax-ppss)))
(while
(progn
(while (and (not (python--f-string-p ppss))
(re-search-forward "\\<f['\"]" limit 'move))
(setq ppss (syntax-ppss)))
(< (point) limit))
(cl-assert (python--f-string-p ppss))
(let ((send (save-excursion
(goto-char (nth 8 ppss))
(condition-case nil
(progn (let ((forward-sexp-function nil))
(forward-sexp 1))
(min limit (1- (point))))
(scan-error limit)))))
(while (re-search-forward "{" send t)
(if (eq ?\{ (char-after))
(forward-char 1) ;Just skip over {{
(let ((beg (match-beginning 0))
(end (condition-case nil
(progn (up-list 1) (min send (point)))
(scan-error send))))
(goto-char end)
(put-text-property beg end 'face nil))))
(goto-char (min limit (1+ send)))
(setq ppss (syntax-ppss))))))
(defvar python-font-lock-keywords-level-1
`((,(rx symbol-start "def" (1+ space) (group (1+ (or word ?_))))
(1 font-lock-function-name-face))
@ -567,7 +613,8 @@ This is the medium decoration level, including everything in
builtins.")
(defvar python-font-lock-keywords-maximum-decoration
`(,@python-font-lock-keywords-level-2
`((python--font-lock-f-strings)
,@python-font-lock-keywords-level-2
;; Constants
(,(rx symbol-start
(or
@ -575,7 +622,8 @@ builtins.")
;; copyright, license, credits, quit and exit are added by the site
;; module and they are not intended to be used in programs
"copyright" "credits" "exit" "license" "quit")
symbol-end) . font-lock-constant-face)
symbol-end)
. font-lock-constant-face)
;; Decorators.
(,(rx line-start (* (any " \t")) (group "@" (1+ (or word ?_))
(0+ "." (1+ (or word ?_)))))
@ -609,7 +657,8 @@ builtins.")
;; OS specific
"VMSError" "WindowsError"
)
symbol-end) . font-lock-type-face)
symbol-end)
. font-lock-type-face)
;; assignments
;; support for a = b = c = 5
(,(lambda (limit)

View file

@ -126,6 +126,18 @@ This variable affects only `query-replace-regexp'."
:type 'boolean
:group 'matching)
(defcustom query-replace-highlight-submatches t
"Whether to highlight regexp subexpressions during query replacement.
The faces used to do the highlights are named `isearch-group-1',
`isearch-group-2', etc. (By default, only these 2 are defined.)
When there are more matches than faces, then faces are reused from the
beginning, in a cyclical manner, so the `isearch-group-1' face is
isreused for the third match. If you want to use more distinctive colors,
you can define more of these faces using the same numbering scheme."
:type 'boolean
:group 'matching
:version "28.1")
(defcustom query-replace-lazy-highlight t
"Controls the lazy-highlighting during query replacements.
When non-nil, all text in the buffer matching the current match
@ -894,7 +906,8 @@ and `search-upper-case' is non-nil, the matching is case-sensitive.
Second and third arg RSTART and REND specify the region to operate on.
This command operates on (the accessible part of) all lines whose
accessible part is entirely contained in the region determined by RSTART
and REND. (A newline ending a line counts as part of that line.)
and REND. (A newline ending a line counts as part of that line.) If RSTART
is non-nil, REND also has to be given.
Interactively, in Transient Mark mode when the mark is active, operate
on all lines whose accessible part is entirely contained in the region.
@ -2403,6 +2416,7 @@ It is called with three arguments, as if it were
(funcall search-function search-string limit t)))
(defvar replace-overlay nil)
(defvar replace-submatches-overlays nil)
(defun replace-highlight (match-beg match-end range-beg range-end
search-string regexp-flag delimited-flag
@ -2413,6 +2427,25 @@ It is called with three arguments, as if it were
(setq replace-overlay (make-overlay match-beg match-end))
(overlay-put replace-overlay 'priority 1001) ;higher than lazy overlays
(overlay-put replace-overlay 'face 'query-replace)))
(when (and query-replace-highlight-submatches
regexp-flag)
(mapc 'delete-overlay replace-submatches-overlays)
(setq replace-submatches-overlays nil)
(let ((submatch-data (cddr (butlast (match-data t))))
(group 0)
ov face)
(while submatch-data
(setq group (1+ group))
(setq ov (make-overlay (pop submatch-data) (pop submatch-data))
face (intern-soft (format "isearch-group-%d" group)))
;; Recycle faces from beginning.
(unless (facep face)
(setq group 1 face 'isearch-group-1))
(overlay-put ov 'face face)
(overlay-put ov 'priority 1002)
(push ov replace-submatches-overlays))))
(if query-replace-lazy-highlight
(let ((isearch-string search-string)
(isearch-regexp regexp-flag)
@ -2433,6 +2466,9 @@ It is called with three arguments, as if it were
(defun replace-dehighlight ()
(when replace-overlay
(delete-overlay replace-overlay))
(when query-replace-highlight-submatches
(mapc 'delete-overlay replace-submatches-overlays)
(setq replace-submatches-overlays nil))
(when query-replace-lazy-highlight
(lazy-highlight-cleanup lazy-highlight-cleanup)
(setq isearch-lazy-highlight-last-string nil))

View file

@ -393,7 +393,7 @@ and TO-BUFFER is a target buffer."
(when next-error-recenter
(recenter next-error-recenter))
(funcall next-error-found-function from-buffer to-buffer)
(next-error-message-highlight)
(next-error-message-highlight from-buffer)
(run-hooks 'next-error-hook))
(defun next-error-select-buffer (buffer)
@ -478,20 +478,18 @@ buffer causes automatic display of the corresponding source code location."
(next-error-no-select 0))
(error t))))
(defun next-error-message-highlight ()
(defun next-error-message-highlight (error-buffer)
"Highlight the current error message in the next-error buffer."
(when next-error-message-highlight
(with-current-buffer next-error-last-buffer
(with-current-buffer error-buffer
(when next-error--message-highlight-overlay
(delete-overlay next-error--message-highlight-overlay))
(save-excursion
(goto-char compilation-current-error)
(let ((ol (make-overlay (line-beginning-position) (line-end-position))))
;; do not override region highlighting
(overlay-put ol 'priority -50)
(overlay-put ol 'face 'next-error-message)
(overlay-put ol 'window (get-buffer-window))
(setf next-error--message-highlight-overlay ol))))))
(setf next-error--message-highlight-overlay ol)))))
;;;

View file

@ -891,10 +891,6 @@ side-effects, and the argument LIST is not modified."
;;;; Keymap support.
;; Declare before first use of `save-match-data',
;; where it is used internally.
(defvar save-match-data-internal)
(defun kbd (keys)
"Convert KEYS to the internal Emacs key representation.
KEYS should be a string in the format returned by commands such

View file

@ -51,8 +51,6 @@
;; this, but I think the health of my hands is far more important than a
;; few pages of virtual memory.
;; This program has no hope of working in Emacs 18.
;; This package was inspired by Roland McGrath's hanoi-break.el.
;; Several people contributed feedback and ideas, including
;; Roland McGrath <roland@gnu.org>
@ -958,11 +956,7 @@ FRAC should be the inverse of the fractional value; for example, a value of
sum))
(defun type-break-time-stamp (&optional when)
(if (fboundp 'format-time-string)
(format-time-string type-break-time-stamp-format when)
;; Emacs 19.28 and prior do not have format-time-string.
;; In that case, result is not customizable. Upgrade today!
(format "[%s] " (substring (current-time-string when) 11 16))))
(format-time-string type-break-time-stamp-format when))
(defun type-break-format-time (secs)
(let ((mins (/ secs 60)))

View file

@ -83,7 +83,10 @@ When editing a diff file, the line numbers in the hunk headers
need to be kept consistent with the actual diff. This can
either be done on the fly (but this sometimes interacts poorly with the
undo mechanism) or whenever the file is written (can be slow
when editing big diffs)."
when editing big diffs).
If this variable is nil, the hunk header numbers are updated when
the file is written instead."
:type 'boolean)
(defcustom diff-advance-after-apply-hunk t

View file

@ -2058,13 +2058,13 @@ If `F.~REV~' already exists, use it instead of checking it out again."
(list
(vc-read-revision "Revision to visit (default is working revision): "
(list buffer-file-name)))))
(with-current-buffer (or (buffer-base-buffer) (current-buffer))
(set-buffer (or (buffer-base-buffer) (current-buffer)))
(vc-ensure-vc-buffer)
(let* ((file buffer-file-name)
(revision (if (string-equal rev "")
(vc-working-revision file)
rev)))
(switch-to-buffer-other-window (vc-find-revision file revision)))))
(switch-to-buffer-other-window (vc-find-revision file revision))))
(defun vc-find-revision (file revision &optional backend)
"Read REVISION of FILE into a buffer and return the buffer.

View file

@ -793,7 +793,9 @@ DEFUN ("xwidget-webkit-title",
WEBKIT_FN_INIT ();
#ifdef USE_GTK
WebKitWebView *wkwv = WEBKIT_WEB_VIEW (xw->widget_osr);
return build_string (webkit_web_view_get_title (wkwv));
const gchar *title = webkit_web_view_get_title (wkwv);
return build_string (title ? title : "");
#elif defined NS_IMPL_COCOA
return nsxwidget_webkit_title (xw);
#endif

View file

@ -24,24 +24,17 @@
;;; Code:
(require 'ert)
(require 'ert-x)
(require 'bookmark)
(require 'cl-lib)
(defvar bookmark-tests-data-dir
(file-truename
(expand-file-name "bookmark-resources/"
(file-name-directory (or load-file-name
buffer-file-name))))
"Base directory of bookmark-tests.el data files.")
(defvar bookmark-tests-bookmark-file
(expand-file-name "test.bmk" bookmark-tests-data-dir)
(defvar bookmark-tests-bookmark-file (ert-resource-file "test.bmk")
"Bookmark file used for testing.")
(defvar bookmark-tests-example-file
;; We use abbreviate-file-name here to match the behavior of
;; `bookmark-buffer-file-name'.
(abbreviate-file-name (expand-file-name "example.txt" bookmark-tests-data-dir))
(abbreviate-file-name (ert-resource-file "example.txt"))
"Example file used for testing.")
;; The values below should match `bookmark-tests-bookmark-file'. We cache
@ -83,8 +76,7 @@ the lexically-bound variable `buffer'."
,@body)
(kill-buffer buffer))))
(defvar bookmark-tests-bookmark-file-list
(expand-file-name "test-list.bmk" bookmark-tests-data-dir)
(defvar bookmark-tests-bookmark-file-list (ert-resource-file "test-list.bmk")
"Bookmark file used for testing a list of bookmarks.")
;; The values below should match `bookmark-tests-bookmark-file-list'

View file

@ -21,6 +21,12 @@
(require 'ert)
(defvar button-tests--map
(let ((map (make-sparse-keymap)))
(define-key map "x" #'ignore)
map)
"Keymap for testing command substitution.")
(ert-deftest button-at ()
"Test `button-at' behavior."
(with-temp-buffer
@ -41,11 +47,13 @@
"Test `button--help-echo' with strings."
(with-temp-buffer
;; Text property buttons.
(let ((button (insert-text-button "text" 'help-echo "text help")))
(should (equal (button--help-echo button) "text help")))
(let ((button (insert-text-button
"text" 'help-echo "text: \\<button-tests--map>\\[ignore]")))
(should (equal (button--help-echo button) "text: x")))
;; Overlay buttons.
(let ((button (insert-button "overlay" 'help-echo "overlay help")))
(should (equal (button--help-echo button) "overlay help")))))
(let ((button (insert-button "overlay" 'help-echo
"overlay: \\<button-tests--map>\\[ignore]")))
(should (equal (button--help-echo button) "overlay: x")))))
(ert-deftest button--help-echo-form ()
"Test `button--help-echo' with forms."
@ -55,16 +63,17 @@
(form `(funcall (let ((,help "lexical form"))
(lambda () ,help))))
(button (insert-text-button "text" 'help-echo form)))
(set help "dynamic form")
(should (equal (button--help-echo button) "dynamic form")))
(set help "dynamic: \\<button-tests--map>\\[ignore]")
(should (equal (button--help-echo button) "dynamic: x")))
;; Test overlay buttons with lexical scoping.
(setq lexical-binding t)
(let* ((help (make-symbol "help"))
(form `(funcall (let ((,help "lexical form"))
(form `(funcall
(let ((,help "lexical: \\<button-tests--map>\\[ignore]"))
(lambda () ,help))))
(button (insert-button "overlay" 'help-echo form)))
(set help "dynamic form")
(should (equal (button--help-echo button) "lexical form")))))
(should (equal (button--help-echo button) "lexical: x")))))
(ert-deftest button--help-echo-function ()
"Test `button--help-echo' with functions."
@ -77,9 +86,9 @@
(should (eq win owin))
(should (eq obj obuf))
(should (= pos opos))
"text function"))
"text: \\<button-tests--map>\\[ignore]"))
(button (insert-text-button "text" 'help-echo help)))
(should (equal (button--help-echo button) "text function"))
(should (equal (button--help-echo button) "text: x"))
;; Overlay buttons.
(setq help (lambda (win obj pos)
(should (eq win owin))
@ -88,9 +97,9 @@
(should (eq (overlay-buffer obj) obuf))
(should (= (overlay-start obj) opos))
(should (= pos opos))
"overlay function"))
"overlay: \\<button-tests--map>\\[ignore]"))
(setq opos (point))
(setq button (insert-button "overlay" 'help-echo help))
(should (equal (button--help-echo button) "overlay function")))))
(should (equal (button--help-echo button) "overlay: x")))))
;;; button-tests.el ends here

View file

@ -28,19 +28,10 @@
(require 'ert-x)
(require 'todo-mode)
(defvar todo-test-data-dir
(file-truename
(expand-file-name "todo-mode-resources/"
(file-name-directory (or load-file-name
buffer-file-name))))
"Base directory of todo-mode.el test data files.")
(defvar todo-test-file-1 (expand-file-name "todo-test-1.todo"
todo-test-data-dir)
(defvar todo-test-file-1 (ert-resource-file "todo-test-1.todo")
"Todo mode test file.")
(defvar todo-test-archive-1 (expand-file-name "todo-test-1.toda"
todo-test-data-dir)
(defvar todo-test-archive-1 (ert-resource-file "todo-test-1.toda")
"Todo Archive mode test file.")
(defmacro with-todo-test (&rest body)
@ -52,7 +43,7 @@
(abbreviated-home-dir nil)
(process-environment (cons (format "HOME=%s" todo-test-home)
process-environment))
(todo-directory todo-test-data-dir)
(todo-directory (ert-resource-directory))
(todo-default-todo-file (todo-short-file-name
(car (funcall todo-files-function)))))
(unwind-protect
@ -815,7 +806,7 @@ buffer from which the editing command was invoked."
"Add file FILE with category CAT to todo-files and show it.
This provides a noninteractive API for todo-add-file for use in
automatic testing."
(let ((file0 (file-truename (concat todo-test-data-dir file ".todo")))
(let ((file0 (ert-resource-file (concat file ".todo")))
todo-add-item-if-new-category) ; Don't need an item in cat.
(cl-letf (((symbol-function 'todo-read-file-name)
(lambda (_prompt) file0))

View file

@ -20,6 +20,7 @@
;;; Code:
(require 'ert)
(require 'ert-x)
(require 'wid-edit)
(require 'cus-edit)
@ -100,10 +101,7 @@
(ert-deftest custom--test-theme-variables ()
"Test variables setting with enabling / disabling a custom theme."
;; We load custom-resources/custom--test-theme.el.
(let ((custom-theme-load-path
`(,(expand-file-name
"custom-resources"
(expand-file-name "lisp" (getenv "EMACS_TEST_DIRECTORY"))))))
(let ((custom-theme-load-path `(,(ert-resource-directory))))
(load-theme 'custom--test 'no-confirm 'no-enable)
;; The variables have still their initial values.
(should (equal custom--test-user-option 'foo))

View file

@ -240,7 +240,7 @@
(let ((retval (cl--generic-method-files 'cl-generic-tests--generic)))
(should (equal (length retval) 2))
(mapc (lambda (x)
(should (equal (car x) cl-generic-tests--this-file))
(should (equal (file-truename (car x)) cl-generic-tests--this-file))
(should (equal (cadr x) 'cl-generic-tests--generic)))
retval)
(should-not (equal (nth 0 retval) (nth 1 retval)))))

View file

@ -36,17 +36,6 @@
(require 'edebug)
(require 'kmacro)
;; Use `eval-and-compile' because this is used by the macro
;; `edebug-tests-deftest'.
(eval-and-compile
(defvar edebug-tests-sample-code-file
(expand-file-name
"edebug-resources/edebug-test-code.el"
(file-name-directory (or (bound-and-true-p byte-compile-current-file)
load-file-name
buffer-file-name)))
"Name of file containing code samples for Edebug tests."))
(defvar edebug-tests-temp-file nil
"Name of temp file containing sample code stripped of stop point symbols.")
(defvar edebug-tests-stop-points nil
@ -116,7 +105,8 @@ back to the top level.")
(declare (debug (body)))
`(edebug-tests-with-default-config
(let ((edebug-tests-failure-in-post-command nil)
(edebug-tests-temp-file (make-temp-file "edebug-tests-" nil ".el")))
(edebug-tests-temp-file (make-temp-file "edebug-tests-" nil ".el"))
(find-file-suppress-same-file-warnings t))
(edebug-tests-setup-code-file edebug-tests-temp-file)
(ert-with-message-capture
edebug-tests-messages
@ -221,6 +211,7 @@ be the same as every keystroke) execute the thunk at the same
index."
(let* ((edebug-tests-thunks thunks)
(edebug-tests-kbd-macro-index 0)
(find-file-suppress-same-file-warnings t)
saved-local-map)
(with-current-buffer (find-file-noselect edebug-tests-temp-file)
(setq saved-local-map overriding-local-map)
@ -344,7 +335,7 @@ evaluate to \"symbol\", \"symbol-1\", \"symbol-2\", etc."
Write the loadable code to a buffer for TMPFILE, and set
`edebug-tests-stop-points' to a map from defined symbols to stop
point names to positions in the file."
(with-current-buffer (find-file-noselect edebug-tests-sample-code-file)
(with-current-buffer (find-file-noselect (ert-resource-file "edebug-test-code.el"))
(let ((marked-up-code (buffer-string)))
(with-temp-file tmpfile
(insert marked-up-code))))

View file

@ -39,6 +39,7 @@
(require 'package)
(require 'ert)
(require 'ert-x)
(require 'cl-lib)
(setq package-menu-async nil)
@ -102,13 +103,9 @@
(multi-file (0 1))))
"`package-desc' used for testing dependencies.")
(defvar package-test-data-dir (expand-file-name "package-resources" package-test-file-dir)
(defvar package-test-data-dir (ert-resource-directory)
"Base directory of package test files.")
(defvar package-test-fake-contents-file
(expand-file-name "archive-contents" package-test-data-dir)
"Path to a static copy of \"archive-contents\".")
(cl-defmacro with-package-test ((&optional &key file
basedir
install
@ -215,20 +212,20 @@ Must called from within a `tar-mode' buffer."
(ert-deftest package-test-desc-from-buffer ()
"Parse an elisp buffer to get a `package-desc' object."
(with-package-test (:basedir "package-resources" :file "simple-single-1.3.el")
(with-package-test (:basedir (ert-resource-directory) :file "simple-single-1.3.el")
(should (package-test--compatible-p
(package-buffer-info) simple-single-desc 'kind)))
(with-package-test (:basedir "package-resources" :file "simple-depend-1.0.el")
(with-package-test (:basedir (ert-resource-directory) :file "simple-depend-1.0.el")
(should (package-test--compatible-p
(package-buffer-info) simple-depend-desc 'kind)))
(with-package-test (:basedir "package-resources"
(with-package-test (:basedir (ert-resource-directory)
:file "multi-file-0.2.3.tar")
(tar-mode)
(should (equal (package-tar-file-info) multi-file-desc))))
(ert-deftest package-test-install-single ()
"Install a single file without using an archive."
(with-package-test (:basedir "package-resources" :file "simple-single-1.3.el")
(with-package-test (:basedir (ert-resource-directory) :file "simple-single-1.3.el")
(should (package-install-from-buffer))
(package-initialize)
(should (package-installed-p 'simple-single))
@ -271,7 +268,7 @@ Must called from within a `tar-mode' buffer."
(ert-deftest package-test-macro-compilation ()
"Install a package which includes a dependency."
(with-package-test (:basedir "package-resources")
(with-package-test (:basedir (ert-resource-directory))
(package-install-file (expand-file-name "macro-problem-package-1.0/"))
(require 'macro-problem)
;; `macro-problem-func' uses a macro from `macro-aux'.
@ -310,8 +307,7 @@ Must called from within a `tar-mode' buffer."
(ert-deftest package-test-install-prioritized ()
"Install a lower version from a higher-prioritized archive."
(with-package-test ()
(let* ((newer-version (expand-file-name "package-resources/newer-versions"
package-test-file-dir))
(let* ((newer-version (ert-resource-file "newer-versions"))
(package-archives `(("older" . ,package-test-data-dir)
("newer" . ,newer-version)))
(package-archive-priorities '(("older" . 100))))
@ -326,7 +322,7 @@ Must called from within a `tar-mode' buffer."
(ert-deftest package-test-install-multifile ()
"Check properties of the installed multi-file package."
(with-package-test (:basedir "package-resources" :install '(multi-file))
(with-package-test (:basedir (ert-resource-directory) :install '(multi-file))
(let ((autoload-file
(expand-file-name "multi-file-autoloads.el"
(expand-file-name
@ -472,8 +468,7 @@ Must called from within a `tar-mode' buffer."
(package-menu-mark-install)
(package-menu-execute)
(should (package-installed-p 'simple-single))
(let ((package-test-data-dir
(expand-file-name "package-resources/newer-versions" package-test-file-dir)))
(let ((package-test-data-dir (ert-resource-file "newer-versions")))
(setq package-archives `(("gnu" . ,package-test-data-dir)))
(revert-buffer)
@ -512,7 +507,7 @@ Must called from within a `tar-mode' buffer."
(when (re-search-forward "Server started, \\(.*\\)\n" nil t)
(setq addr (match-string 1))))
addr)))
(with-package-test (:basedir package-test-data-dir :location addr)
(with-package-test (:basedir (ert-resource-directory) :location addr)
(list-packages)
(should package--downloads-in-progress)
(should mode-line-process)
@ -532,8 +527,7 @@ Must called from within a `tar-mode' buffer."
(ert-deftest package-test-update-archives/ignore-nil-entry ()
"Ignore any packages that are nil. Test for Bug#28502."
(with-package-test ()
(let* ((with-nil-entry (expand-file-name "package-resources/with-nil-entry"
package-test-file-dir))
(let* ((with-nil-entry (ert-resource-file "with-nil-entry"))
(package-archives `(("with-nil-entry" . ,with-nil-entry))))
(package-initialize)
(package-refresh-contents)
@ -634,8 +628,7 @@ Must called from within a `tar-mode' buffer."
prog-alist)))
(delete-directory homedir t))))
(let* ((keyring (expand-file-name "key.pub" package-test-data-dir))
(package-test-data-dir
(expand-file-name "package-resources/signed" package-test-file-dir)))
(package-test-data-dir (ert-resource-file "signed")))
(with-package-test ()
(package-initialize)
(package-import-keyring keyring)
@ -696,7 +689,7 @@ Must called from within a `tar-mode' buffer."
(ert-deftest package-x-test-upload-buffer ()
"Test creating an \"archive-contents\" file"
(with-package-test (:basedir "package-resources"
(with-package-test (:basedir (ert-resource-directory)
:file "simple-single-1.3.el"
:upload-base t)
(package-upload-buffer)
@ -729,7 +722,7 @@ Must called from within a `tar-mode' buffer."
(ert-deftest package-x-test-upload-new-version ()
"Test uploading a new version of a package"
(with-package-test (:basedir "package-resources"
(with-package-test (:basedir (ert-resource-directory)
:file "simple-single-1.3.el"
:upload-base t)
(package-upload-buffer)

View file

@ -20,30 +20,23 @@
;;; Code:
(require 'ert)
(require 'ert-x)
(require 'shadow)
(eval-when-compile (require 'cl-lib))
(defconst shadow-tests-data-directory
(expand-file-name "lisp/emacs-lisp/shadow-resources"
(or (getenv "EMACS_TEST_DIRECTORY")
(expand-file-name "../../.."
(or load-file-name
buffer-file-name))))
"Directory for shadow test files.")
(ert-deftest shadow-case-insensitive ()
"Test shadowing for case insensitive filenames."
;; Override `file-name-case-insensitive-p' so we test the same thing
;; regardless of what file system we're running on.
(cl-letf (((symbol-function 'file-name-case-insensitive-p) (lambda (_f) t)))
(should (equal (list (expand-file-name "p1/foo" shadow-tests-data-directory)
(expand-file-name "p2/FOO" shadow-tests-data-directory))
(should (equal (list (ert-resource-file "p1/foo")
(ert-resource-file "p2/FOO"))
(load-path-shadows-find
(list (expand-file-name "p1/" shadow-tests-data-directory)
(expand-file-name "p2/" shadow-tests-data-directory))))))
(list (ert-resource-file "p1/")
(ert-resource-file "p2/"))))))
(cl-letf (((symbol-function 'file-name-case-insensitive-p) (lambda (_f) nil)))
(should-not (load-path-shadows-find
(list (expand-file-name "p1/" shadow-tests-data-directory)
(expand-file-name "p2/" shadow-tests-data-directory))))))
(list (ert-resource-file "p1/")
(ert-resource-file "p2/"))))))
;;; shadow-tests.el ends here.

View file

@ -31,26 +31,10 @@
;;; Code:
(require 'ert)
(require 'ert-x)
(require 'testcover)
(require 'skeleton)
;; Use `eval-and-compile' around all these definitions because they're
;; used by the macro `testcover-tests-define-tests'.
(eval-and-compile
(defvar testcover-tests-file-dir
(expand-file-name
"testcover-resources/"
(file-name-directory (or (bound-and-true-p byte-compile-current-file)
load-file-name
buffer-file-name)))
"Directory of the \"testcover-tests.el\" file."))
(eval-and-compile
(defvar testcover-tests-test-cases
(expand-file-name "testcases.el" testcover-tests-file-dir)
"File containing marked up code to instrument and check."))
;; Convert Testcover's overlays to plain text.
(eval-and-compile
@ -62,6 +46,7 @@ is working correctly on a code sample. OPTARGS are optional
arguments for `testcover-start'."
(interactive "r")
(let ((tempfile (make-temp-file "testcover-tests-" nil ".el"))
(find-file-suppress-same-file-warnings t)
(code (buffer-substring beg end))
(marked-up-code))
(unwind-protect
@ -114,7 +99,8 @@ arguments for `testcover-start'."
(eval-and-compile
(defun testcover-tests-run-test-case (marked-up-code)
"Test the operation of Testcover on the string MARKED-UP-CODE."
(let ((tempfile (make-temp-file "testcover-tests-" nil ".el")))
(let ((tempfile (make-temp-file "testcover-tests-" nil ".el"))
(find-file-suppress-same-file-warnings t))
(unwind-protect
(progn
(with-temp-file tempfile
@ -149,7 +135,7 @@ Construct and return a list of `ert-deftest' forms. See testcases.el
for documentation of the test definition format."
(let (results)
(with-temp-buffer
(insert-file-contents testcover-tests-test-cases)
(insert-file-contents (ert-resource-file "testcases.el"))
(goto-char (point-min))
(while (re-search-forward
(concat "^;; ==== \\([^ ]+?\\) ====\n"

View file

@ -133,8 +133,6 @@
(should (equal '("1" "1") (gnus-setdiff '(2 "1" 2 "1") '(2)))))
(ert-deftest gnus-base64-repad ()
(should-error (gnus-base64-repad "" nil nil nil)
:type 'wrong-number-of-arguments)
(should-error (gnus-base64-repad 1)
:type 'wrong-type-argument)

View file

@ -56,32 +56,32 @@ Return first line of the output of (describe-function-1 FUNC)."
(should (string-match regexp result))))
(ert-deftest help-fns-test-lisp-macro ()
(let ((regexp "a Lisp macro in .subr\\.el")
(let ((regexp "a Lisp macro in .+subr\\.el")
(result (help-fns-tests--describe-function 'when)))
(should (string-match regexp result))))
(ert-deftest help-fns-test-lisp-defun ()
(let ((regexp (if (boundp 'comp-ctxt)
"a native compiled Lisp function in .subr\\.el"
"a compiled Lisp function in .subr\\.el"))
"a native compiled Lisp function in .+subr\\.el"
"a compiled Lisp function in .+subr\\.el"))
(result (help-fns-tests--describe-function 'last)))
(should (string-match regexp result))))
(ert-deftest help-fns-test-lisp-defsubst ()
(let ((regexp (if (boundp 'comp-ctxt)
"a native compiled Lisp function in .subr\\.el"
"a compiled Lisp function in .subr\\.el"))
"a native compiled Lisp function in .+subr\\.el"
"a compiled Lisp function in .+subr\\.el"))
(result (help-fns-tests--describe-function 'posn-window)))
(should (string-match regexp result))))
(ert-deftest help-fns-test-alias-to-defun ()
(let ((regexp "an alias for .set-file-modes. in .subr\\.el")
(let ((regexp "an alias for .set-file-modes. in .+subr\\.el")
(result (help-fns-tests--describe-function 'chmod)))
(should (string-match regexp result))))
(ert-deftest help-fns-test-bug23887 ()
"Test for https://debbugs.gnu.org/23887 ."
(let ((regexp "an alias for .re-search-forward. in .subr\\.el")
(let ((regexp "an alias for .re-search-forward. in .+subr\\.el")
(result (help-fns-tests--describe-function 'search-forward-regexp)))
(should (string-match regexp result))))

View file

@ -24,15 +24,9 @@
;;; Code:
(require 'ert)
(require 'ert-x)
(require 'uudecode)
(defvar uudecode-tests-data-dir
(file-truename
(expand-file-name "uudecode-resources/"
(file-name-directory (or load-file-name
buffer-file-name))))
"Base directory of uudecode-tests.el test data files.")
(defun uudecode-tests-read-file (file)
"Read contents of FILE and return as string."
(with-temp-buffer
@ -40,13 +34,11 @@
(buffer-string)))
(defvar uudecode-tests-encoded-str
(uudecode-tests-read-file
(expand-file-name "uuencoded.txt" uudecode-tests-data-dir))
(uudecode-tests-read-file (ert-resource-file "uuencoded.txt"))
"Uuencoded data for bookmark-tests.el
Same as `uudecode-tests-decoded-str' but uuencoded.")
(defvar uudecode-tests-decoded-str
(uudecode-tests-read-file
(expand-file-name "uudecoded.txt" uudecode-tests-data-dir))
(uudecode-tests-read-file (ert-resource-file "uudecoded.txt"))
"Plain text data for bookmark-tests.el
Same as `uudecode-tests-encoded-str' but plain text.")

View file

@ -22,6 +22,7 @@
;;; Code:
(require 'ert)
(require 'ert-x)
(require 'dbus)
(defvar dbus-debug nil)
@ -46,13 +47,6 @@
(defconst dbus--test-interface "org.gnu.Emacs.TestDBus.Interface"
"Test interface.")
(defconst dbus--tests-dir
(file-truename
(expand-file-name "dbus-resources"
(file-name-directory (or load-file-name
buffer-file-name))))
"Directory containing introspection test data file.")
(defun dbus--test-availability (bus)
"Test availability of D-Bus BUS."
(should (dbus-list-names bus))
@ -1555,7 +1549,7 @@ Subsequent pairs of the list are tested with `dbus-set-property'."
(when (string-equal dbus--test-path (dbus-event-path-name last-input-event))
(with-temp-buffer
(insert-file-contents-literally
(expand-file-name "org.gnu.Emacs.TestDBus.xml" dbus--tests-dir))
(ert-resource-file "org.gnu.Emacs.TestDBus.xml"))
(buffer-string))))
(defsubst dbus--test-validate-interface

View file

@ -27,25 +27,55 @@
;; tests in tramp-tests.el.
(require 'ert)
(require 'ert-x)
(require 'tramp-archive)
(defvar tramp-copy-size-limit)
(defvar tramp-persistency-file-name)
(defconst tramp-archive-test-resource-directory
(let ((default-directory
(if load-in-progress
(file-name-directory load-file-name)
default-directory)))
(cond
((file-accessible-directory-p (expand-file-name "resources"))
(expand-file-name "resources"))
((file-accessible-directory-p (expand-file-name "tramp-archive-resources"))
(expand-file-name "tramp-archive-resources"))))
"The resources directory test files are located in.")
;; `ert-resource-file' was introduced in Emacs 28.1.
(unless (macrop 'ert-resource-file)
(eval-and-compile
(defvar ert-resource-directory-format "%s-resources/"
"Format for `ert-resource-directory'.")
(defvar ert-resource-directory-trim-left-regexp ""
"Regexp for `string-trim' (left) used by `ert-resource-directory'.")
(defvar ert-resource-directory-trim-right-regexp "\\(-tests?\\)?\\.el"
"Regexp for `string-trim' (right) used by `ert-resource-directory'.")
(defconst tramp-archive-test-file-archive
(defmacro ert-resource-directory ()
"Return absolute file name of the resource directory for this file.
The path to the resource directory is the \"resources\" directory
in the same directory as the test file.
If that directory doesn't exist, use the directory named like the
test file but formatted by `ert-resource-directory-format' and trimmed
using `string-trim' with arguments
`ert-resource-directory-trim-left-regexp' and
`ert-resource-directory-trim-right-regexp'. The default values mean
that if called from a test file named \"foo-tests.el\", return
the absolute file name for \"foo-resources\"."
`(let* ((testfile ,(or (bound-and-true-p byte-compile-current-file)
(and load-in-progress load-file-name)
buffer-file-name))
(default-directory (file-name-directory testfile)))
(file-truename
(expand-file-name "foo.tar.gz" tramp-archive-test-resource-directory))
(if (file-accessible-directory-p "resources/")
(expand-file-name "resources/")
(expand-file-name
(format
ert-resource-directory-format
(string-trim testfile
ert-resource-directory-trim-left-regexp
ert-resource-directory-trim-right-regexp)))))))
(defmacro ert-resource-file (file)
"Return file name of resource file named FILE.
A resource file is in the resource directory as per
`ert-resource-directory'."
`(expand-file-name ,file (ert-resource-directory)))))
(defconst tramp-archive-test-file-archive (ert-resource-file "foo.tar.gz")
"The test file archive.")
(defun tramp-archive-test-file-archive-hexlified ()
@ -59,8 +89,7 @@ Do not hexlify \"/\". This hexlified string is used in `file:///' URLs."
"The test archive.")
(defconst tramp-archive-test-directory
(file-truename
(expand-file-name "foo.iso" tramp-archive-test-resource-directory))
(file-truename (ert-resource-file "foo.iso"))
"A directory file name, which looks like an archive.")
(setq password-cache-expiry nil

View file

@ -22,25 +22,17 @@
;;; Code:
(require 'ert)
(require 'ert-x)
(require 'pcmpl-linux)
(defvar pcmpl-linux-tests-data-dir
(file-truename
(expand-file-name "pcmpl-linux-resources/"
(file-name-directory (or load-file-name
buffer-file-name))))
"Base directory of pcmpl-linux-tests.el data files.")
(ert-deftest pcmpl-linux-test-fs-types ()
(let ((pcmpl-linux-fs-modules-path-format (expand-file-name "fs"
pcmpl-linux-tests-data-dir)))
(let ((pcmpl-linux-fs-modules-path-format (ert-resource-file "fs")))
;; FIXME: Shouldn't return "." and ".."
(should (equal (pcmpl-linux-fs-types)
'("." ".." "ext4")))))
(ert-deftest pcmpl-linux-test-mounted-directories ()
(let ((pcmpl-linux-mtab-file (expand-file-name "mtab"
pcmpl-linux-tests-data-dir)))
(let ((pcmpl-linux-mtab-file (ert-resource-file "mtab")))
(should (equal (pcmpl-linux-mounted-directories)
'("/" "/dev" "/dev/pts" "/dev/shm" "/home/alice/.gvfs"
"/lib/modules/2.6.24-16-generic/volatile" "/proc" "/sys"

View file

@ -32,14 +32,7 @@
(require 'cperl-mode)
(require 'ert)
(defvar cperl-mode-tests-data-directory
(expand-file-name "lisp/progmodes/cperl-mode-resources"
(or (getenv "EMACS_TEST_DIRECTORY")
(expand-file-name "../../../"
(or load-file-name
buffer-file-name))))
"Directory containing cperl-mode test data.")
(require 'ert-x)
(defun cperl-test-ppss (text regexp)
"Return the `syntax-ppss' of the first character matched by REGEXP in TEXT."
@ -149,8 +142,7 @@ These exercise some standard blocks and also the special
treatment for Perl expressions where a closing paren isn't the
end of the statement."
(skip-unless (eq cperl-test-mode #'cperl-mode))
(let ((file (expand-file-name "cperl-indent-exp.pl"
cperl-mode-tests-data-directory)))
(let ((file (ert-resource-file "cperl-indent-exp.pl")))
(with-temp-buffer
(insert-file-contents file)
(goto-char (point-min))
@ -179,8 +171,7 @@ end of the statement."
Perl Best Practices sets some indentation values different from
the defaults, and also wants an \"else\" or \"elsif\" keyword
to align with the \"if\"."
(let ((file (expand-file-name "cperl-indent-styles.pl"
cperl-mode-tests-data-directory)))
(let ((file (ert-resource-file "cperl-indent-styles.pl")))
(with-temp-buffer
(cperl-set-style "PBP")
(insert-file-contents file)

View file

@ -23,17 +23,10 @@
;;; Code:
(require 'ert)
(require 'ert-x)
(require 'flymake)
(eval-when-compile (require 'subr-x)) ; string-trim
(defvar flymake-tests-data-directory
(expand-file-name "lisp/progmodes/flymake-resources"
(or (getenv "EMACS_TEST_DIRECTORY")
(expand-file-name "../../.."
(or load-file-name
buffer-file-name))))
"Directory containing flymake test data.")
;;
;;
@ -63,7 +56,7 @@
"Call FN after flymake setup in FILE, using `flymake-proc`.
SEVERITY-PREDICATE is used to setup
`flymake-proc-diagnostic-type-pred'"
(let* ((file (expand-file-name file flymake-tests-data-directory))
(let* ((file (ert-resource-file file))
(visiting (find-buffer-visiting file))
(buffer (or visiting (find-file-noselect file)))
(process-environment (cons "LC_ALL=C" process-environment))

View file

@ -22,14 +22,9 @@
;;; Code:
(require 'ert)
(require 'ert-x)
(require 'ruby-mode)
(defvar ruby-mode-tests-data-dir
(file-truename
(expand-file-name "ruby-mode-resources/"
(file-name-directory (or load-file-name
buffer-file-name)))))
(defmacro ruby-with-temp-buffer (contents &rest body)
(declare (indent 1) (debug t))
`(with-temp-buffer
@ -851,8 +846,7 @@ VALUES-PLIST is a list with alternating index and value elements."
(ert-deftest ruby--indent/converted-from-manual-test ()
:tags '(:expensive-test)
;; Converted from manual test.
(let ((buf (find-file-noselect (expand-file-name "ruby.rb"
ruby-mode-tests-data-dir))))
(let ((buf (find-file-noselect (ert-resource-file "ruby.rb"))))
(unwind-protect
(with-current-buffer buf
(let ((orig (buffer-string)))

View file

@ -22,29 +22,25 @@
;;; Commentary:
(require 'ert)
(require 'ert-x)
(require 'saveplace)
(defvar saveplace-tests-dir
(file-truename
(expand-file-name "saveplace-resources"
(file-name-directory (or load-file-name
buffer-file-name)))))
(ert-deftest saveplace-test-save-place-to-alist/dir ()
(save-place-mode)
(let* ((save-place-alist nil)
(save-place-loaded t)
(loc saveplace-tests-dir))
(loc (ert-resource-directory)))
(save-window-excursion
(dired loc)
(save-place-to-alist)
(should (equal save-place-alist
`((,(concat loc "/")
(dired-filename . ,(concat loc "/saveplace")))))))))
`((,loc
(dired-filename . ,(concat loc "saveplace")))))))))
(ert-deftest saveplace-test-save-place-to-alist/file ()
(save-place-mode)
(let* ((tmpfile (make-temp-file "emacs-test-saveplace-"))
(tmpfile (file-truename tmpfile))
(save-place-alist nil)
(save-place-loaded t)
(loc tmpfile)
@ -91,7 +87,7 @@
(save-place-mode)
(let ((save-place-loaded nil)
(save-place-file
(expand-file-name "saveplace" saveplace-tests-dir))
(ert-resource-file "saveplace"))
(save-place-alist nil))
(load-save-place-alist-from-file)
(should (equal save-place-alist

View file

@ -28,14 +28,9 @@
(require 'css-mode)
(require 'ert)
(require 'ert-x)
(require 'seq)
(defvar css-mode-tests-data-dir
(file-truename
(expand-file-name "css-mode-resources/"
(file-name-directory (or load-file-name
buffer-file-name)))))
(ert-deftest css-test-property-values ()
;; The `float' property has a flat value list.
(should
@ -419,8 +414,7 @@
(ert-deftest css-mode-test-indent ()
(with-current-buffer
(find-file-noselect (expand-file-name "test-indent.css"
css-mode-tests-data-dir))
(find-file-noselect (ert-resource-file "test-indent.css"))
(let ((orig (buffer-string)))
(indent-region (point-min) (point-max))
(should (equal (buffer-string) orig)))))

View file

@ -23,18 +23,11 @@
(require 'url-file)
(require 'ert)
(defconst url-file-tests-data-directory
(expand-file-name "lisp/url/url-file-resources"
(or (getenv "EMACS_TEST_DIRECTORY")
(expand-file-name "../../.."
(or load-file-name
buffer-file-name))))
"Directory for url-file test files.")
(require 'ert-x)
(ert-deftest url-file ()
"Test reading file via file:/// URL."
(let* ((file (expand-file-name "file.txt" url-file-tests-data-directory))
(let* ((file (ert-resource-file "file.txt"))
(uri-prefix (if (eq (aref file 0) ?/) "file://" "file:///")))
(should (equal
(with-current-buffer