Merge from emacs-26

e62ad04963 Fix sgml-mode handling of quotes within parens (Bug#36347)
06b35b2f92 ; * lisp/frame.el: Enhance add-variable-watcher commentary.
572e34bb6f Rename 'make-symbolic-link' argument NEWNAME to LINKNAME
04477adedc Check that length of data returned by sysctl is non-zero
81535eeadb * test/lisp/progmodes/python-tests.el (python-virt-bin): D...
9d48979ca8 Fix Python tests depending on system-type
fcf6cc3177 Fix problem with wdired test when symlinks cannot be created.
4701e0663e Improve wording of documentation of click events

# Conflicts:
#	lisp/textmodes/sgml-mode.el
#	test/lisp/textmodes/sgml-mode-tests.el
This commit is contained in:
Noam Postavsky 2019-06-25 22:04:13 -04:00
commit 9552ee4df7
10 changed files with 78 additions and 55 deletions

View file

@ -1392,9 +1392,9 @@ The time at which the event occurred, as an integer number of
milliseconds since a system-dependent initial time.
@item @var{object}
Either @code{nil} if there is no string-type text property at the
click position, or a cons cell of the form (@var{string}
. @var{string-pos}) if there is one:
Either @code{nil}, which means the click occurred on buffer text, or a
cons cell of the form @w{(@var{string} . @var{string-pos})} if there
is a string from a text property or an overlay at the click position.
@table @asis
@item @var{string}
@ -1425,15 +1425,15 @@ clicks on margins, @var{col} is measured from the left edge of the
margin area and @var{row} is measured from the top of the margin area.
@item @var{image}
This is the image object on which the click occurred. It is either
@code{nil} if there is no image at the position clicked on, or it is
an image object as returned by @code{find-image} if click was in an image.
If there is an image at the click location, this is the image object
as returned by @code{find-image} (@pxref{Defining Images}); otherwise
this is @code{nil}.
@item @var{dx}, @var{dy}
These are the pixel coordinates of the click, relative to
the top left corner of @var{object}, which is @code{(0 . 0)}. If
@var{object} is @code{nil}, the coordinates are relative to the top
left corner of the character glyph clicked on.
These are the pixel coordinates of the click, relative to the top left
corner of @var{object}, which is @code{(0 . 0)}. If @var{object} is
@code{nil}, which stands for a buffer, the coordinates are relative to
the top left corner of the character glyph clicked on.
@item @var{width}, @var{height}
These are the pixel width and height of @var{object} or, if this is
@ -2035,8 +2035,8 @@ position such events have.
@defun posnp object
This function returns non-@code{nil} if @var{object} is a mouse
position list, in either of the formats documented in @ref{Click
Events}); and @code{nil} otherwise.
position list, in the format documented in @ref{Click Events}); and
@code{nil} otherwise.
@end defun
@cindex mouse position list, accessing
@ -2064,8 +2064,8 @@ is undefined.
@defun posn-x-y position
Return the pixel-based x and y coordinates in @var{position}, as a
cons cell @code{(@var{x} . @var{y})}. These coordinates are relative
to the window given by @code{posn-window}.
cons cell @w{@code{(@var{x} . @var{y})}}. These coordinates are
relative to the window given by @code{posn-window}.
This example shows how to convert the window-relative coordinates in
the text area of a window into frame-relative coordinates:
@ -2083,11 +2083,11 @@ POSITION is assumed to lie in a window text area."
@end defun
@defun posn-col-row position
This function returns a cons cell @code{(@var{col} . @var{row})},
This function returns a cons cell @w{@code{(@var{col} . @var{row})}},
containing the estimated column and row corresponding to buffer
position in @var{position}. The return value is given in units of the
frame's default character width and default line height (including
spacing), as computed from the @var{x} and @var{y} values
position described by @var{position}. The return value is given in
units of the frame's default character width and default line height
(including spacing), as computed from the @var{x} and @var{y} values
corresponding to @var{position}. (So, if the actual characters have
non-default sizes, the actual row and column may differ from these
computed values.)
@ -2099,7 +2099,7 @@ Lines}), it is @emph{not} included in the @var{row} count.
@defun posn-actual-col-row position
Return the actual row and column in @var{position}, as a cons cell
@code{(@var{col} . @var{row})}. The values are the actual row and
@w{@code{(@var{col} . @var{row})}}. The values are the actual row and
column numbers in the window given by @var{position}. @xref{Click
Events}, for details. The function returns @code{nil} if
@var{position} does not include actual position values; in that case
@ -2112,33 +2112,37 @@ character units, use @code{posn-col-row} instead.
@end defun
@defun posn-string position
Return the string object in @var{position}, either @code{nil}, or a
cons cell @code{(@var{string} . @var{string-pos})}.
Return the string object described by @var{position}, either
@code{nil} (which means @var{position} describes buffer text), or a
cons cell @w{@code{(@var{string} . @var{string-pos})}}.
@end defun
@defun posn-image position
Return the image object in @var{position}, either @code{nil}, or an
image @code{(image ...)}.
Return the image object in @var{position}, either @code{nil} (if
there's no image at @var{position}), or an image spec @w{@code{(image
@dots{})}}.
@end defun
@defun posn-object position
Return the image or string object in @var{position}, either
@code{nil}, an image @code{(image ...)}, or a cons cell
@code{(@var{string} . @var{string-pos})}.
Return the image or string object described by @var{position}, either
@code{nil} (which means @var{position} describes buffer text), an
image @w{@code{(image @dots{})}}, or a cons cell
@w{@code{(@var{string} . @var{string-pos})}}.
@end defun
@defun posn-object-x-y position
Return the pixel-based x and y coordinates relative to the upper left
corner of the object in @var{position} as a cons cell @code{(@var{dx}
. @var{dy})}. If the @var{position} is on buffer text, return the
relative position of the buffer-text character closest to that
position.
corner of the object described by @var{position}, as a cons cell
@w{@code{(@var{dx} . @var{dy})}}. If the @var{position} describes
buffer text, return the relative coordinates of the buffer-text character
closest to that position.
@end defun
@defun posn-object-width-height position
Return the pixel width and height of the object in @var{position} as a
cons cell @code{(@var{width} . @var{height})}. If the @var{position}
is a buffer position, return the size of the character at that position.
Return the pixel width and height of the object described by
@var{position}, as a cons cell @code{(@var{width} . @var{height})}.
If the @var{position} describes a buffer position, return the size of
the character at that position.
@end defun
@cindex timestamp of a mouse event

