From c53135b6b64a32ccde324140437377e24dd32bf8 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 7 Jul 2016 19:15:03 +0300 Subject: [PATCH 01/19] Clarify documentation of 'mouse-on-link-p' * lisp/mouse.el (mouse-on-link-p): Clarify the form of the POS argument. (Bug#23899) --- lisp/mouse.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lisp/mouse.el b/lisp/mouse.el index 64ee796a681..27f2acbc76a 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -718,8 +718,9 @@ its value is returned." (defun mouse-on-link-p (pos) "Return non-nil if POS is on a link in the current buffer. -POS must be a buffer position in the current buffer or a mouse -event location in the selected window (see `event-start'). +POS must specify a buffer position in the current buffer, as a list +of the form returned by the `event-start' and `event-end' functions, +or a mouse event location in the selected window (see `event-start'). However, if `mouse-1-click-in-non-selected-windows' is non-nil, POS may be a mouse event location in any window. From 03bcf116fbed55fd36015441e8f6f86c7d1adef6 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 8 Jul 2016 13:05:01 +0300 Subject: [PATCH 02/19] Un-confuse doc string of 'string-collate-equalp' * src/fns.c (Fstring_collate_equalp): Remove confusing text from doc string. (Bug#23902) --- src/fns.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/fns.c b/src/fns.c index 1f1619300de..d5a1f74d0d8 100644 --- a/src/fns.c +++ b/src/fns.c @@ -403,8 +403,7 @@ the codeset part of the locale cannot be \"UTF-8\" on MS-Windows. If your system does not support a locale environment, this function behaves like `string-equal'. -Do NOT use this function to compare file names for equality, only -for sorting them. */) +Do NOT use this function to compare file names for equality. */) (Lisp_Object s1, Lisp_Object s2, Lisp_Object locale, Lisp_Object ignore_case) { #if defined __STDC_ISO_10646__ || defined WINDOWSNT From d6aa4da832712a720f9a85e850af1206c6f070bc Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 9 Jul 2016 14:17:12 +0300 Subject: [PATCH 03/19] Clarify doc string of 'save-buffer' * lisp/files.el (save-buffer): Clarify that backups might not be made even if this command is invoked with 2 or 3 "C-u"s. (Bug#3702) --- lisp/files.el | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lisp/files.el b/lisp/files.el index 1f97fa5f52f..fa630731b8d 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -4637,14 +4637,20 @@ By default, makes the previous version into a backup file Prefixed with one \\[universal-argument], marks this version to become a backup when the next save is done. Prefixed with two \\[universal-argument]'s, - unconditionally makes the previous version into a backup file. + makes the previous version into a backup file. Prefixed with three \\[universal-argument]'s, marks this version to become a backup when the next save is done, - and unconditionally makes the previous version into a backup file. + and makes the previous version into a backup file. With a numeric prefix argument of 0, never make the previous version into a backup file. +Note that the various variables that control backups, such +as `version-control', `backup-enable-predicate', `vc-make-backup-files', +and `backup-inhibited', to name just the more popular ones, still +control whether a backup will actually be produced, even when you +invoke this command prefixed with two or three \\[universal-argument]'s. + If a file's name is FOO, the names of its numbered backup versions are FOO.~i~ for various integers i. A non-numbered backup file is called FOO~. Numeric backups (rather than FOO~) will be made if value of From aac62a67dde02f086ae495edbc12a5046143812a Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Fri, 1 Jul 2016 23:53:26 -0400 Subject: [PATCH 04/19] Add details to cl-lib defining macros' docstrings * lisp/emacs-lisp/cl-macs.el (cl-defun, cl-defmacro): Add terse summary of supported arglist forms (Bug #22462). --- lisp/emacs-lisp/cl-macs.el | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index 2cb821edcd3..c51ed9d8770 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el @@ -327,6 +327,20 @@ FORM is of the form (ARGS . BODY)." Like normal `defun', except ARGLIST allows full Common Lisp conventions, and BODY is implicitly surrounded by (cl-block NAME ...). +The full form of a Common Lisp function argument list is + + (VAR... + [&optional (VAR [INITFORM [SVAR]])...] + [&rest|&body VAR] + [&key (([KEYWORD] VAR) [INITFORM [SVAR]])... [&allow-other-keys]] + [&aux (VAR [INITFORM])...]) + +VAR maybe be replaced recursively with an argument list for +destructing, `&whole' is supported within these sublists. If +SVAR, INITFORM, and KEYWORD are all omitted, then `(VAR)' may be +written simply `VAR'. See the Info node `(cl)Argument Lists' for +more details. + \(fn NAME ARGLIST [DOCSTRING] BODY...)" (declare (debug ;; Same as defun but use cl-lambda-list. @@ -406,6 +420,21 @@ and BODY is implicitly surrounded by (cl-block NAME ...). Like normal `defmacro', except ARGLIST allows full Common Lisp conventions, and BODY is implicitly surrounded by (cl-block NAME ...). +The full form of a Common Lisp macro argument list is + + (VAR... + [&optional (VAR [INITFORM [SVAR]])...] + [&rest|&body VAR] + [&key (([KEYWORD] VAR) [INITFORM [SVAR]])... [&allow-other-keys]] + [&aux (VAR [INITFORM])...] + [&environment VAR]) + +VAR maybe be replaced recursively with an argument list for +destructing, `&whole' is supported within these sublists. If +SVAR, INITFORM, and KEYWORD are all omitted, then `(VAR)' may be +written simply `VAR'. See the Info node `(cl)Argument Lists' for +more details. + \(fn NAME ARGLIST [DOCSTRING] BODY...)" (declare (debug (&define name cl-macro-list cl-declarations-or-string def-body)) From 1b2d6a6f685d929b9a955ae9b42229ed830de58b Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Sat, 2 Jul 2016 17:17:55 -0400 Subject: [PATCH 05/19] Clarify docstring of find-feature-regexp * lisp/emacs-lisp/find-func.el (find-feature-regexp): Explain that `%s' is optional (Bug #23520). --- lisp/emacs-lisp/find-func.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el index d2e10eab7dc..43bcb420c36 100644 --- a/lisp/emacs-lisp/find-func.el +++ b/lisp/emacs-lisp/find-func.el @@ -103,7 +103,7 @@ Please send improvements and fixes to the maintainer." (defcustom find-feature-regexp (concat ";;; Code:") "The regexp used by `xref-find-definitions' when searching for a feature definition. -Note it must contain a `%s' at the place where `format' +Note it may contain up to one `%s' at the place where `format' should insert the feature name." ;; We search for ";;; Code" rather than (feature '%s) because the ;; former is near the start of the code, and the latter is very From 4069b716ad3422f2d7f595699220c39297427387 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sun, 10 Jul 2016 17:34:34 +0300 Subject: [PATCH 06/19] Update ELisp manual to match 'string-collate-equalp' doc string * doc/lispref/strings.texi (Text Comparison): Remove reference to sorting from the description of 'string-collate-equalp'. (Bug#23902) --- doc/lispref/strings.texi | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/lispref/strings.texi b/doc/lispref/strings.texi index ca700a29a95..febe3212ba9 100644 --- a/doc/lispref/strings.texi +++ b/doc/lispref/strings.texi @@ -503,8 +503,9 @@ the codeset part of the locale cannot be @code{"UTF-8"} on MS-Windows. If your system does not support a locale environment, this function behaves like @code{string-equal}. -Do @emph{not} use this function to compare file names for equality, only -for sorting them. +Do @emph{not} use this function to compare file names for equality, as +filesystems generally don't honor linguistic equivalence of strings +that collation implements. @end defun @defun string-prefix-p string1 string2 &optional ignore-case From 686b520ff9ae25f9fa293a92e65b9331e192d142 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Sun, 10 Jul 2016 20:18:44 +0200 Subject: [PATCH 07/19] Fix memory leak in imagemagick-types * src/image.c (Fimagemagick_types): Use AcquireExceptionInfo to avoid memory leak. --- src/image.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/image.c b/src/image.c index b07c1815eac..a85d5149e7e 100644 --- a/src/image.c +++ b/src/image.c @@ -8885,13 +8885,13 @@ and `imagemagick-types-inhibit'. */) { Lisp_Object typelist = Qnil; size_t numf = 0; - ExceptionInfo ex; + ExceptionInfo *ex; char **imtypes; size_t i; - GetExceptionInfo(&ex); - imtypes = GetMagickList ("*", &numf, &ex); - DestroyExceptionInfo(&ex); + ex = AcquireExceptionInfo (); + imtypes = GetMagickList ("*", &numf, ex); + DestroyExceptionInfo (ex); for (i = 0; i < numf; i++) { From 658daf93e295dd00048d15001335f58f91e679f6 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sun, 10 Jul 2016 22:06:57 +0300 Subject: [PATCH 08/19] Fix 'vertical-motion' in non-interactive sessions * src/indent.c (Fvertical_motion): Don't return uninitialized value in non-interactive session. This fixes random errors in batch mode, see http://lists.gnu.org/archive/html/emacs-devel/2016-06/msg00609.html and http://lists.gnu.org/archive/html/emacs-devel/2016-07/msg00500.html for the details. --- src/indent.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/indent.c b/src/indent.c index 0ef8903501d..578dac83df5 100644 --- a/src/indent.c +++ b/src/indent.c @@ -2027,6 +2027,7 @@ whether or not it is currently displayed in some window. */) struct position pos; pos = *vmotion (PT, PT_BYTE, XINT (lines), w); SET_PT_BOTH (pos.bufpos, pos.bytepos); + it.vpos = pos.vpos; } else { From f6246717d18cdeab170d0339d9d8bb843d61ee02 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Tue, 12 Jul 2016 09:30:55 +0300 Subject: [PATCH 09/19] Add "New in Emacs 25" section to the FAQ * doc/misc/efaq.texi (Latest version of Emacs): Update for later versions. (New in Emacs 25): New node. (Status of Emacs): Add it to the menu. --- doc/misc/efaq.texi | 105 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 103 insertions(+), 2 deletions(-) diff --git a/doc/misc/efaq.texi b/doc/misc/efaq.texi index 8eee9e1d869..b72b2d7c2c6 100644 --- a/doc/misc/efaq.texi +++ b/doc/misc/efaq.texi @@ -931,6 +931,7 @@ status of its latest version. @menu * Origin of the term Emacs:: * Latest version of Emacs:: +* New in Emacs 25:: * New in Emacs 24:: * New in Emacs 23:: * New in Emacs 22:: @@ -977,9 +978,9 @@ conventions}). @cindex Bazaar repository, Emacs Emacs @value{EMACSVER} is the current version as of this writing. A version -number with two components (e.g., @samp{22.1}) indicates a released +number with two components (e.g., @samp{24.5}) indicates a released version; three components indicate a development -version (e.g., @samp{23.0.50} is what will eventually become @samp{23.1}). +version (e.g., @samp{26.0.50} is what will eventually become @samp{26.1}). Emacs is under active development, hosted at @uref{http://savannah.gnu.org/projects/emacs/, Savannah}. @@ -998,6 +999,106 @@ Emacs, type @kbd{C-h C-n} (@kbd{M-x view-emacs-news}). As of Emacs 22, you can give this command a prefix argument to read about which features were new in older versions. +@node New in Emacs 25 +@section What is different about Emacs 25? +@cindex Differences between Emacs 24 and Emacs 25 +@cindex Emacs 25, new features in + +@itemize +@cindex xwidgets +@item +Emacs can now embed native widgets inside Emacs buffers, if you have +gtk3 and webkitgtk3 installed. E.g., to access the embedded webkit +browser widget, type @kbd{M-x xwidget-webkit-browse-url}. + +@cindex loadable modules +@item +Emacs can now dynamically load external modules compiled as shared +libraries. + +@cindex Unicode characters, typing easily +@item +@kbd{C-x 8} has new shorthands for several popular characters, type +@kbd{C-x 8 C-h} to list shorthands. + +@cindex automatic display of Lisp APIs +@item +A new minor mode @code{global-eldoc-mode} is enabled by default, and +shows in the echo area or in the mode line the argument list of the +Emacs Lisp form at point. + +@cindex pasting text on text terminals +@cindex bracketed paste mode +@item +On text terminals that support the ``bracketed paste mode'' EMacs now +uses that mode by default. This mode allows Emacs to distinguish +between pasted text and text typed by the user. + +@cindex Unicode 9.0.0 +@item +Emacs 25 comes with data files imported from the latest Unicode +Standard version 9.0.0. + +@cindex bidirectional editing +@item +The support for bidirectional editing was updated to include all the +features mandated by the latest Unicode Standard version 9.0.0. + +@cindex character folding in searches +@item +Search command can now perform character folding in matches. This is +analogous to case folding, but instead of disregarding case variants, +it disregards wider classes of distinctions between similar +characters, such as matching different variants of double quote +characters, ignoring diacriticals, etc. + +@cindex eww +@item +The Emacs Web Browser EWW was extended to render text using +variable-pitch fonts, and got other new features. + +@cindex rmail, and HTML mails +@item +Rmail can now render HTML mail messages, if Emacs is built with +libxml2 or if you have the Lynx browser installed. + +@cindex support for push commands in VC +@item +VC now has basic support for @code{push} commands, implemented for +Bzr, Git, and Hg. + +@cindex hide-ifdef, C/C@t{++} expressions in macros +@item +Hide-IfDef mode now support full C/C@t{++} expressions in macros, +macro argument expansion, interactive macro evaluation and automatic +scanning of @code{#define}d symbols. + +@cindex xref +@item +New package Xref replaces Etags's front-end and UI. Xref provides a +generic framework and new commands to find and move to definitions of +functions, macros, data structures etc., as well as go back to the +location where you were before moving to a definition. It supersedes +and obsoletes many Etags commands, while still using the etags.el code +that reads the TAGS tables as one of its back-ends. As result, the +popular key bindings @kbd{M-.} and @kbd{M-,} have been changed to +invoke Xref commands. + +@cindex project +@item +The new package Project provides generic infrastructure for dealing +with projects. + +@cindex horizontal scroll bars +@item +Emacs can now draw horizontal scroll bars on some platforms that +provide toolkit scroll bars, namely Gtk+, Lucid, Motif and Windows. + +@end itemize + +Consult the Emacs @file{NEWS} file (@kbd{C-h n}) for the full list of +changes in Emacs 25. + @node New in Emacs 24 @section What is different about Emacs 24? @cindex Differences between Emacs 23 and Emacs 24 From 0a0144a2e15a00b5c3272ad95e62d1d489b453c4 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Tue, 12 Jul 2016 20:02:10 +0200 Subject: [PATCH 10/19] Delete environment variables in Tramp when needed * lisp/net/tramp-sh.el (tramp-get-env-with-u-option): New defun. (tramp-sh-handle-start-file-process) (tramp-sh-handle-process-file, ): Use it. (Bug#23952) --- lisp/net/tramp-sh.el | 48 +++++++++++++++++++++++++++++++------------- 1 file changed, 34 insertions(+), 14 deletions(-) diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 79449fcc937..85712cc9d8a 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -3027,18 +3027,23 @@ the result will be a local, non-Tramp, file name." tramp-initial-end-of-output)) ;; We use as environment the difference to toplevel ;; `process-environment'. - env - (env - (dolist - (elt - (cons prompt (nreverse (copy-sequence process-environment))) - env) - (or (member elt (default-toplevel-value 'process-environment)) - (setq env (cons elt env))))) + env uenv + (env (dolist (elt (cons prompt process-environment) env) + (or (member elt (default-toplevel-value 'process-environment)) + (if (string-match "=" elt) + (setq env (append env `(,elt))) + (if (tramp-get-env-with-u-option v) + (setq env (append `("-u" ,elt) env)) + (setq uenv (cons elt uenv))))))) (command (when (stringp program) - (format "cd %s && exec %s env %s %s" + (format "cd %s && %s exec %s env %s %s" (tramp-shell-quote-argument localname) + (if uenv + (format + "unset %s &&" + (mapconcat 'tramp-shell-quote-argument uenv " ")) + "") (if heredoc (format "<<'%s'" tramp-end-of-heredoc) "") (mapconcat 'tramp-shell-quote-argument env " ") (if heredoc @@ -3127,20 +3132,28 @@ the result will be a local, non-Tramp, file name." (error "Implementation does not handle immediate return")) (with-parsed-tramp-file-name default-directory nil - (let (command env input tmpinput stderr tmpstderr outbuf ret) + (let (command env uenv input tmpinput stderr tmpstderr outbuf ret) ;; Compute command. (setq command (mapconcat 'tramp-shell-quote-argument (cons program args) " ")) ;; We use as environment the difference to toplevel `process-environment'. - (setq env - (dolist (elt (nreverse (copy-sequence process-environment)) env) - (or (member elt (default-toplevel-value 'process-environment)) - (setq env (cons elt env))))) + (dolist (elt process-environment) + (or (member elt (default-toplevel-value 'process-environment)) + (if (string-match "=" elt) + (setq env (append env `(,elt))) + (if (tramp-get-env-with-u-option v) + (setq env (append `("-u" ,elt) env)) + (setq uenv (cons elt uenv)))))) (when env (setq command (format "env %s %s" (mapconcat 'tramp-shell-quote-argument env " ") command))) + (when uenv + (setq command + (format + "unset %s && %s" + (mapconcat 'tramp-shell-quote-argument uenv " ") command))) ;; Determine input. (if (null infile) (setq input "/dev/null") @@ -5695,6 +5708,13 @@ Return ATTR." ((and (equal id-format 'string) (not (stringp res))) "UNKNOWN") (t res))))) +(defun tramp-get-env-with-u-option (vec) + (with-tramp-connection-property vec "env-u-option" + (tramp-message vec 5 "Checking, whether `env -u' works") + ;; Option "-u" is a GNU extension. + (tramp-send-command-and-check + vec "env FOO=foo env -u FOO 2>/dev/null | grep -qv FOO" t))) + ;; Some predefined connection properties. (defun tramp-get-inline-compress (vec prop size) "Return the compress command related to PROP. From 069fc05bd5fabdd5971e2c5230a8586248fb7f38 Mon Sep 17 00:00:00 2001 From: Stephen Berman Date: Tue, 12 Jul 2016 22:11:22 +0200 Subject: [PATCH 11/19] Improve documentation of search functions Make the documentation of the search functions more accurate, complete, and uniform; in particular, extend the description of the effect when the 'count' parameter is a negative number to all of these functions. * src/search.c (Fsearch_backward, Fsearch_forward) (Fre_search_backward, Fre_search_forward) (Fposix_search_backward, Fposix_search_forward): * lisp/isearch.el (word-search-backward, word-search-forward) (word-search-backward-lax, word-search-forward-lax): Improve doc strings as described above. * doc/lispref/searching.texi (String Search, Regexp Search) (POSIX Regexps): Use 'count' instead of 'repeat' as the name of the fourth parameter of the *-search-{forward,backward} functions and improve documentation as described above. --- doc/lispref/searching.texi | 67 ++++++++++++++++++------------ lisp/isearch.el | 48 ++++++++++++++++----- src/search.c | 85 ++++++++++++++++++++++++++------------ 3 files changed, 137 insertions(+), 63 deletions(-) diff --git a/doc/lispref/searching.texi b/doc/lispref/searching.texi index 1243d720bc3..acf3d0e9845 100644 --- a/doc/lispref/searching.texi +++ b/doc/lispref/searching.texi @@ -44,7 +44,7 @@ Searching and Replacement, emacs, The GNU Emacs Manual}. buffer is multibyte; they convert the search string to unibyte if the buffer is unibyte. @xref{Text Representations}. -@deffn Command search-forward string &optional limit noerror repeat +@deffn Command search-forward string &optional limit noerror count This function searches forward from point for an exact match for @var{string}. If successful, it sets point to the end of the occurrence found, and returns the new value of point. If no match is found, the @@ -95,24 +95,24 @@ The argument @var{noerror} only affects valid searches which fail to find a match. Invalid arguments cause errors regardless of @var{noerror}. -If @var{repeat} is a positive number @var{n}, it serves as a repeat -count: the search is repeated @var{n} times, each time starting at the -end of the previous time's match. If these successive searches -succeed, the function succeeds, moving point and returning its new -value. Otherwise the search fails, with results depending on the -value of @var{noerror}, as described above. If @var{repeat} is a -negative number -@var{n}, it serves as a repeat count of @var{n} for a -search in the opposite (backward) direction. +If @var{count} is a positive number @var{n}, the search is done +@var{n} times; each successive search starts at the end of the +previous match. If all these successive searches succeed, the +function call succeeds, moving point and returning its new value. +Otherwise the function call fails, with results depending on the value +of @var{noerror}, as described above. If @var{count} is a negative +number -@var{n}, the search is done @var{n} times in the opposite +(backward) direction. @end deffn -@deffn Command search-backward string &optional limit noerror repeat +@deffn Command search-backward string &optional limit noerror count This function searches backward from point for @var{string}. It is like @code{search-forward}, except that it searches backwards rather than forwards. Backward searches leave point at the beginning of the match. @end deffn -@deffn Command word-search-forward string &optional limit noerror repeat +@deffn Command word-search-forward string &optional limit noerror count This function searches forward from point for a word match for @var{string}. If it finds a match, it sets point to the end of the match found, and returns the new value of point. @@ -156,8 +156,10 @@ returns @code{nil} instead of signaling an error. If @var{noerror} is neither @code{nil} nor @code{t}, it moves point to @var{limit} (or the end of the accessible portion of the buffer) and returns @code{nil}. -If @var{repeat} is non-@code{nil}, then the search is repeated that many -times. Point is positioned at the end of the last match. +If @var{count} is a positive number, it specifies how many successive +occurrences to search for. Point is positioned at the end of the last +match. If @var{count} is a negative number, the search is backward +and point is positioned at the beginning of the last match. @findex word-search-regexp Internally, @code{word-search-forward} and related functions use the @@ -165,7 +167,7 @@ function @code{word-search-regexp} to convert @var{string} to a regular expression that ignores punctuation. @end deffn -@deffn Command word-search-forward-lax string &optional limit noerror repeat +@deffn Command word-search-forward-lax string &optional limit noerror count This command is identical to @code{word-search-forward}, except that the beginning or the end of @var{string} need not match a word boundary, unless @var{string} begins or ends in whitespace. @@ -173,14 +175,14 @@ For instance, searching for @samp{ball boy} matches @samp{ball boyee}, but does not match @samp{balls boy}. @end deffn -@deffn Command word-search-backward string &optional limit noerror repeat +@deffn Command word-search-backward string &optional limit noerror count This function searches backward from point for a word match to @var{string}. This function is just like @code{word-search-forward} except that it searches backward and normally leaves point at the beginning of the match. @end deffn -@deffn Command word-search-backward-lax string &optional limit noerror repeat +@deffn Command word-search-backward-lax string &optional limit noerror count This command is identical to @code{word-search-backward}, except that the beginning or the end of @var{string} need not match a word boundary, unless @var{string} begins or ends in whitespace. @@ -1005,7 +1007,7 @@ only the search functions useful in programs. The principal one is the buffer is multibyte; they convert the regular expression to unibyte if the buffer is unibyte. @xref{Text Representations}. -@deffn Command re-search-forward regexp &optional limit noerror repeat +@deffn Command re-search-forward regexp &optional limit noerror count This function searches forward in the current buffer for a string of text that is matched by the regular expression @var{regexp}. The function skips over any amount of text that is not matched by @@ -1014,14 +1016,12 @@ It returns the new value of point. If @var{limit} is non-@code{nil}, it must be a position in the current buffer. It specifies the upper bound to the search. No match -extending after that position is accepted. +extending after that position is accepted. If @var{limit} is omitted +or @code{nil}, it defaults to the end of the accessible portion of the +buffer. -If @var{repeat} is supplied, it must be a positive number; the search -is repeated that many times; each repetition starts at the end of the -previous match. If all these successive searches succeed, the search -succeeds, moving point and returning its new value. Otherwise the -search fails. What @code{re-search-forward} does when the search -fails depends on the value of @var{noerror}: +What @code{re-search-forward} does when the search fails depends on +the value of @var{noerror}: @table @asis @item @code{nil} @@ -1033,6 +1033,19 @@ Move point to @var{limit} (or the end of the accessible portion of the buffer) and return @code{nil}. @end table +The argument @var{noerror} only affects valid searches which fail to +find a match. Invalid arguments cause errors regardless of +@var{noerror}. + +If @var{count} is a positive number @var{n}, the search is done +@var{n} times; each successive search starts at the end of the +previous match. If all these successive searches succeed, the +function call succeeds, moving point and returning its new value. +Otherwise the function call fails, with results depending on the value +of @var{noerror}, as described above. If @var{count} is a negative +number -@var{n}, the search is done @var{n} times in the opposite +(backward) direction. + In the following example, point is initially before the @samp{T}. Evaluating the search call moves point to the end of that line (between the @samp{t} of @samp{hat} and the newline). @@ -1057,7 +1070,7 @@ comes back" twice. @end example @end deffn -@deffn Command re-search-backward regexp &optional limit noerror repeat +@deffn Command re-search-backward regexp &optional limit noerror count This function searches backward in the current buffer for a string of text that is matched by the regular expression @var{regexp}, leaving point at the beginning of the first text found. @@ -1228,13 +1241,13 @@ non-greedy repetition operators (@pxref{Regexp Special, non-greedy}). This is because POSIX backtracking conflicts with the semantics of non-greedy repetition. -@deffn Command posix-search-forward regexp &optional limit noerror repeat +@deffn Command posix-search-forward regexp &optional limit noerror count This is like @code{re-search-forward} except that it performs the full backtracking specified by the POSIX standard for regular expression matching. @end deffn -@deffn Command posix-search-backward regexp &optional limit noerror repeat +@deffn Command posix-search-backward regexp &optional limit noerror count This is like @code{re-search-backward} except that it performs the full backtracking specified by the POSIX standard for regular expression matching. diff --git a/lisp/isearch.el b/lisp/isearch.el index 7360a0b3742..a97247671cc 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el @@ -1624,10 +1624,17 @@ Used in `word-search-forward', `word-search-backward', "Search backward from point for STRING, ignoring differences in punctuation. Set point to the beginning of the occurrence found, and return point. An optional second argument bounds the search; it is a buffer position. -The match found must not extend before that position. + The match found must not begin before that position. A value of nil + means search to the beginning of the accessible portion of the buffer. Optional third argument, if t, means if fail just return nil (no error). - If not nil and not t, move to limit of search and return nil. -Optional fourth argument is repeat count--search for successive occurrences. + If not nil and not t, position at limit of search and return nil. +Optional fourth argument COUNT, if a positive number, means to search + for COUNT successive occurrences. If COUNT is negative, search + forward, instead of backward, for -COUNT occurrences. A value of + nil means the same as 1. +With COUNT positive, the match found is the COUNTth to last one (or + last, if COUNT is 1 or nil) in the buffer located entirely before + the origin of the search; correspondingly with COUNT negative. Relies on the function `word-search-regexp' to convert a sequence of words in STRING to a regexp used to search words without regard @@ -1641,10 +1648,17 @@ has no effect on it." "Search forward from point for STRING, ignoring differences in punctuation. Set point to the end of the occurrence found, and return point. An optional second argument bounds the search; it is a buffer position. -The match found must not extend after that position. + The match found must not end after that position. A value of nil + means search to the end of the accessible portion of the buffer. Optional third argument, if t, means if fail just return nil (no error). If not nil and not t, move to limit of search and return nil. -Optional fourth argument is repeat count--search for successive occurrences. +Optional fourth argument COUNT, if a positive number, means to search + for COUNT successive occurrences. If COUNT is negative, search + backward, instead of forward, for -COUNT occurrences. A value of + nil means the same as 1. +With COUNT positive, the match found is the COUNTth one (or first, + if COUNT is 1 or nil) in the buffer located entirely after the + origin of the search; correspondingly with COUNT negative. Relies on the function `word-search-regexp' to convert a sequence of words in STRING to a regexp used to search words without regard @@ -1662,10 +1676,17 @@ Unlike `word-search-backward', the end of STRING need not match a word boundary, unless STRING ends in whitespace. An optional second argument bounds the search; it is a buffer position. -The match found must not extend before that position. + The match found must not begin before that position. A value of nil + means search to the beginning of the accessible portion of the buffer. Optional third argument, if t, means if fail just return nil (no error). - If not nil and not t, move to limit of search and return nil. -Optional fourth argument is repeat count--search for successive occurrences. + If not nil and not t, position at limit of search and return nil. +Optional fourth argument COUNT, if a positive number, means to search + for COUNT successive occurrences. If COUNT is negative, search + forward, instead of backward, for -COUNT occurrences. A value of + nil means the same as 1. +With COUNT positive, the match found is the COUNTth to last one (or + last, if COUNT is 1 or nil) in the buffer located entirely before + the origin of the search; correspondingly with COUNT negative. Relies on the function `word-search-regexp' to convert a sequence of words in STRING to a regexp used to search words without regard @@ -1683,10 +1704,17 @@ Unlike `word-search-forward', the end of STRING need not match a word boundary, unless STRING ends in whitespace. An optional second argument bounds the search; it is a buffer position. -The match found must not extend after that position. + The match found must not end after that position. A value of nil + means search to the end of the accessible portion of the buffer. Optional third argument, if t, means if fail just return nil (no error). If not nil and not t, move to limit of search and return nil. -Optional fourth argument is repeat count--search for successive occurrences. +Optional fourth argument COUNT, if a positive number, means to search + for COUNT successive occurrences. If COUNT is negative, search + backward, instead of forward, for -COUNT occurrences. A value of + nil means the same as 1. +With COUNT positive, the match found is the COUNTth one (or first, + if COUNT is 1 or nil) in the buffer located entirely after the + origin of the search; correspondingly with COUNT negative. Relies on the function `word-search-regexp' to convert a sequence of words in STRING to a regexp used to search words without regard diff --git a/src/search.c b/src/search.c index bcdd8f16d0b..5c949ad00a4 100644 --- a/src/search.c +++ b/src/search.c @@ -2164,12 +2164,17 @@ DEFUN ("search-backward", Fsearch_backward, Ssearch_backward, 1, 4, doc: /* Search backward from point for STRING. Set point to the beginning of the occurrence found, and return point. An optional second argument bounds the search; it is a buffer position. -The match found must not extend before that position. + The match found must not begin before that position. A value of nil + means search to the beginning of the accessible portion of the buffer. Optional third argument, if t, means if fail just return nil (no error). - If not nil and not t, position at limit of search and return nil. -Optional fourth argument COUNT, if non-nil, means to search for COUNT - successive occurrences. If COUNT is negative, search forward, - instead of backward, for -COUNT occurrences. + If not nil and not t, position at limit of search and return nil. +Optional fourth argument COUNT, if a positive number, means to search + for COUNT successive occurrences. If COUNT is negative, search + forward, instead of backward, for -COUNT occurrences. A value of + nil means the same as 1. +With COUNT positive, the match found is the COUNTth to last one (or + last, if COUNT is 1 or nil) in the buffer located entirely before + the origin of the search; correspondingly with COUNT negative. Search case-sensitivity is determined by the value of the variable `case-fold-search', which see. @@ -2184,13 +2189,17 @@ DEFUN ("search-forward", Fsearch_forward, Ssearch_forward, 1, 4, "MSearch: ", doc: /* Search forward from point for STRING. Set point to the end of the occurrence found, and return point. An optional second argument bounds the search; it is a buffer position. -The match found must not extend after that position. A value of nil is - equivalent to (point-max). + The match found must not end after that position. A value of nil + means search to the end of the accessible portion of the buffer. Optional third argument, if t, means if fail just return nil (no error). If not nil and not t, move to limit of search and return nil. -Optional fourth argument COUNT, if non-nil, means to search for COUNT - successive occurrences. If COUNT is negative, search backward, - instead of forward, for -COUNT occurrences. +Optional fourth argument COUNT, if a positive number, means to search + for COUNT successive occurrences. If COUNT is negative, search + backward, instead of forward, for -COUNT occurrences. A value of + nil means the same as 1. +With COUNT positive, the match found is the COUNTth one (or first, + if COUNT is 1 or nil) in the buffer located entirely after the + origin of the search; correspondingly with COUNT negative. Search case-sensitivity is determined by the value of the variable `case-fold-search', which see. @@ -2204,14 +2213,19 @@ See also the functions `match-beginning', `match-end' and `replace-match'. */) DEFUN ("re-search-backward", Fre_search_backward, Sre_search_backward, 1, 4, "sRE search backward: ", doc: /* Search backward from point for match for regular expression REGEXP. -Set point to the beginning of the match, and return point. -The match found is the one starting last in the buffer -and yet ending before the origin of the search. +Set point to the beginning of the occurrence found, and return point. An optional second argument bounds the search; it is a buffer position. -The match found must start at or after that position. + The match found must not begin before that position. A value of nil + means search to the beginning of the accessible portion of the buffer. Optional third argument, if t, means if fail just return nil (no error). - If not nil and not t, move to limit of search and return nil. -Optional fourth argument is repeat count--search for successive occurrences. + If not nil and not t, position at limit of search and return nil. +Optional fourth argument COUNT, if a positive number, means to search + for COUNT successive occurrences. If COUNT is negative, search + forward, instead of backward, for -COUNT occurrences. A value of + nil means the same as 1. +With COUNT positive, the match found is the COUNTth to last one (or + last, if COUNT is 1 or nil) in the buffer located entirely before + the origin of the search; correspondingly with COUNT negative. Search case-sensitivity is determined by the value of the variable `case-fold-search', which see. @@ -2228,10 +2242,17 @@ DEFUN ("re-search-forward", Fre_search_forward, Sre_search_forward, 1, 4, doc: /* Search forward from point for regular expression REGEXP. Set point to the end of the occurrence found, and return point. An optional second argument bounds the search; it is a buffer position. -The match found must not extend after that position. + The match found must not end after that position. A value of nil + means search to the end of the accessible portion of the buffer. Optional third argument, if t, means if fail just return nil (no error). If not nil and not t, move to limit of search and return nil. -Optional fourth argument is repeat count--search for successive occurrences. +Optional fourth argument COUNT, if a positive number, means to search + for COUNT successive occurrences. If COUNT is negative, search + backward, instead of forward, for -COUNT occurrences. A value of + nil means the same as 1. +With COUNT positive, the match found is the COUNTth one (or first, + if COUNT is 1 or nil) in the buffer located entirely after the + origin of the search; correspondingly with COUNT negative. Search case-sensitivity is determined by the value of the variable `case-fold-search', which see. @@ -2247,14 +2268,19 @@ DEFUN ("posix-search-backward", Fposix_search_backward, Sposix_search_backward, "sPosix search backward: ", doc: /* Search backward from point for match for regular expression REGEXP. Find the longest match in accord with Posix regular expression rules. -Set point to the beginning of the match, and return point. -The match found is the one starting last in the buffer -and yet ending before the origin of the search. +Set point to the beginning of the occurrence found, and return point. An optional second argument bounds the search; it is a buffer position. -The match found must start at or after that position. + The match found must not begin before that position. A value of nil + means search to the beginning of the accessible portion of the buffer. Optional third argument, if t, means if fail just return nil (no error). - If not nil and not t, move to limit of search and return nil. -Optional fourth argument is repeat count--search for successive occurrences. + If not nil and not t, position at limit of search and return nil. +Optional fourth argument COUNT, if a positive number, means to search + for COUNT successive occurrences. If COUNT is negative, search + forward, instead of backward, for -COUNT occurrences. A value of + nil means the same as 1. +With COUNT positive, the match found is the COUNTth to last one (or + last, if COUNT is 1 or nil) in the buffer located entirely before + the origin of the search; correspondingly with COUNT negative. Search case-sensitivity is determined by the value of the variable `case-fold-search', which see. @@ -2272,10 +2298,17 @@ DEFUN ("posix-search-forward", Fposix_search_forward, Sposix_search_forward, 1, Find the longest match in accord with Posix regular expression rules. Set point to the end of the occurrence found, and return point. An optional second argument bounds the search; it is a buffer position. -The match found must not extend after that position. + The match found must not end after that position. A value of nil + means search to the end of the accessible portion of the buffer. Optional third argument, if t, means if fail just return nil (no error). If not nil and not t, move to limit of search and return nil. -Optional fourth argument is repeat count--search for successive occurrences. +Optional fourth argument COUNT, if a positive number, means to search + for COUNT successive occurrences. If COUNT is negative, search + backward, instead of forward, for -COUNT occurrences. A value of + nil means the same as 1. +With COUNT positive, the match found is the COUNTth one (or first, + if COUNT is 1 or nil) in the buffer located entirely after the + origin of the search; correspondingly with COUNT negative. Search case-sensitivity is determined by the value of the variable `case-fold-search', which see. From 90f21696fe1f0a09db3891f8f7a0174fdc94dc7f Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 13 Jul 2016 12:23:22 +0200 Subject: [PATCH 12/19] ; Spelling fixes --- doc/misc/efaq.texi | 2 +- etc/PROBLEMS | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/misc/efaq.texi b/doc/misc/efaq.texi index b72b2d7c2c6..72a90a1ff21 100644 --- a/doc/misc/efaq.texi +++ b/doc/misc/efaq.texi @@ -1050,7 +1050,7 @@ Search command can now perform character folding in matches. This is analogous to case folding, but instead of disregarding case variants, it disregards wider classes of distinctions between similar characters, such as matching different variants of double quote -characters, ignoring diacriticals, etc. +characters, ignoring diacritics, etc. @cindex eww @item diff --git a/etc/PROBLEMS b/etc/PROBLEMS index 2febd82bd72..2b3becf4d93 100644 --- a/etc/PROBLEMS +++ b/etc/PROBLEMS @@ -989,13 +989,13 @@ occurrence of the failure. So far, the failure has been observed with GTK+ versions 3.4.2, 3.14.5 and 3.18.7. However, another 3.4.2 build does not exhibit the bug. -Some window managers (xfce) apparently work around this failure by +Some window managers (Xfce) apparently work around this failure by cropping the menu bar. With other windows managers, it's possible to shrink the frame manually after the problem occurs, e.g. by dragging the frame's border with the mouse. However, some window managers have been reported to refuse such attempts and snap back to the width needed to show the full menu bar (wmii) or at least cause the screen to flicker -during such resizing attempts (i3, icewm). +during such resizing attempts (i3, IceWM). See also http://debbugs.gnu.org/cgi/bugreport.cgi?bug=15700, http://debbugs.gnu.org/cgi/bugreport.cgi?bug=22000, From 5e3888706a49f08acaf4e1754e762036493adb7a Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Wed, 13 Jul 2016 08:48:30 -0700 Subject: [PATCH 13/19] ; * lisp/net/tramp.el: Fix 2010-10-04 comment typo. (Bug#23913) --- lisp/net/tramp.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 26672d1fabb..cb8e4d4d4c3 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -3642,7 +3642,7 @@ connection buffer." (with-current-buffer (tramp-get-connection-buffer vec) (let (buffer-read-only) (delete-region pos (point)))))))) -:;; Utility functions: +;;; Utility functions: (defun tramp-accept-process-output (&optional proc timeout timeout-msecs) "Like `accept-process-output' for Tramp processes. From e393d4f4ce64498408bd82f88eeab182c18457e4 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Wed, 13 Jul 2016 08:54:57 -0700 Subject: [PATCH 14/19] * lisp/emacs-lisp/package.el (describe-package-1) (package-status-external): Fix face references. (Bug#23927) --- lisp/emacs-lisp/package.el | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 14626e2f28f..e4bb561a87a 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -2255,13 +2255,13 @@ Otherwise no newline is inserted." (package--print-help-section "Status") (cond (built-in (insert (propertize (capitalize status) - 'font-lock-face 'package-status-builtin-face) + 'font-lock-face 'package-status-built-in) ".")) (pkg-dir (insert (propertize (if (member status '("unsigned" "dependency")) "Installed" (capitalize status)) - 'font-lock-face 'package-status-builtin-face)) + 'font-lock-face 'package-status-built-in)) (insert (substitute-command-keys " in `")) (let ((dir (abbreviate-file-name (file-name-as-directory @@ -2274,7 +2274,7 @@ Otherwise no newline is inserted." (insert (substitute-command-keys "',\n shadowing a ") (propertize "built-in package" - 'font-lock-face 'package-status-builtin-face)) + 'font-lock-face 'package-status-built-in)) (insert (substitute-command-keys "'"))) (if signed (insert ".") @@ -2826,13 +2826,14 @@ Return (PKG-DESC [NAME VERSION STATUS DOC])." "Face used on package description summaries in the package menu." :version "25.1") +;; Shame this hyphenates "built-in", when "font-lock-builtin-face" doesn't. (defface package-status-built-in '((t :inherit font-lock-builtin-face)) "Face used on the status and version of built-in packages." :version "25.1") (defface package-status-external - '((t :inherit package-status-builtin-face)) + '((t :inherit package-status-built-in)) "Face used on the status and version of external packages." :version "25.1") From 05ba7a0f83205e647546c2a3bb90e16add58cf06 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Thu, 14 Jul 2016 10:10:53 +0200 Subject: [PATCH 15/19] Add test for handling environment variables in Tramp * test/automatedtramp-tests.el (tramp-test--shell-command-to-string-asynchronously): New defun. (tramp-test29-environment-variables): New test. (tramp-test30-vc-registered) (tramp-test31-make-auto-save-file-name) (tramp-test32-special-characters) (tramp-test32-special-characters-with-stat) (tramp-test32-special-characters-with-perl) (tramp-test32-special-characters-with-ls, tramp-test33-utf8) (tramp-test33-utf8-with-stat, tramp-test33-utf8-with-perl) (tramp-test33-utf8-with-ls) (tramp-test34-asynchronous-requests) (tramp-test35-recursive-load, tramp-test36-unload): Rename. --- test/automated/tramp-tests.el | 130 +++++++++++++++++++++++++++++----- 1 file changed, 113 insertions(+), 17 deletions(-) diff --git a/test/automated/tramp-tests.el b/test/automated/tramp-tests.el index a12ee387576..cc90d1950cd 100644 --- a/test/automated/tramp-tests.el +++ b/test/automated/tramp-tests.el @@ -1598,7 +1598,103 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." ;; Cleanup. (ignore-errors (delete-file tmp-name))))) -(ert-deftest tramp-test29-vc-registered () +(defun tramp-test--shell-command-to-string-asynchronously (command) + "Like `shell-command-to-string', but for asynchronous processes." + (with-temp-buffer + (async-shell-command command (current-buffer)) + ;; Suppress nasty messages. + (set-process-sentinel (get-buffer-process (current-buffer)) nil) + (while + (and (get-buffer-process (current-buffer)) + (eq (process-status (get-buffer-process (current-buffer))) 'run)) + (accept-process-output (get-buffer-process (current-buffer)) 1)) + (buffer-substring-no-properties (point-min) (point-max)))) + +;; This test is inspired by Bug#23952. +(ert-deftest tramp-test29-environment-variables () + "Check that remote processes set / unset environment variables properly." + :tags '(:expensive-test) + (skip-unless (tramp--test-enabled)) + (skip-unless + (eq + (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory) + 'tramp-sh-file-name-handler)) + + ;; Implementation note: There is a "sleep 1" at the end of every + ;; test. Otherwise, the scripts could return too early, without + ;; expected output. + (dolist (this-shell-command-to-string + '(;; Synchronously. + shell-command-to-string + ;; Asynchronously. + tramp-test--shell-command-to-string-asynchronously)) + + (let ((default-directory tramp-test-temporary-file-directory) + (shell-file-name "/bin/sh") + (envvar (concat "VAR_" (upcase (md5 (current-time-string))))) + kill-buffer-query-functions) + + (unwind-protect + ;; Set a value. + (let ((process-environment + (cons (concat envvar "=foo") process-environment))) + ;; Default value. + (should + (string-match + "foo" + (funcall + this-shell-command-to-string + (format "echo -n ${%s:?bla}; sleep 1" envvar)))))) + + (unwind-protect + ;; Set the empty value. + (let ((process-environment + (cons (concat envvar "=") process-environment))) + ;; Value is null. + (should + (string-match + "bla" + (funcall + this-shell-command-to-string + (format "echo -n ${%s:?bla}; sleep 1" envvar)))) + ;; Variable is set. + (should + (string-match + (regexp-quote envvar) + (funcall this-shell-command-to-string "set; sleep 1"))))) + + ;; We force a reconnect, in order to have a clean environment. + (tramp-cleanup-connection + (tramp-dissect-file-name tramp-test-temporary-file-directory) + 'keep-debug 'keep-password) + (unwind-protect + ;; Unset the variable. + (let ((tramp-remote-process-environment + (cons (concat envvar "=foo") + tramp-remote-process-environment))) + ;; Set the initial value, we want to unset below. + (should + (string-match + "foo" + (funcall + this-shell-command-to-string + (format "echo -n ${%s:?bla}; sleep 1" envvar)))) + (let ((process-environment + (cons envvar process-environment))) + ;; Variable is unset. + (should + (string-match + "bla" + (funcall + this-shell-command-to-string + (format "echo -n ${%s:?bla}; sleep 1" envvar)))) + ;; Variable is unset. + (should-not + (string-match + (regexp-quote envvar) + (funcall this-shell-command-to-string "set; sleep 1"))))))))) + +(ert-deftest tramp-test30-vc-registered () "Check `vc-registered'." :tags '(:expensive-test) (skip-unless (tramp--test-enabled)) @@ -1667,7 +1763,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." ;; Cleanup. (ignore-errors (delete-directory tmp-name1 'recursive))))) -(ert-deftest tramp-test30-make-auto-save-file-name () +(ert-deftest tramp-test31-make-auto-save-file-name () "Check `make-auto-save-file-name'." (skip-unless (tramp--test-enabled)) @@ -1921,7 +2017,7 @@ Several special characters do not work properly there." (ignore-errors (delete-directory tmp-name2 'recursive))))) (defun tramp--test-special-characters () - "Perform the test in `tramp-test31-special-characters*'." + "Perform the test in `tramp-test32-special-characters*'." ;; Newlines, slashes and backslashes in file names are not ;; supported. So we don't test. And we don't test the tab ;; character on Windows or Cygwin, because the backslash is @@ -1962,13 +2058,13 @@ Several special characters do not work properly there." "{foo}bar{baz}")) ;; These tests are inspired by Bug#17238. -(ert-deftest tramp-test31-special-characters () +(ert-deftest tramp-test32-special-characters () "Check special characters in file names." (skip-unless (tramp--test-enabled)) (tramp--test-special-characters)) -(ert-deftest tramp-test31-special-characters-with-stat () +(ert-deftest tramp-test32-special-characters-with-stat () "Check special characters in file names. Use the `stat' command." :tags '(:expensive-test) @@ -1987,7 +2083,7 @@ Use the `stat' command." tramp-connection-properties))) (tramp--test-special-characters))) -(ert-deftest tramp-test31-special-characters-with-perl () +(ert-deftest tramp-test32-special-characters-with-perl () "Check special characters in file names. Use the `perl' command." :tags '(:expensive-test) @@ -2009,7 +2105,7 @@ Use the `perl' command." tramp-connection-properties))) (tramp--test-special-characters))) -(ert-deftest tramp-test31-special-characters-with-ls () +(ert-deftest tramp-test32-special-characters-with-ls () "Check special characters in file names. Use the `ls' command." :tags '(:expensive-test) @@ -2032,7 +2128,7 @@ Use the `ls' command." (tramp--test-special-characters))) (defun tramp--test-utf8 () - "Perform the test in `tramp-test32-utf8*'." + "Perform the test in `tramp-test33-utf8*'." (let* ((utf8 (if (and (eq system-type 'darwin) (memq 'utf-8-hfs (coding-system-list))) 'utf-8-hfs 'utf-8)) @@ -2046,13 +2142,13 @@ Use the `ls' command." "银河系漫游指南系列" "Автостопом по гала́ктике"))) -(ert-deftest tramp-test32-utf8 () +(ert-deftest tramp-test33-utf8 () "Check UTF8 encoding in file names and file contents." (skip-unless (tramp--test-enabled)) (tramp--test-utf8)) -(ert-deftest tramp-test32-utf8-with-stat () +(ert-deftest tramp-test33-utf8-with-stat () "Check UTF8 encoding in file names and file contents. Use the `stat' command." :tags '(:expensive-test) @@ -2071,7 +2167,7 @@ Use the `stat' command." tramp-connection-properties))) (tramp--test-utf8))) -(ert-deftest tramp-test32-utf8-with-perl () +(ert-deftest tramp-test33-utf8-with-perl () "Check UTF8 encoding in file names and file contents. Use the `perl' command." :tags '(:expensive-test) @@ -2093,7 +2189,7 @@ Use the `perl' command." tramp-connection-properties))) (tramp--test-utf8))) -(ert-deftest tramp-test32-utf8-with-ls () +(ert-deftest tramp-test33-utf8-with-ls () "Check UTF8 encoding in file names and file contents. Use the `ls' command." :tags '(:expensive-test) @@ -2116,7 +2212,7 @@ Use the `ls' command." (tramp--test-utf8))) ;; This test is inspired by Bug#16928. -(ert-deftest tramp-test33-asynchronous-requests () +(ert-deftest tramp-test34-asynchronous-requests () "Check parallel asynchronous requests. Such requests could arrive from timers, process filters and process sentinels. They shall not disturb each other." @@ -2206,7 +2302,7 @@ process sentinels. They shall not disturb each other." (dolist (buf buffers) (ignore-errors (kill-buffer buf))))))) -(ert-deftest tramp-test34-recursive-load () +(ert-deftest tramp-test35-recursive-load () "Check that Tramp does not fail due to recursive load." (skip-unless (tramp--test-enabled)) @@ -2229,7 +2325,7 @@ process sentinels. They shall not disturb each other." (mapconcat 'shell-quote-argument load-path " -L ") (shell-quote-argument code))))))) -(ert-deftest tramp-test35-unload () +(ert-deftest tramp-test36-unload () "Check that Tramp and its subpackages unload completely. Since it unloads Tramp, it shall be the last test to run." ;; Mark as failed until all symbols are unbound. @@ -2277,8 +2373,8 @@ Since it unloads Tramp, it shall be the last test to run." ;; * Fix `tramp-test15-copy-directory' for `smb'. Using tar in a pipe ;; doesn't work well when an interactive password must be provided. ;; * Fix `tramp-test27-start-file-process' on MS Windows (`process-send-eof'?). -;; * Fix Bug#16928. Set expected error of `tramp-test33-asynchronous-requests'. -;; * Fix `tramp-test35-unload' (Not all symbols are unbound). Set +;; * Fix Bug#16928. Set expected error of `tramp-test34-asynchronous-requests'. +;; * Fix `tramp-test36-unload' (Not all symbols are unbound). Set ;; expected error. (defun tramp-test-all (&optional interactive) From 8f5a8b69157ed73f14faed6d3dd943d65bce9264 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Thu, 14 Jul 2016 12:27:41 +0200 Subject: [PATCH 16/19] Improve timing in `tramp-test29-environment-variables' * test/automated/tramp-tests.el (tramp-test--shell-command-to-string-asynchronously): Add additional `accept-process-output' call. (tramp-test29-environment-variables): Remove additional sleep calls. --- test/automated/tramp-tests.el | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/test/automated/tramp-tests.el b/test/automated/tramp-tests.el index cc90d1950cd..34d8d6ad495 100644 --- a/test/automated/tramp-tests.el +++ b/test/automated/tramp-tests.el @@ -1604,10 +1604,9 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." (async-shell-command command (current-buffer)) ;; Suppress nasty messages. (set-process-sentinel (get-buffer-process (current-buffer)) nil) - (while - (and (get-buffer-process (current-buffer)) - (eq (process-status (get-buffer-process (current-buffer))) 'run)) - (accept-process-output (get-buffer-process (current-buffer)) 1)) + (while (get-buffer-process (current-buffer)) + (accept-process-output (get-buffer-process (current-buffer)) 0.1)) + (accept-process-output) (buffer-substring-no-properties (point-min) (point-max)))) ;; This test is inspired by Bug#23952. @@ -1620,9 +1619,6 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory) 'tramp-sh-file-name-handler)) - ;; Implementation note: There is a "sleep 1" at the end of every - ;; test. Otherwise, the scripts could return too early, without - ;; expected output. (dolist (this-shell-command-to-string '(;; Synchronously. shell-command-to-string @@ -1644,7 +1640,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." "foo" (funcall this-shell-command-to-string - (format "echo -n ${%s:?bla}; sleep 1" envvar)))))) + (format "echo -n ${%s:?bla}" envvar)))))) (unwind-protect ;; Set the empty value. @@ -1656,12 +1652,12 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." "bla" (funcall this-shell-command-to-string - (format "echo -n ${%s:?bla}; sleep 1" envvar)))) + (format "echo -n ${%s:?bla}" envvar)))) ;; Variable is set. (should (string-match (regexp-quote envvar) - (funcall this-shell-command-to-string "set; sleep 1"))))) + (funcall this-shell-command-to-string "set"))))) ;; We force a reconnect, in order to have a clean environment. (tramp-cleanup-connection @@ -1678,7 +1674,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." "foo" (funcall this-shell-command-to-string - (format "echo -n ${%s:?bla}; sleep 1" envvar)))) + (format "echo -n ${%s:?bla}" envvar)))) (let ((process-environment (cons envvar process-environment))) ;; Variable is unset. @@ -1687,12 +1683,12 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." "bla" (funcall this-shell-command-to-string - (format "echo -n ${%s:?bla}; sleep 1" envvar)))) + (format "echo -n ${%s:?bla}" envvar)))) ;; Variable is unset. (should-not (string-match (regexp-quote envvar) - (funcall this-shell-command-to-string "set; sleep 1"))))))))) + (funcall this-shell-command-to-string "set"))))))))) (ert-deftest tramp-test30-vc-registered () "Check `vc-registered'." From 248d5dd13cd2ae0b1319a52b331e451fa7dd99c8 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Thu, 14 Jul 2016 14:56:38 -0400 Subject: [PATCH 17/19] Include cl-generic in package--builtin-versions (bug#22817) * lisp/emacs-lisp/cl-generic.el (package--builtin-versions): Add ourselves manually. Don't merge since there's a better fix on master. --- lisp/emacs-lisp/cl-generic.el | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lisp/emacs-lisp/cl-generic.el b/lisp/emacs-lisp/cl-generic.el index 37edf45df38..e5bab8dba99 100644 --- a/lisp/emacs-lisp/cl-generic.el +++ b/lisp/emacs-lisp/cl-generic.el @@ -86,6 +86,11 @@ ;;; Code: +;; The autoloads.el mechanism which adds package--builtin-versions +;; maintenance to loaddefs.el doesn't work for preloaded packages (such +;; as this one), so we have to do it by hand! +(push (purecopy '(cl-generic 1 0)) package--builtin-versions) + ;; Note: For generic functions that dispatch on several arguments (i.e. those ;; which use the multiple-dispatch feature), we always use the same "tagcodes" ;; and the same set of arguments on which to dispatch. This works, but is From 452aa949bc4de77b1fba103de6b61e55b2ca8c0b Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Thu, 14 Jul 2016 15:05:49 -0400 Subject: [PATCH 18/19] Fix eieio vs cl-generic incompatibilities found in Rudel (bug#23947) * lisp/emacs-lisp/cl-generic.el (cl-generic-apply): New function. * lisp/emacs-lisp/eieio-compat.el (eieio--defmethod): Fix incorrect mapping between cl-no-applicable-method and EIEIO's no-applicable-method. * lisp/emacs-lisp/eieio-core.el (eieio--class-precedence-c3): `class' is not a symbol but a class object. --- lisp/emacs-lisp/cl-generic.el | 9 +++++++++ lisp/emacs-lisp/eieio-compat.el | 3 ++- lisp/emacs-lisp/eieio-core.el | 4 ++-- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/lisp/emacs-lisp/cl-generic.el b/lisp/emacs-lisp/cl-generic.el index e5bab8dba99..4f263c6bb8d 100644 --- a/lisp/emacs-lisp/cl-generic.el +++ b/lisp/emacs-lisp/cl-generic.el @@ -671,6 +671,15 @@ FUN is the function that should be called when METHOD calls (setq fun (cl-generic-call-method generic method fun))) fun))))) +(defun cl-generic-apply (generic args) + "Like `apply' but takes a cl-generic object rather than a function." + ;; Handy in cl-no-applicable-method, for example. + ;; In Common Lisp, generic-function objects are funcallable. Ideally + ;; we'd want the same in Elisp, but it would either require using a very + ;; different (and less efficient) representation of cl--generic objects, + ;; or non-trivial changes in the general infrastructure (compiler and such). + (apply (cl--generic-name generic) args)) + (defun cl--generic-arg-specializer (method dispatch-arg) (or (if (integerp dispatch-arg) (nth dispatch-arg diff --git a/lisp/emacs-lisp/eieio-compat.el b/lisp/emacs-lisp/eieio-compat.el index 6d4798b92f9..6aba8a3acbd 100644 --- a/lisp/emacs-lisp/eieio-compat.el +++ b/lisp/emacs-lisp/eieio-compat.el @@ -188,7 +188,8 @@ Summary: (`no-applicable-method (setq method 'cl-no-applicable-method) (setq specializers `(generic ,@specializers)) - (lambda (generic arg &rest args) (apply code arg generic args))) + (lambda (generic arg &rest args) + (apply code arg (cl--generic-name generic) (cons arg args)))) (_ code)))) (cl-generic-define-method method (unless (memq kind '(nil :primary)) (list kind)) diff --git a/lisp/emacs-lisp/eieio-core.el b/lisp/emacs-lisp/eieio-core.el index 631e4a437f2..223c2a69a62 100644 --- a/lisp/emacs-lisp/eieio-core.el +++ b/lisp/emacs-lisp/eieio-core.el @@ -976,7 +976,7 @@ If a consistent order does not exist, signal an error." (defun eieio--class-precedence-c3 (class) "Return all parents of CLASS in c3 order." - (let ((parents (eieio--class-parents (cl--find-class class)))) + (let ((parents (eieio--class-parents class))) (eieio--c3-merge-lists (list class) (append @@ -1101,7 +1101,7 @@ method invocation orders of the involved classes." (list eieio--generic-subclass-generalizer)) -;;;### (autoloads nil "eieio-compat" "eieio-compat.el" "6aca3c1b5f751a01331761da45fc4f5c") +;;;### (autoloads nil "eieio-compat" "eieio-compat.el" "dba4205b1a0d7133f1311d975b4d0ebe") ;;; Generated autoloads from eieio-compat.el (autoload 'eieio--defalias "eieio-compat" "\ From 9ba51edf62b25c678508a316ec78a09b18d3bf9e Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Sun, 10 Jul 2016 21:52:23 -0400 Subject: [PATCH 19/19] Document buffer-swap-text+save-excursion interaction * doc/lispref/buffers.texi (Swapping Text): * src/buffer.c (Fbuffer_swap_text): Add warning about interaction of `buffer-swap-text' and `save-excursion' (Bug #4655). --- doc/lispref/buffers.texi | 6 ++++++ src/buffer.c | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/doc/lispref/buffers.texi b/doc/lispref/buffers.texi index 1f7f263fb21..740d7cfd8a1 100644 --- a/doc/lispref/buffers.texi +++ b/doc/lispref/buffers.texi @@ -1211,6 +1211,12 @@ swapped as well: the positions of point and mark, all the markers, the overlays, the text properties, the undo list, the value of the @code{enable-multibyte-characters} flag (@pxref{Text Representations, enable-multibyte-characters}), etc. + +@strong{Warning:} If this function is called from within a +@code{save-excursion} form, the current buffer will be set to +@var{buffer} upon leaving the form, since the marker used by +@code{save-excursion} to save the position and buffer will be swapped +as well. @end defun If you use @code{buffer-swap-text} on a file-visiting buffer, you diff --git a/src/buffer.c b/src/buffer.c index e4269c0046a..89f4479740a 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -2231,7 +2231,9 @@ advance_to_char_boundary (ptrdiff_t byte_pos) DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text, 1, 1, 0, - doc: /* Swap the text between current buffer and BUFFER. */) + doc: /* Swap the text between current buffer and BUFFER. +Using this function from `save-excursion' might produce surprising +results, see Info node `(elisp)Swapping Text'. */) (Lisp_Object buffer) { struct buffer *other_buffer;