emacs-diffs
[Top][All Lists]
Advanced

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

master bffd5d3 4/4: Merge branch 'master' of git.savannah.gnu.org:/srv/g


From: Eli Zaretskii
Subject: master bffd5d3 4/4: Merge branch 'master' of git.savannah.gnu.org:/srv/git/emacs
Date: Mon, 9 Nov 2020 09:57:15 -0500 (EST)

branch: master
commit bffd5d3a9d44ed99d6a573dc0fabe542d6b3bb8b
Merge: b83e31b 18a7267
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>

    Merge branch 'master' of git.savannah.gnu.org:/srv/git/emacs
---
 etc/NEWS                                           |   5 +
 lisp/gnus/gnus-group.el                            |   8 ++
 lisp/gnus/gnus-search.el                           |  55 ++++++-----
 lisp/progmodes/cperl-mode.el                       |   1 +
 lisp/progmodes/project.el                          |   4 +-
 lisp/term/ns-win.el                                |   5 +-
 src/image.c                                        | 102 ++++++++++++++++++++-
 src/nsterm.m                                       |   4 +-
 src/xwidget.c                                      |  10 ++
 .../cperl-mode-resources/cperl-bug-19709.pl        |  25 +++++
 .../cperl-mode-resources/cperl-indent-styles.pl    |  10 ++
 test/lisp/progmodes/cperl-mode-tests.el            |  38 ++++++++
 test/src/keymap-tests.el                           |   4 -
 13 files changed, 235 insertions(+), 36 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index 8b5acaf..68a4aac 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1957,6 +1957,11 @@ image API via 'M-x report-emacs-bug'.
 ---
 ** The user option 'make-pointer-invisible' is now honored on macOS.
 
+--
+** On macOS, 's-<left>' and 's-<right>' are now bound to
+'move-beginning-of-line' and 'move-end-of-line' respectively. The commands
+to select previous/next frame are still bound to 's-~' and 's-`'.
+
 
 ----------------------------------------------------------------------
 This file is part of GNU Emacs.
