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. milliseconds since a system-dependent initial time.
@item @var{object} @item @var{object}
Either @code{nil} if there is no string-type text property at the Either @code{nil}, which means the click occurred on buffer text, or a
click position, or a cons cell of the form (@var{string} cons cell of the form @w{(@var{string} . @var{string-pos})} if there
. @var{string-pos}) if there is one: is a string from a text property or an overlay at the click position.
@table @asis @table @asis
@item @var{string} @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. margin area and @var{row} is measured from the top of the margin area.
@item @var{image} @item @var{image}
This is the image object on which the click occurred. It is either If there is an image at the click location, this is the image object
@code{nil} if there is no image at the position clicked on, or it is as returned by @code{find-image} (@pxref{Defining Images}); otherwise
an image object as returned by @code{find-image} if click was in an image. this is @code{nil}.
@item @var{dx}, @var{dy} @item @var{dx}, @var{dy}
These are the pixel coordinates of the click, relative to These are the pixel coordinates of the click, relative to the top left
the top left corner of @var{object}, which is @code{(0 . 0)}. If corner of @var{object}, which is @code{(0 . 0)}. If @var{object} is
@var{object} is @code{nil}, the coordinates are relative to the top @code{nil}, which stands for a buffer, the coordinates are relative to
left corner of the character glyph clicked on. the top left corner of the character glyph clicked on.
@item @var{width}, @var{height} @item @var{width}, @var{height}
These are the pixel width and height of @var{object} or, if this is 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 @defun posnp object
This function returns non-@code{nil} if @var{object} is a mouse This function returns non-@code{nil} if @var{object} is a mouse
position list, in either of the formats documented in @ref{Click position list, in the format documented in @ref{Click Events}); and
Events}); and @code{nil} otherwise. @code{nil} otherwise.
@end defun @end defun
@cindex mouse position list, accessing @cindex mouse position list, accessing
@ -2064,8 +2064,8 @@ is undefined.
@defun posn-x-y position @defun posn-x-y position
Return the pixel-based x and y coordinates in @var{position}, as a Return the pixel-based x and y coordinates in @var{position}, as a
cons cell @code{(@var{x} . @var{y})}. These coordinates are relative cons cell @w{@code{(@var{x} . @var{y})}}. These coordinates are
to the window given by @code{posn-window}. relative to the window given by @code{posn-window}.
This example shows how to convert the window-relative coordinates in This example shows how to convert the window-relative coordinates in
the text area of a window into frame-relative coordinates: 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 @end defun
@defun posn-col-row position @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 containing the estimated column and row corresponding to buffer
position in @var{position}. The return value is given in units of the position described by @var{position}. The return value is given in
frame's default character width and default line height (including units of the frame's default character width and default line height
spacing), as computed from the @var{x} and @var{y} values (including spacing), as computed from the @var{x} and @var{y} values
corresponding to @var{position}. (So, if the actual characters have corresponding to @var{position}. (So, if the actual characters have
non-default sizes, the actual row and column may differ from these non-default sizes, the actual row and column may differ from these
computed values.) computed values.)
@ -2099,7 +2099,7 @@ Lines}), it is @emph{not} included in the @var{row} count.
@defun posn-actual-col-row position @defun posn-actual-col-row position
Return the actual row and column in @var{position}, as a cons cell 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 column numbers in the window given by @var{position}. @xref{Click
Events}, for details. The function returns @code{nil} if Events}, for details. The function returns @code{nil} if
@var{position} does not include actual position values; in that case @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 @end defun
@defun posn-string position @defun posn-string position
Return the string object in @var{position}, either @code{nil}, or a Return the string object described by @var{position}, either
cons cell @code{(@var{string} . @var{string-pos})}. @code{nil} (which means @var{position} describes buffer text), or a
cons cell @w{@code{(@var{string} . @var{string-pos})}}.
@end defun @end defun
@defun posn-image position @defun posn-image position
Return the image object in @var{position}, either @code{nil}, or an Return the image object in @var{position}, either @code{nil} (if
image @code{(image ...)}. there's no image at @var{position}), or an image spec @w{@code{(image
@dots{})}}.
@end defun @end defun
@defun posn-object position @defun posn-object position
Return the image or string object in @var{position}, either Return the image or string object described by @var{position}, either
@code{nil}, an image @code{(image ...)}, or a cons cell @code{nil} (which means @var{position} describes buffer text), an
@code{(@var{string} . @var{string-pos})}. image @w{@code{(image @dots{})}}, or a cons cell
@w{@code{(@var{string} . @var{string-pos})}}.
@end defun @end defun
@defun posn-object-x-y position @defun posn-object-x-y position
Return the pixel-based x and y coordinates relative to the upper left 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} corner of the object described by @var{position}, as a cons cell
. @var{dy})}. If the @var{position} is on buffer text, return the @w{@code{(@var{dx} . @var{dy})}}. If the @var{position} describes
relative position of the buffer-text character closest to that buffer text, return the relative coordinates of the buffer-text character
position. closest to that position.
@end defun @end defun
@defun posn-object-width-height position @defun posn-object-width-height position
Return the pixel width and height of the object in @var{position} as a Return the pixel width and height of the object described by
cons cell @code{(@var{width} . @var{height})}. If the @var{position} @var{position}, as a cons cell @code{(@var{width} . @var{height})}.
is a buffer position, return the size of the character at that position. If the @var{position} describes a buffer position, return the size of
the character at that position.
@end defun @end defun
@cindex timestamp of a mouse event @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. SELinux context are not copied over in either case.
@end deffn @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 @pindex ln
@kindex file-already-exists @kindex file-already-exists
This command makes a symbolic link to @var{target}, named This command makes a symbolic link to @var{target}, named
@var{newname}. This is like the shell command @samp{ln -s @var{linkname}. This is like the shell command @samp{ln -s
@var{target} @var{newname}}. The @var{target} argument @var{target} @var{linkname}}. The @var{target} argument
is treated only as a string; it need not name an existing file. is treated only as a string; it need not name an existing file.
If @var{ok-if-already-exists} is an integer, indicating interactive If @var{ok-if-already-exists} is an integer, indicating interactive
use, then leading @samp{~} is expanded and leading @samp{/:} is 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. is interpreted relative to the directory containing the symbolic link.
@xref{Relative File Names}. @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 and if both remote identifications are equal, the symbolic link points
to the local file name part of @var{target}. to the local file name part of @var{target}.

