emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 9552ee4 6/6: Merge from emacs-26


From: Noam Postavsky
Subject: [Emacs-diffs] master 9552ee4 6/6: Merge from emacs-26
Date: Tue, 25 Jun 2019 22:06:54 -0400 (EDT)

branch: master
commit 9552ee4df7d2ceebb8728a61d00598aa981b580c
Merge: c7a59d8 e62ad04
Author: Noam Postavsky <address@hidden>
Commit: Noam Postavsky <address@hidden>

    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
---
 doc/lispref/commands.texi              | 70 ++++++++++++++++++----------------
 doc/lispref/files.texi                 |  8 ++--
 lisp/frame.el                          |  4 +-
 lisp/textmodes/sgml-mode.el            |  1 +
 src/fileio.c                           | 10 ++---
 src/filelock.c                         |  2 +-
 src/sysdep.c                           | 10 ++---
 test/lisp/progmodes/python-tests.el    | 20 +++++++---
 test/lisp/textmodes/sgml-mode-tests.el |  2 +
 test/lisp/wdired-tests.el              |  6 ++-
 10 files changed, 78 insertions(+), 55 deletions(-)

diff --git a/doc/lispref/commands.texi b/doc/lispref/commands.texi
index 5ea0be2..c0df944 100644
--- a/doc/lispref/commands.texi
+++ b/doc/lispref/commands.texi
@@ -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
diff --git a/doc/lispref/files.texi b/doc/lispref/files.texi
index af16b1c..66678d3 100644
--- a/doc/lispref/files.texi
+++ b/doc/lispref/files.texi
@@ -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}.
 
diff --git a/lisp/frame.el b/lisp/frame.el
index 7b61003..9402c15 100644
--- a/lisp/frame.el
+++ b/lisp/frame.el
@@ -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
diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el
index 8d3000e..aa00024 100644
--- a/lisp/textmodes/sgml-mode.el
+++ b/lisp/textmodes/sgml-mode.el
@@ -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
diff --git a/src/fileio.c b/src/fileio.c
index 5dd14da..0da9894 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -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)
diff --git a/src/filelock.c b/src/filelock.c
index baf87b7..b1f7d9d 100644
--- a/src/filelock.c
+++ b/src/filelock.c
@@ -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;
diff --git a/src/sysdep.c b/src/sysdep.c
index f7fc99f..4f89e8a 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -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;
diff --git a/test/lisp/progmodes/python-tests.el 
b/test/lisp/progmodes/python-tests.el
index 87cee18..b1cf7e8 100644
--- a/test/lisp/progmodes/python-tests.el
+++ b/test/lisp/progmodes/python-tests.el
@@ -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")))
diff --git a/test/lisp/textmodes/sgml-mode-tests.el 
b/test/lisp/textmodes/sgml-mode-tests.el
index 34d2648..5630036 100644
--- a/test/lisp/textmodes/sgml-mode-tests.el
+++ b/test/lisp/textmodes/sgml-mode-tests.el
@@ -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)
diff --git a/test/lisp/wdired-tests.el b/test/lisp/wdired-tests.el
index 9682843..6db2e03 100644
--- a/test/lisp/wdired-tests.el
+++ b/test/lisp/wdired-tests.el
@@ -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))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]