diff --git a/lisp/gnus/gnus-group.el b/lisp/gnus/gnus-group.el
index 9db0e18..c8b97c0 100644
--- a/lisp/gnus/gnus-group.el
+++ b/lisp/gnus/gnus-group.el
@@ -3201,6 +3201,10 @@ non-nil SPECS arg must be an alist with 
`search-query-spec' and
               (cdr (assq 'search-query-spec specs))
               (cdr (assq 'nnir-query-spec specs))
               (gnus-search-make-spec no-parse))))
+       ;; If our query came via an old call to nnir, we know not to
+       ;; parse the query.
+       (when (assq 'nnir-query-spec specs)
+         (setf (alist-get 'raw query-spec) t))
        (gnus-group-make-group
         name
         (list 'nnselect "nnselect")
@@ -3245,6 +3249,10 @@ non-nil SPECS arg must be an alist with 
`search-query-spec' and
          (or (cdr (assq 'search-query-spec specs))
              (cdr (assq 'nnir-query-spec specs))
              (gnus-search-make-spec no-parse))))
+    ;; If our query came via an old call to nnir, we know not to parse
+    ;; the query.
+    (when (assq 'nnir-query-spec specs)
+      (setf (alist-get 'raw query-spec) t))
     (gnus-group-read-ephemeral-group
      (concat "nnselect-" (message-unique-id))
      (list 'nnselect "nnselect")
diff --git a/lisp/gnus/gnus-search.el b/lisp/gnus/gnus-search.el
index abee7c4..8b71daa 100644
--- a/lisp/gnus/gnus-search.el
+++ b/lisp/gnus/gnus-search.el
@@ -962,12 +962,18 @@ Responsible for handling and, or, and parenthetical 
expressions.")
 
 (cl-defmethod gnus-search-make-query-string ((engine gnus-search-engine)
                                             query-spec)
-  (if (and gnus-search-use-parsed-queries
-          (null (alist-get 'raw query-spec))
-          (null (slot-value engine 'raw-queries-p)))
-      (gnus-search-transform
-       engine (alist-get 'parsed-query query-spec))
-    (alist-get 'query query-spec)))
+  (let ((parsed-query (alist-get 'parsed-query query-spec))
+       (raw-query (alist-get 'query query-spec)))
+    (if (and gnus-search-use-parsed-queries
+            (null (alist-get 'raw query-spec))
+            (null (slot-value engine 'raw-queries-p))
+            parsed-query)
+       (gnus-search-transform engine parsed-query)
+      (if (listp raw-query)
+         ;; Some callers are sending this in as (query "query"), not
+         ;; as a cons cell?
+         (car raw-query)
+       raw-query))))
 
 (defsubst gnus-search-single-p (query)
   "Return t if QUERY is a search for a single message."
@@ -1108,7 +1114,7 @@ Other capabilities could be tested here."
 ;; TODO: Don't exclude booleans and date keys, just check for them
 ;; before checking for general keywords.
 (defvar gnus-search-imap-search-keys
-  '(body cc bcc from header keyword larger smaller subject text to uid)
+  '(body cc bcc from header keyword larger smaller subject text to uid 
x-gm-raw)
   "Known IMAP search keys, excluding booleans and date keys.")
 
 (cl-defmethod gnus-search-transform ((_ gnus-search-imap)
@@ -1952,7 +1958,8 @@ remaining string, then adds all that to the top-level 
spec."
        (setq query
              (string-trim (replace-match "" t t query 0)))
        (setf (alist-get 'query query-spec) query)))
-    (when gnus-search-use-parsed-queries
+    (when (and gnus-search-use-parsed-queries
+              (null (alist-get 'raw query-spec)))
       (setf (alist-get 'parsed-query query-spec)
            (gnus-search-parse-query query)))
     query-spec))
@@ -1963,25 +1970,29 @@ remaining string, then adds all that to the top-level 
spec."
 (defun gnus-search-server-to-engine (srv)
   (let* ((method (gnus-server-to-method srv))
         (engine-config (assoc 'gnus-search-engine (cddr method)))
-        (server
-         (or (nth 1 engine-config)
-             (cdr-safe (assoc (car method) gnus-search-default-engines))
-             (when-let ((old (assoc 'nnir-search-engine
-                                    (cddr method))))
-               (nnheader-message
-                8 "\"nnir-search-engine\" is no longer a valid parameter")
-               (pcase (nth 1 old)
-                 ('notmuch 'gnus-search-notmuch)
-                 ('namazu 'gnus-search-namazu)
-                 ('find-grep 'gnus-search-find-grep)))))
-        (inst
+        (server (or (nth 1 engine-config)
+                    (cdr-safe (assoc (car method) gnus-search-default-engines))
+                    (when-let ((old (assoc 'nnir-search-engine
+                                           (cddr method))))
+                      (nnheader-message
+                       8 "\"nnir-search-engine\" is no longer a valid 
parameter")
+                      (nth 1 old))))
+        inst)
+    (setq server
+         (pcase server
+           ('notmuch 'gnus-search-notmuch)
+           ('namazu 'gnus-search-namazu)
+           ('find-grep 'gnus-search-find-grep)
+           ('imap 'gnus-search-imap)
+           (_ server))
+         inst
          (cond
           ((null server) nil)
           ((eieio-object-p server)
            server)
           ((class-p server)
            (make-instance server))
-          (t nil))))
+          (t nil)))
     (if inst
        (when (cddr engine-config)
          ;; We're not being completely backward-compatible here,
@@ -1994,7 +2005,7 @@ remaining string, then adds all that to the top-level 
spec."
               (nnheader-message
                5 "Invalid search engine parameter: (%s %s)"
                key value)))))
-      (error "No search engine defined for %S" method))
+      (error "No search engine defined for %s" srv))
     inst))
 
 (declare-function gnus-registry-get-id-key "gnus-registry" (id key))
diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el
index 6178cdf..d5b3002 100644
--- a/lisp/progmodes/cperl-mode.el
+++ b/lisp/progmodes/cperl-mode.el
@@ -5983,6 +5983,7 @@ else
      (cperl-continued-brace-offset     .  0)
      (cperl-label-offset               . -2)
      (cperl-continued-statement-offset .  4)
+     (cperl-close-paren-offset         . -4)
      (cperl-extra-newline-before-brace .  nil)
      (cperl-extra-newline-before-brace-multiline .  nil)
      (cperl-merge-trailing-else        .  nil)
diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index 6c647a0..a648618 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -1160,7 +1160,9 @@ With some possible metadata (to be decided).")
   (let ((filename project-list-file))
     (with-temp-buffer
       (insert ";;; -*- lisp-data -*-\n")
-      (pp project--list (current-buffer))
+      (let ((print-length nil)
+            (print-level nil))
+        (pp project--list (current-buffer)))
       (write-region nil nil filename nil 'silent))))
 
 ;;;###autoload
diff --git a/lisp/term/ns-win.el b/lisp/term/ns-win.el
index cc7a376..8273c06 100644
--- a/lisp/term/ns-win.el
+++ b/lisp/term/ns-win.el
@@ -148,9 +148,8 @@ The properties returned may include `top', `left', 
`height', and `width'."
 (define-key global-map [?\s-|] 'shell-command-on-region)
 (define-key global-map [s-kp-bar] 'shell-command-on-region)
 (define-key global-map [?\C-\s- ] 'ns-do-show-character-palette)
-;; (as in Terminal.app)
-(define-key global-map [s-right] 'ns-next-frame)
-(define-key global-map [s-left] 'ns-prev-frame)
+(define-key global-map [s-right] 'move-end-of-line)
+(define-key global-map [s-left] 'move-beginning-of-line)
 
 (define-key global-map [home] 'beginning-of-buffer)
 (define-key global-map [end] 'end-of-buffer)
diff --git a/src/image.c b/src/image.c
index c857b8e..b4cb1b7 100644
--- a/src/image.c
+++ b/src/image.c
@@ -9545,6 +9545,9 @@ DEF_DLL_FN (gboolean, rsvg_handle_close, (RsvgHandle *, 
GError **));
 #endif
 
 #if LIBRSVG_CHECK_VERSION (2, 46, 0)
+DEF_DLL_FN (void, rsvg_handle_get_intrinsic_dimensions,
+            RsvgHandle *, gboolean *, RsvgLength *, gboolean *,
+            RsvgLength *, gboolean *, RsvgRectangle *));
 DEF_DLL_FN (gboolean, rsvg_handle_get_geometry_for_layer,
            (RsvgHandle *, const char *, const RsvgRectangle *,
             RsvgRectangle *, RsvgRectangle *, GError **));
@@ -9599,6 +9602,7 @@ init_svg_functions (void)
   LOAD_DLL_FN (library, rsvg_handle_close);
 #endif
 #if LIBRSVG_CHECK_VERSION (2, 46, 0)
+  LOAD_DLL_FN (library, rsvg_handle_get_intrinsic_dimensions);
   LOAD_DLL_FN (library, rsvg_handle_get_geometry_for_layer);
 #else
   LOAD_DLL_FN (library, rsvg_handle_get_dimensions);
@@ -9742,6 +9746,44 @@ svg_load (struct frame *f, struct image *img)
   return success_p;
 }
 
+static double
+svg_css_length_to_pixels (RsvgLength length)
+{
+  /* FIXME: 96 appears to be a pretty standard DPI but we should
+     probably use the real DPI if we can get it.  */
+  double dpi = 96;
+  double value = length.length;
+
+  switch (length.unit)
+    {
+    case RSVG_UNIT_PX:
+      /* Already a pixel value.  */
+      break;
+    case RSVG_UNIT_CM:
+      /* 2.54 cm in an inch.  */
+      value = dpi * value / 2.54;
+    case RSVG_UNIT_MM:
+      /* 25.4 mm in an inch.  */
+      value = dpi * value / 25.4;
+      break;
+    case RSVG_UNIT_PT:
+      /* 72 points in an inch.  */
+      value = dpi * value / 72;
+    case RSVG_UNIT_PC:
+      /* 6 picas in an inch.  */
+      value = dpi * value / 6;
+    case RSVG_UNIT_IN:
+      value *= dpi;
+      break;
+    default:
+      /* Probably one of em, ex, or %.  We can't know what the pixel
+         value is without more information.  */
+      value = 0;
+    }
+
+  return value;
+}
+
 /* Load frame F and image IMG.  CONTENTS contains the SVG XML data to
    be parsed, SIZE is its size, and FILENAME is the name of the SVG
    file being loaded.
@@ -9810,11 +9852,48 @@ svg_load_image (struct frame *f, struct image *img, 
char *contents,
 #if LIBRSVG_CHECK_VERSION (2, 46, 0)
   RsvgRectangle zero_rect, viewbox, out_logical_rect;
 
-  rsvg_handle_get_geometry_for_layer (rsvg_handle, NULL,
-                                      &zero_rect, &viewbox,
-                                      &out_logical_rect, NULL);
-  viewbox_width = viewbox.x + viewbox.width;
-  viewbox_height = viewbox.y + viewbox.height;
+  /* Try the instrinsic dimensions first.  */
+  gboolean has_width, has_height, has_viewbox;
+  RsvgLength iwidth, iheight;
+
+  rsvg_handle_get_intrinsic_dimensions (rsvg_handle,
+                                        &has_width, &iwidth,
+                                        &has_height, &iheight,
+                                        &has_viewbox, &viewbox);
+
+  if (has_width && has_height)
+    {
+      /* Success!  We can use these values directly.  */
+      viewbox_width = svg_css_length_to_pixels (iwidth);
+      viewbox_height = svg_css_length_to_pixels (iheight);
+    }
+  else if (has_width && has_viewbox)
+    {
+      viewbox_width = svg_css_length_to_pixels (iwidth);
+      viewbox_height = svg_css_length_to_pixels (iwidth)
+        * viewbox.width / viewbox.height;
+    }
+  else if (has_height && has_viewbox)
+    {
+      viewbox_height = svg_css_length_to_pixels (iheight);
+      viewbox_width = svg_css_length_to_pixels (iheight)
+        * viewbox.height / viewbox.width;
+    }
+  else if (has_viewbox)
+    {
+      viewbox_width = viewbox.width;
+      viewbox_height = viewbox.height;
+    }
+  else
+    {
+      /* We haven't found a useable set of sizes, so try working out
+         the visible area.  */
+      rsvg_handle_get_geometry_for_layer (rsvg_handle, NULL,
+                                          &zero_rect, &viewbox,
+                                          &out_logical_rect, NULL);
+      viewbox_width = viewbox.x + viewbox.width;
+      viewbox_height = viewbox.y + viewbox.height;
+    }
 #else
   /* The function used above to get the geometry of the visible area
      of the SVG are only available in librsvg 2.46 and above, so in
@@ -9827,6 +9906,19 @@ svg_load_image (struct frame *f, struct image *img, char 
*contents,
   viewbox_width = dimension_data.width;
   viewbox_height = dimension_data.height;
 #endif
+
+  if (viewbox_width == 0 || viewbox_height == 0)
+    {
+      /* We do not have any usable dimensions, so make some up.  The
+         values below are supposedly the default values most web
+         browsers use for SVGs with no set size.  */
+      /* FIXME: At this stage we should perhaps consider rendering the
+         image out to a bitmap and getting the dimensions from
+         that.  */
+      viewbox_width = 300;
+      viewbox_height = 150;
+    }
+
   compute_image_size (viewbox_width, viewbox_height, img->spec,
                       &width, &height);
 
diff --git a/src/nsterm.m b/src/nsterm.m
index fa38350..4fad521 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -1782,6 +1782,8 @@ ns_destroy_window (struct frame *f)
 {
   NSTRACE ("ns_destroy_window");
 
+  check_window_system (f);
+
   /* If this frame has a parent window, detach it as not doing so can
      cause a crash in GNUStep.  */
   if (FRAME_PARENT_FRAME (f) != NULL)
@@ -1792,7 +1794,7 @@ ns_destroy_window (struct frame *f)
       [parent removeChildWindow: child];
     }
 
-  check_window_system (f);
+  [[FRAME_NS_VIEW (f) window] close];
   ns_free_frame_resources (f);
   ns_window_num--;
 }
diff --git a/src/xwidget.c b/src/xwidget.c
index 031975f..e078a28 100644
--- a/src/xwidget.c
+++ b/src/xwidget.c
@@ -128,6 +128,16 @@ Returns the newly constructed xwidget, or nil if 
construction fails.  */)
       if (EQ (xw->type, Qwebkit))
         {
           xw->widget_osr = webkit_web_view_new ();
+
+          /* webkitgtk uses GSubprocess which sets sigaction causing
+             Emacs to not catch SIGCHLD with its usual handle setup in
+             catch_child_signal().  This resets the SIGCHLD
+             sigaction.  */
+          struct sigaction old_action;
+          sigaction (SIGCHLD, NULL, &old_action);
+          webkit_web_view_load_uri(WEBKIT_WEB_VIEW (xw->widget_osr),
+                                   "about:blank");
+          sigaction (SIGCHLD, &old_action, NULL);
         }
 
       gtk_widget_set_size_request (GTK_WIDGET (xw->widget_osr), xw->width,
diff --git a/test/lisp/progmodes/cperl-mode-resources/cperl-bug-19709.pl 
b/test/lisp/progmodes/cperl-mode-resources/cperl-bug-19709.pl
new file mode 100644
index 0000000..f7c51a2
--- /dev/null
+++ b/test/lisp/progmodes/cperl-mode-resources/cperl-bug-19709.pl
@@ -0,0 +1,25 @@
+# -------- bug#19709: input --------
+my $a = func1(
+    Module::test()
+  );
+
+my $b = func2(
+    test()
+);
+
+my $c = func3(
+    Module::test(),
+);
+# -------- bug#19709: expected output --------
+my $a = func1(
+    Module::test()
+);
+
+my $b = func2(
+    test()
+);
+
+my $c = func3(
+    Module::test(),
+);
+# -------- bug#19709: end --------
diff --git a/test/lisp/progmodes/cperl-mode-resources/cperl-indent-styles.pl 
b/test/lisp/progmodes/cperl-mode-resources/cperl-indent-styles.pl
index 0832f86..371b19b 100644
--- a/test/lisp/progmodes/cperl-mode-resources/cperl-indent-styles.pl
+++ b/test/lisp/progmodes/cperl-mode-resources/cperl-indent-styles.pl
@@ -42,3 +42,13 @@ die "This world is backwards";
     }
 }
 # -------- PBP uncuddle else: end --------
+
+# -------- PBP closing paren offset: input --------
+my $a = func1(
+    Module::test()
+  );
+# -------- PBP closing paren offset: expected output --------
+my $a = func1(
+    Module::test()
+);
+# -------- PBP closing paren offset: end --------
diff --git a/test/lisp/progmodes/cperl-mode-tests.el 
b/test/lisp/progmodes/cperl-mode-tests.el
index effebc8..bd8a1a9 100644
--- a/test/lisp/progmodes/cperl-mode-tests.el
+++ b/test/lisp/progmodes/cperl-mode-tests.el
@@ -249,6 +249,44 @@ Perl is not Lisp: An open paren in column 0 does not start 
a function."
             (setq got (concat "test case " name ":\n" (buffer-string)))
             (should (equal got expected))))))))
 
+(ert-deftest cperl-bug19709 ()
+  "Verify that indentation of closing paren works as intended.
+Note that Perl mode has no setting for close paren offset, per
+documentation it does the right thing anyway."
+  (let ((file (ert-resource-file "cperl-bug-19709.pl")))
+    (with-temp-buffer
+      (insert-file-contents file)
+      (goto-char (point-min))
+      (while (re-search-forward
+              (concat "^# ?-+ \\_<\\(?1:.+?\\)\\_>: input ?-+\n"
+                      "\\(?2:\\(?:.*\n\\)+?\\)"
+                      "# ?-+ \\1: expected output ?-+\n"
+                      "\\(?3:\\(?:.*\n\\)+?\\)"
+                      "# ?-+ \\1: end ?-+")
+              nil t)
+        (let ((name (match-string 1))
+              (code (match-string 2))
+              (expected (match-string 3))
+              got)
+          (with-temp-buffer
+            (insert code)
+           (funcall cperl-test-mode)
+            (setq-local
+             ;; settings from the bug report
+             cperl-indent-level 4
+             cperl-indent-parens-as-block t
+             cperl-close-paren-offset -4
+             ;; same, adapted for per-mode
+             perl-indent-level 4
+             perl-indent-parens-as-block t)
+            (goto-char (point-min))
+            (while (null (eobp))
+              (cperl-indent-command)
+              (next-line))
+            (setq expected (concat "test case " name ":\n" expected))
+            (setq got (concat "test case " name ":\n" (buffer-string)))
+            (should (equal got expected))))))))
+
 (ert-deftest cperl-bug37127 ()
   "Verify that closing a paren in a regex goes without a message.
 Also check that the message is issued if the regex terminator is
diff --git a/test/src/keymap-tests.el b/test/src/keymap-tests.el
index 8331a41..e3dd842 100644
--- a/test/src/keymap-tests.el
+++ b/test/src/keymap-tests.el
@@ -48,10 +48,6 @@
     (set-keymap-parent map help-mode-map)
     (should (equal (keymap-parent map) help-mode-map))))
 
-(ert-deftest keymap-keymap-set-parent/returns-parent ()
-  (let ((map (make-keymap)))
-    (should (equal (set-keymap-parent map help-mode-map) help-mode-map))))
-
 (ert-deftest keymap-copy-keymap/is-equal ()
   (should (equal (copy-keymap help-mode-map) help-mode-map)))
 



reply via email to

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