View file

@ -2672,7 +2672,9 @@ See also `toggle-frame-maximized'."
(mapc (lambda (var) (mapc (lambda (var)
;; Using symbol-function here tells the watcher machinery to ;; Using symbol-function here tells the watcher machinery to
;; call the C function set-buffer-redisplay directly, thus ;; 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))) (add-variable-watcher var (symbol-function 'set-buffer-redisplay)))
'(line-spacing '(line-spacing
overline-margin 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 (font-lock-syntactic-face-function
. sgml-font-lock-syntactic-face))) . sgml-font-lock-syntactic-face)))
(setq-local syntax-propertize-function #'sgml-syntax-propertize) (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 facemenu-add-face-function 'sgml-mode-facemenu-add-face-function)
(setq-local sgml-xml-mode (sgml-xml-guess)) (setq-local sgml-xml-mode (sgml-xml-guess))
(unless sgml-xml-mode (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, DEFUN ("make-symbolic-link", Fmake_symbolic_link, Smake_symbolic_link, 2, 3,
"FMake symbolic link to file: \nGMake symbolic link to file %s: \np", "FMake symbolic link to file: \nGMake symbolic link to file %s: \np",
doc: /* Make a symbolic link to TARGET, named NEWNAME. doc: /* Make a symbolic link to TARGET, named LINKNAME.
If NEWNAME is a directory name, make a like-named symbolic link under If LINKNAME is a directory name, make a like-named symbolic link under
NEWNAME. 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. 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. exists, and expand leading "~" or strip leading "/:" in TARGET.
This happens for interactive use with M-x. */) This happens for interactive use with M-x. */)
(Lisp_Object target, Lisp_Object linkname, Lisp_Object ok_if_already_exists) (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; mib[1] = KERN_BOOTTIME;
size = sizeof (boottime_val); 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; boot_time = boottime_val.tv_sec;
return boot_time; return boot_time;

View file

@ -3018,11 +3018,11 @@ list_system_processes (void)
Lisp_Object proclist = Qnil; 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; return proclist;
procs = xmalloc (len); 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); xfree (procs);
return proclist; return proclist;
@ -3616,7 +3616,7 @@ system_process_attributes (Lisp_Object pid)
CONS_TO_INTEGER (pid, int, proc_id); CONS_TO_INTEGER (pid, int, proc_id);
mib[3] = 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; return attrs;
attrs = Fcons (Fcons (Qeuid, INT_TO_INTEGER (proc.ki_uid)), 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; mib[2] = KERN_PROC_ARGS;
len = MAXPATHLEN; len = MAXPATHLEN;
if (sysctl (mib, 4, args, &len, NULL, 0) == 0) if (sysctl (mib, 4, args, &len, NULL, 0) == 0 && len != 0)
{ {
int i; int i;
for (i = 0; i < len; i++) for (i = 0; i < len; i++)
@ -3785,7 +3785,7 @@ system_process_attributes (Lisp_Object pid)
CONS_TO_INTEGER (pid, int, proc_id); CONS_TO_INTEGER (pid, int, proc_id);
mib[3] = 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; return attrs;
uid = proc.kp_eproc.e_ucred.cr_uid; 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)))) (overlay-end overlay))))
(buffer-substring-no-properties (point-min) (point-max))))) (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. ;;; Tests for your tests, so you can test while you test.
@ -2704,7 +2714,7 @@ if x:
(python-shell-virtualenv-root "/env") (python-shell-virtualenv-root "/env")
(new-exec-path (python-shell-calculate-exec-path))) (new-exec-path (python-shell-calculate-exec-path)))
(should (equal new-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 () (ert-deftest python-shell-calculate-exec-path-3 ()
"Test complete `python-shell-virtualenv-root' modification." "Test complete `python-shell-virtualenv-root' modification."
@ -2713,7 +2723,7 @@ if x:
(python-shell-virtualenv-root "/env") (python-shell-virtualenv-root "/env")
(new-exec-path (python-shell-calculate-exec-path))) (new-exec-path (python-shell-calculate-exec-path)))
(should (equal new-exec-path (should (equal new-exec-path
(list (expand-file-name "/env/bin") (list (python-virt-bin)
"/path1" "/path2" "/path0"))))) "/path1" "/path2" "/path0")))))
(ert-deftest python-shell-calculate-exec-path-4 () (ert-deftest python-shell-calculate-exec-path-4 ()
@ -2724,7 +2734,7 @@ if x:
(python-shell-virtualenv-root "/env") (python-shell-virtualenv-root "/env")
(new-exec-path (python-shell-calculate-exec-path))) (new-exec-path (python-shell-calculate-exec-path)))
(should (equal new-exec-path (should (equal new-exec-path
(list (expand-file-name "/env/bin") (list (python-virt-bin)
"/path1" "/path2" "/path0"))))) "/path1" "/path2" "/path0")))))
(ert-deftest python-shell-calculate-exec-path-5 () (ert-deftest python-shell-calculate-exec-path-5 ()
@ -2754,7 +2764,7 @@ if x:
(python-shell-virtualenv-root "/env")) (python-shell-virtualenv-root "/env"))
(python-shell-with-environment (python-shell-with-environment
(should (equal exec-path (should (equal exec-path
(list (expand-file-name "/env/bin") (list (python-virt-bin)
"/path1" "/path2" "/path0"))) "/path1" "/path2" "/path0")))
(should (not (getenv "PYTHONHOME"))) (should (not (getenv "PYTHONHOME")))
(should (string= (getenv "VIRTUAL_ENV") "/env"))) (should (string= (getenv "VIRTUAL_ENV") "/env")))
@ -2770,7 +2780,7 @@ if x:
(python-shell-virtualenv-root "/env")) (python-shell-virtualenv-root "/env"))
(python-shell-with-environment (python-shell-with-environment
(should (equal (python-shell-calculate-exec-path) (should (equal (python-shell-calculate-exec-path)
(list (expand-file-name "/env/bin") (list (python-virt-bin)
"/path1" "/path2" "/remote1" "/remote2"))) "/path1" "/path2" "/remote1" "/remote2")))
(let ((process-environment (python-shell-calculate-process-environment))) (let ((process-environment (python-shell-calculate-process-environment)))
(should (not (getenv "PYTHONHOME"))) (should (not (getenv "PYTHONHOME")))

View file

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

View file

@ -86,7 +86,11 @@ only the name before the link arrow."
(let ((buf (find-file-noselect test-dir))) (let ((buf (find-file-noselect test-dir)))
(unwind-protect (unwind-protect
(with-current-buffer buf (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) (revert-buffer)
(let* ((file-name (dired-get-filename)) (let* ((file-name (dired-get-filename))
(dir-part (file-name-directory file-name)) (dir-part (file-name-directory file-name))