View file

@ -1752,12 +1752,12 @@ default file permissions (see @code{set-default-file-modes} below), if
SELinux context are not copied over in either case.
@end deffn
@deffn Command make-symbolic-link target newname &optional ok-if-already-exists
@deffn Command make-symbolic-link target linkname &optional ok-if-already-exists
@pindex ln
@kindex file-already-exists
This command makes a symbolic link to @var{target}, named
@var{newname}. This is like the shell command @samp{ln -s
@var{target} @var{newname}}. The @var{target} argument
@var{linkname}. This is like the shell command @samp{ln -s
@var{target} @var{linkname}}. The @var{target} argument
is treated only as a string; it need not name an existing file.
If @var{ok-if-already-exists} is an integer, indicating interactive
use, then leading @samp{~} is expanded and leading @samp{/:} is
@ -1767,7 +1767,7 @@ If @var{target} is a relative file name, the resulting symbolic link
is interpreted relative to the directory containing the symbolic link.
@xref{Relative File Names}.
If both @var{target} and @var{newname} have remote file name syntax,
If both @var{target} and @var{linkname} have remote file name syntax,
and if both remote identifications are equal, the symbolic link points
to the local file name part of @var{target}.

View file

@ -2672,7 +2672,9 @@ See also `toggle-frame-maximized'."
(mapc (lambda (var)
;; Using symbol-function here tells the watcher machinery to
;; call the C function set-buffer-redisplay directly, thus
;; avoiding a potential GC.
;; avoiding a potential GC. This isn't strictly necessary,
;; but it's a nice way to exercise the direct subr-calling
;; machinery.
(add-variable-watcher var (symbol-function 'set-buffer-redisplay)))
'(line-spacing
overline-margin

View file

@ -614,6 +614,7 @@ Do \\[describe-key] on the following bindings to discover what they do.
(font-lock-syntactic-face-function
. sgml-font-lock-syntactic-face)))
(setq-local syntax-propertize-function #'sgml-syntax-propertize)
(setq-local syntax-ppss-table sgml-tag-syntax-table)
(setq-local facemenu-add-face-function 'sgml-mode-facemenu-add-face-function)
(setq-local sgml-xml-mode (sgml-xml-guess))
(unless sgml-xml-mode

View file

@ -2599,13 +2599,13 @@ This is what happens in interactive use with M-x. */)
DEFUN ("make-symbolic-link", Fmake_symbolic_link, Smake_symbolic_link, 2, 3,
"FMake symbolic link to file: \nGMake symbolic link to file %s: \np",
doc: /* Make a symbolic link to TARGET, named NEWNAME.
If NEWNAME is a directory name, make a like-named symbolic link under
NEWNAME.
doc: /* Make a symbolic link to TARGET, named LINKNAME.
If LINKNAME is a directory name, make a like-named symbolic link under
LINKNAME.
Signal a `file-already-exists' error if a file NEWNAME already exists
Signal a `file-already-exists' error if a file LINKNAME already exists
unless optional third argument OK-IF-ALREADY-EXISTS is non-nil.
An integer third arg means request confirmation if NEWNAME already
An integer third arg means request confirmation if LINKNAME already
exists, and expand leading "~" or strip leading "/:" in TARGET.
This happens for interactive use with M-x. */)
(Lisp_Object target, Lisp_Object linkname, Lisp_Object ok_if_already_exists)

View file

@ -152,7 +152,7 @@ get_boot_time (void)
mib[1] = KERN_BOOTTIME;
size = sizeof (boottime_val);
if (sysctl (mib, 2, &boottime_val, &size, NULL, 0) >= 0)
if (sysctl (mib, 2, &boottime_val, &size, NULL, 0) >= 0 && size != 0)
{
boot_time = boottime_val.tv_sec;
return boot_time;

View file

@ -3018,11 +3018,11 @@ list_system_processes (void)
Lisp_Object proclist = Qnil;
if (sysctl (mib, 3, NULL, &len, NULL, 0) != 0)
if (sysctl (mib, 3, NULL, &len, NULL, 0) != 0 || len == 0)
return proclist;
procs = xmalloc (len);
if (sysctl (mib, 3, procs, &len, NULL, 0) != 0)
if (sysctl (mib, 3, procs, &len, NULL, 0) != 0 || len == 0)
{
xfree (procs);
return proclist;
@ -3616,7 +3616,7 @@ system_process_attributes (Lisp_Object pid)
CONS_TO_INTEGER (pid, int, proc_id);
mib[3] = proc_id;
if (sysctl (mib, 4, &proc, &proclen, NULL, 0) != 0)
if (sysctl (mib, 4, &proc, &proclen, NULL, 0) != 0 || proclen == 0)
return attrs;
attrs = Fcons (Fcons (Qeuid, INT_TO_INTEGER (proc.ki_uid)), attrs);
@ -3739,7 +3739,7 @@ system_process_attributes (Lisp_Object pid)
mib[2] = KERN_PROC_ARGS;
len = MAXPATHLEN;
if (sysctl (mib, 4, args, &len, NULL, 0) == 0)
if (sysctl (mib, 4, args, &len, NULL, 0) == 0 && len != 0)
{
int i;
for (i = 0; i < len; i++)
@ -3785,7 +3785,7 @@ system_process_attributes (Lisp_Object pid)
CONS_TO_INTEGER (pid, int, proc_id);
mib[3] = proc_id;
if (sysctl (mib, 4, &proc, &proclen, NULL, 0) != 0)
if (sysctl (mib, 4, &proc, &proclen, NULL, 0) != 0 || proclen == 0)
return attrs;
uid = proc.kp_eproc.e_ucred.cr_uid;

View file

@ -134,6 +134,16 @@ default to `point-min' and `point-max' respectively."
(overlay-end overlay))))
(buffer-substring-no-properties (point-min) (point-max)))))
(defun python-virt-bin (&optional virt-root)
"Return the virtualenv bin dir, starting from VIRT-ROOT.
If nil, VIRT-ROOT defaults to `python-shell-virtualenv-root'.
The name of this directory depends on `system-type'."
(expand-file-name
(concat
(file-name-as-directory (or virt-root
python-shell-virtualenv-root))
(if (eq system-type 'windows-nt) "Scripts" "bin"))))
;;; Tests for your tests, so you can test while you test.
@ -2704,7 +2714,7 @@ if x:
(python-shell-virtualenv-root "/env")
(new-exec-path (python-shell-calculate-exec-path)))
(should (equal new-exec-path
(list (expand-file-name "/env/bin") "/path0")))))
(list (python-virt-bin) "/path0")))))
(ert-deftest python-shell-calculate-exec-path-3 ()
"Test complete `python-shell-virtualenv-root' modification."
@ -2713,7 +2723,7 @@ if x:
(python-shell-virtualenv-root "/env")
(new-exec-path (python-shell-calculate-exec-path)))
(should (equal new-exec-path
(list (expand-file-name "/env/bin")
(list (python-virt-bin)
"/path1" "/path2" "/path0")))))
(ert-deftest python-shell-calculate-exec-path-4 ()
@ -2724,7 +2734,7 @@ if x:
(python-shell-virtualenv-root "/env")
(new-exec-path (python-shell-calculate-exec-path)))
(should (equal new-exec-path
(list (expand-file-name "/env/bin")
(list (python-virt-bin)
"/path1" "/path2" "/path0")))))
(ert-deftest python-shell-calculate-exec-path-5 ()
@ -2754,7 +2764,7 @@ if x:
(python-shell-virtualenv-root "/env"))
(python-shell-with-environment
(should (equal exec-path
(list (expand-file-name "/env/bin")
(list (python-virt-bin)
"/path1" "/path2" "/path0")))
(should (not (getenv "PYTHONHOME")))
(should (string= (getenv "VIRTUAL_ENV") "/env")))
@ -2770,7 +2780,7 @@ if x:
(python-shell-virtualenv-root "/env"))
(python-shell-with-environment
(should (equal (python-shell-calculate-exec-path)
(list (expand-file-name "/env/bin")
(list (python-virt-bin)
"/path1" "/path2" "/remote1" "/remote2")))
(let ((process-environment (python-shell-calculate-process-environment)))
(should (not (getenv "PYTHONHOME")))

View file

@ -171,6 +171,8 @@ The point is set to the beginning of the buffer."
"<tag>c>'d</tag>"
"<t><!-- \" --></t>"
"<t><!-- ' --></t>"
"<t>(')</t>"
"<t>(\")</t>"
))
(with-temp-buffer
(sgml-mode)

View file

@ -86,7 +86,11 @@ only the name before the link arrow."
(let ((buf (find-file-noselect test-dir)))
(unwind-protect
(with-current-buffer buf
(make-symbolic-link "./bar/baz" link-name)
(skip-unless
;; This check is for wdired, not symbolic links, so skip
;; it when make-symbolic-link fails for any reason (like
;; insufficient privileges).
(ignore-errors (make-symbolic-link "./bar/baz" link-name) t))
(revert-buffer)
(let* ((file-name (dired-get-filename))
(dir-part (file-name-directory file-name))