Merge from origin/emacs-26

cfc94fd (origin/emacs-26) Don't mention 'vc-stay-local' in the user m...
8ce430b Fix a typo in calendar.texi
bb748b3 Minor improvement in wording of the Emacs manual
b603aff Revert "Fix tempfile creation when byte compiling"
4fd446e Fix tempfile creation when byte compiling
7f48a11 Improve the Emacs manual as suggested in emacs-manual-bugs
728ded0 * lisp/emacs-lisp/bytecomp.el: Tweak last change
c6c05e2 Unbreak building Emacs on FreeBSD
a41ad3d Don't unnecessarily use non-ASCII characters in C sources
c28d4b6 Portability fixes in emacs-module-tests
1d50c18 Add tests for term.el
This commit is contained in:
Glenn Morris 2018-01-20 08:23:30 -08:00
commit 60d5a13d28
14 changed files with 215 additions and 48 deletions

View file

@ -441,7 +441,7 @@ argument, which specifies how many days, weeks, months or years to print
If the variable @code{cal-tex-holidays} is non-@code{nil} (the default),
then the printed calendars show the holidays in @code{calendar-holidays}.
If the variable @code{cal-tex-diary} is non-@code{nil} (the default is
@code{nil}), diary entries are included also (in monthly, filofax, and
@code{nil}), diary entries are included also (in monthly, Filofax, and
iso-week calendars only). If the variable @code{cal-tex-rules} is
non-@code{nil} (the default is @code{nil}), the calendar displays ruled
pages in styles that have sufficient room. Consult the documentation of

View file

@ -462,14 +462,14 @@ command (@pxref{Browse-URL}).
@findex backward-button
In a help buffer, @key{TAB} (@code{forward-button}) moves point
forward to the next hyperlink, while @kbd{S-@key{TAB}}
(@code{backward-button}) point back to the previous hyperlink. These
commands act cyclically; for instance, typing @key{TAB} at the last
hyperlink moves back to the first hyperlink.
(@code{backward-button}) moves point back to the previous hyperlink.
These commands act cyclically; for instance, typing @key{TAB} at the
last hyperlink moves back to the first hyperlink.
To view all documentation about any symbol in the text, move point
to there and type @kbd{C-c C-c} (@code{help-follow-symbol}). This
shows all available documentation about the symbol---as a variable,
function and/or face.
to the symbol and type @kbd{C-c C-c} (@code{help-follow-symbol}).
This shows all available documentation about the symbol---as a
variable, function and/or face.
@node Package Keywords
@section Keyword Search for Packages
@ -495,8 +495,8 @@ buffer (@pxref{Package Menu}).
package (@pxref{Packages}, and displays a help buffer describing the
attributes of the package and the features that it implements. The
buffer lists the keywords that relate to the package in the form of
buttons. Click on a button to see other packages related to that
keyword.
buttons. Click on a button with @kbd{mouse-1} or @kbd{mouse-2} to see
the list of other packages related to that keyword.
@node Language Help
@section Help for International Language Support

View file

@ -33,13 +33,13 @@ killing many different types of syntactic units.
@cindex cutting text
@cindex deletion
Most commands which erase text from the buffer save it in the kill
ring. These are known as @dfn{kill} commands, and their names
normally contain the word @samp{kill} (e.g., @code{kill-line}). The
kill ring stores several recent kills, not just the last one, so
killing is a very safe operation: you don't have to worry much about
losing text that you previously killed. The kill ring is shared by
all buffers, so text that is killed in one buffer can be yanked into
another buffer.
ring (@pxref{Kill Ring}). These are known as @dfn{kill} commands, and
their names normally contain the word @samp{kill} (e.g.,
@code{kill-line}). The kill ring stores several recent kills, not
just the last one, so killing is a very safe operation: you don't have
to worry much about losing text that you previously killed. The kill
ring is shared by all buffers, so text that is killed in one buffer
can be yanked into another buffer.
When you use @kbd{C-/} (@code{undo}) to undo a kill command
(@pxref{Undo}), that brings the killed text back into the buffer, but
@ -909,8 +909,8 @@ any direction. Normal text you type is inserted to the left or right
of each line in the rectangle (on the same side as the cursor).
You can use this rectangle support without activating CUA by calling the
@code{cua-rectangle-mark-mode} command. But see also the standard
@code{rectangle-mark-mode}. @xref{Rectangles}.
@code{cua-rectangle-mark-mode} command. There's also the standard command
@code{rectangle-mark-mode}, see @ref{Rectangles}.
With CUA you can easily copy text and rectangles into and out of
registers by providing a one-digit numeric prefix to the kill, copy,

View file

@ -1206,11 +1206,9 @@ file. RCS and SCCS show the name of the user locking a file as its
status.
@ifnottex
@vindex vc-stay-local
On CVS and Subversion, the @code{vc-dir} command normally contacts
the repository, which may be on a remote machine, to check for
updates. If you change the variable @code{vc-stay-local} or
@code{vc-cvs-stay-local} (for CVS) to @code{nil} (@pxref{CVS
On CVS, the @code{vc-dir} command normally contacts the repository,
which may be on a remote machine, to check for updates. If you change
the variable @code{vc-cvs-stay-local} to @code{nil} (@pxref{CVS
Options}), then Emacs avoids contacting a remote repository when
generating the VC Directory buffer (it will still contact it when
necessary, e.g., when doing a commit). This may be desirable if you

View file

@ -364,18 +364,13 @@ the name of the operation to invoke.
@cindex remote repositories (CVS)
When using a CVS repository on a remote machine, VC can try keeping
network interactions to a minimum. This is controlled by the variable
@code{vc-cvs-stay-local}. There is another variable,
@code{vc-stay-local}, which enables the feature also for other back
ends that support it, including CVS@. In the following, we will talk
only about @code{vc-cvs-stay-local}, but everything applies to
@code{vc-stay-local} as well.
If @code{vc-cvs-stay-local} is @code{only-file} (the default), VC
determines the version control status of each file using only the
entry in the local CVS subdirectory and the information returned by
previous CVS commands. As a consequence, if you have modified a file
and somebody else has checked in other changes, you will not be
notified of the conflict until you try to commit.
@code{vc-cvs-stay-local}. If @code{vc-cvs-stay-local} is
@code{only-file} (the default), VC determines the version control
status of each file using only the entry in the local CVS subdirectory
and the information returned by previous CVS commands. As a
consequence, if you have modified a file and somebody else has checked
in other changes, you will not be notified of the conflict until you
try to commit.
If you change @code{vc-cvs-stay-local} to @code{nil}, VC queries the
remote repository @emph{before} it decides what to do in

View file

@ -1933,7 +1933,17 @@ The value is non-nil if there were no errors, nil if errors."
;; parallel bootstrap), it does not risk getting a
;; half-finished file. (Bug#4196)
(tempfile
(make-temp-file (file-name-nondirectory target-file)))
(if (file-name-absolute-p target-file)
(make-temp-file target-file)
;; If target-file is relative and includes
;; leading directories, make-temp-file will
;; assume those leading directories exist
;; under temporary-file-directory, which might
;; not be true. So strip leading directories
;; from relative file names before calling
;; make-temp-file.
(make-temp-file
(file-name-nondirectory target-file))))
(default-modes (default-file-modes))
(temp-modes (logand default-modes #o600))
(desired-modes (logand default-modes #o666))

View file

@ -1117,7 +1117,8 @@ Entry to this mode runs the hooks on `term-mode-hook'."
(lambda (size)
(when size
(term-reset-size (cdr size) (car size)))
size))
size)
'((name . term-maybe-reset-size)))
(add-hook 'read-only-mode-hook #'term-line-mode-buffer-read-only-update nil t)

View file

@ -5122,7 +5122,7 @@ typedef union
#endif
/* Set *P to the address of the top of the stack. This must be a
macro, not a function, so that it is executed in the callers
macro, not a function, so that it is executed in the caller's
environment. It is not inside a do-while so that its storage
survives the macro. Callers should be declared NO_INLINE. */
#ifdef HAVE___BUILTIN_UNWIND_INIT

View file

@ -579,7 +579,7 @@ module_make_string (emacs_env *env, const char *str, ptrdiff_t length)
if (! (0 <= length && length <= STRING_BYTES_BOUND))
xsignal0 (Qoverflow_error);
/* FIXME: AUTO_STRING_WITH_LEN requires STR to be null-terminated,
but we shouldnt require that. */
but we shouldn't require that. */
AUTO_STRING_WITH_LEN (lstr, str, length);
return lisp_to_value (env,
code_convert_string_norecord (lstr, Qutf_8, false));

View file

@ -580,8 +580,8 @@ xg_check_special_colors (struct frame *f,
{
GdkRGBA *c;
/* FIXME: Retrieving the background color is deprecated in
GTK+ 3.16. New versions of GTK+ dont use the concept of a
single background color any more, so we shouldnt query for
GTK+ 3.16. New versions of GTK+ don't use the concept of a
single background color any more, so we shouldn't query for
it. */
gtk_style_context_get (gsty, state,
GTK_STYLE_PROPERTY_BACKGROUND_COLOR, &c,

View file

@ -389,7 +389,7 @@ webkit_javascript_finished_cb (GObject *webview,
/* Register an xwidget event here, which then runs the callback.
This ensures that the callback runs in sync with the Emacs
event loop. */
/* FIXME: This might lead to disaster if LISP_CALLBACKs object
/* FIXME: This might lead to disaster if LISP_CALLBACK's object
was garbage collected before now. See the FIXME in
Fxwidget_webkit_execute_script. */
store_xwidget_js_callback_event (xw, XPL (lisp_callback), lisp_value);

View file

@ -31,6 +31,7 @@
SHELL = @SHELL@
srcdir = @srcdir@
abs_top_srcdir=@abs_top_srcdir@
VPATH = $(srcdir)
FIND_DELETE = @FIND_DELETE@

View file

@ -20,10 +20,35 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <emacs-module.h>
int plugin_is_GPL_compatible;
#if INTPTR_MAX <= 0
# error "INTPTR_MAX misconfigured"
#elif INTPTR_MAX <= INT_MAX || INTPTR_MAX <= LONG_MAX
# define pT "ld"
# define pZ "lu"
# define T_TYPE long
# define Z_TYPE unsigned long
#elif INTPTR_MAX <= INT64_MAX
# ifdef __MINGW32__
# define pT "lld"
# define pZ "llu"
# define T_TYPE long long
# define Z_TYPE unsigned long long
# else
# define pT "ld"
# define pZ "lu"
# define T_TYPE long
# define Z_TYPE unsigned long
# endif
#else
# error "INTPTR_MAX too large"
#endif
/* Always return symbol 't'. */
static emacs_value
Fmod_test_return_t (emacs_env *env, ptrdiff_t nargs, emacs_value args[],
@ -287,9 +312,9 @@ emacs_module_init (struct emacs_runtime *ert)
{
if (ert->size < sizeof *ert)
{
fprintf (stderr, "Runtime size of runtime structure (%td bytes) "
"smaller than compile-time size (%zu bytes)",
ert->size, sizeof *ert);
fprintf (stderr, "Runtime size of runtime structure (%"pT" bytes) "
"smaller than compile-time size (%"pZ" bytes)",
(T_TYPE) ert->size, (Z_TYPE) sizeof (*ert));
return 1;
}
@ -297,9 +322,9 @@ emacs_module_init (struct emacs_runtime *ert)
if (env->size < sizeof *env)
{
fprintf (stderr, "Runtime size of environment structure (%td bytes) "
"smaller than compile-time size (%zu bytes)",
env->size, sizeof *env);
fprintf (stderr, "Runtime size of environment structure (%"pT" bytes) "
"smaller than compile-time size (%"pZ" bytes)",
(T_TYPE) env->size, (Z_TYPE) sizeof (*env));
return 2;
}

137
test/lisp/term-tests.el Normal file
View file

@ -0,0 +1,137 @@
;;; term-tests.el --- tests for term.el -*- lexical-binding: t -*-
;; Copyright (C) 2017 Free Software Foundation, Inc.
;; This file is part of GNU Emacs.
;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;;; Code:
(require 'ert)
(require 'term)
(eval-when-compile (require 'cl-lib))
(defvar term-height) ; Number of lines in window.
(defvar term-width) ; Number of columns in window.
(defun term-test-screen-from-input (width height input &optional return-var)
(with-temp-buffer
(term-mode)
;; Keep dimensions independent from window size.
(remove-function (local 'window-adjust-process-window-size-function)
'term-maybe-reset-size)
(term-exec (current-buffer) "test" "cat" nil nil)
(term-char-mode)
(setq term-width width)
(setq term-height height)
;; Pass input directly to `term-emulate-terminal', it's easier to
;; control chunking, and we don't have to worry about wrestling
;; with stty settings.
(let ((proc (get-buffer-process (current-buffer))))
(unwind-protect
(prog2 (if (consp input)
(mapc (lambda (input) (term-emulate-terminal proc input)) input)
(term-emulate-terminal proc input))
(if return-var (buffer-local-value return-var (current-buffer))
(buffer-substring-no-properties (point-min) (point-max)))
;; End the process to avoid query on buffer kill.
(process-send-eof proc)
(accept-process-output proc))
;; Make extra sure we don't get stuck in case we hit some
;; error before sending eof.
(when (process-live-p proc)
(kill-process proc)
;; Let Emacs update process status.
(accept-process-output proc))))))
(ert-deftest term-simple-lines ()
(let ((str "\
first line\r
next line\r\n"))
(should (equal (term-test-screen-from-input 40 12 str)
(replace-regexp-in-string "\r" "" str)))))
(ert-deftest term-carriage-return ()
(let ((str "\
first line\r_next line\r\n"))
(should (equal (term-test-screen-from-input 40 12 str)
"_next line\n"))))
(ert-deftest term-line-wrap ()
(should (string-match-p
;; Don't be strict about trailing whitespace.
"\\`a\\{40\\}\na\\{20\\} *\\'"
(term-test-screen-from-input 40 12 (make-string 60 ?a))))
;; Again, but split input into chunks.
(should (string-match-p
"\\`a\\{40\\}\na\\{20\\} *\\'"
(term-test-screen-from-input 40 12 (let ((str (make-string 30 ?a)))
(list str str))))))
(ert-deftest term-cursor-movement ()
;; Absolute positioning.
(should (equal "ab\ncd"
(term-test-screen-from-input
40 12 (concat "\e[2;2Hd"
"\e[2;1Hc"
"\e[1;2Hb"
"\e[1;1Ha"))))
;; Send one byte at a time.
(should (equal "ab\ncd"
(term-test-screen-from-input
40 12 (split-string (concat "\e[2;2Hd"
"\e[2;1Hc"
"\e[1;2Hb"
"\e[1;1Ha") "" t))))
;; Relative positioning.
(should (equal "ab\ncd"
(term-test-screen-from-input
40 12 (concat "\e[B\e[Cd"
"\e[D\e[Dc"
"\e[Ab"
"\e[D\e[Da")))))
(ert-deftest term-scrolling-region ()
(should (equal "\
line3
line4
line5
line6
"
(term-test-screen-from-input
40 12 "\e[1;5r\
line1\r
line2\r
line3\r
line4\r
line5\r
line6\r
"))))
(ert-deftest term-set-directory ()
(let ((term-ansi-at-user (user-real-login-name)))
(should (equal (term-test-screen-from-input
40 12 "\eAnSiTc /foo/\n" 'default-directory)
"/foo/"))
;; Split input (Bug#17231).
(should (equal (term-test-screen-from-input
40 12 (list "\eAnSiTc /f" "oo/\n") 'default-directory)
"/foo/"))))
(provide 'term-tests)
;;; term-tests.el ends here