emacs-diffs
[Top][All Lists]
Advanced

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

master 2c2688f 2/2: Merge branch 'master' of git.sv.gnu.org:/srv/git/ema


From: Michael Albinus
Subject: master 2c2688f 2/2: Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs
Date: Mon, 27 Sep 2021 08:29:08 -0400 (EDT)

branch: master
commit 2c2688ffbfce99dee56d6d89740dfbcfe6103219
Merge: 3ad1bca dc12ad8
Author: Michael Albinus <michael.albinus@gmx.de>
Commit: Michael Albinus <michael.albinus@gmx.de>

    Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs
---
 admin/charsets/mapfiles/CP720.map          |  2 +-
 admin/charsets/mapfiles/CP858.map          |  2 +-
 admin/unidata/blocks.awk                   |  6 +++
 doc/lispref/symbols.texi                   |  2 +-
 doc/misc/efaq.texi                         |  2 +-
 etc/NEWS                                   | 26 +++++++++---
 etc/PROBLEMS                               |  4 +-
 lisp/ChangeLog.15                          |  2 +-
 lisp/emacs-lisp/cl-macs.el                 |  8 ++--
 lisp/international/titdic-cnv.el           |  8 ++--
 lisp/term/w32-win.el                       |  8 +++-
 msdos/autogen/config.in                    |  2 +-
 nt/ChangeLog.1                             |  2 +-
 src/composite.c                            | 13 +++---
 src/font.c                                 | 27 +++++++++++-
 src/font.h                                 |  2 +-
 src/nsmenu.m                               | 35 +++++++++------
 src/nsterm.h                               |  7 ++-
 src/nsterm.m                               | 68 ++++++++++++++++--------------
 src/w16select.c                            |  2 +-
 test/lisp/subr-tests.el                    | 12 ++++++
 test/src/comp-resources/comp-test-funcs.el |  3 +-
 test/src/comp-tests.el                     |  4 +-
 23 files changed, 164 insertions(+), 83 deletions(-)

diff --git a/admin/charsets/mapfiles/CP720.map 
b/admin/charsets/mapfiles/CP720.map
index e27deac..0e95b5d 100644
--- a/admin/charsets/mapfiles/CP720.map
+++ b/admin/charsets/mapfiles/CP720.map
@@ -1,4 +1,4 @@
-# Created manually from <http://en.wikipedia.org/wiki/Code_page_720>.
+# Created manually from <https://en.wikipedia.org/wiki/Code_page_720>.
 # The text in that page is available under the terms of the GNU Free
 # Documentation License.
 0x00-0x7F 0x0000
diff --git a/admin/charsets/mapfiles/CP858.map 
b/admin/charsets/mapfiles/CP858.map
index 753dc50..d5a59b2 100644
--- a/admin/charsets/mapfiles/CP858.map
+++ b/admin/charsets/mapfiles/CP858.map
@@ -1,4 +1,4 @@
-# Created manually from <http://en.wikipedia.org/wiki/Code_page_858>.
+# Created manually from <https://en.wikipedia.org/wiki/Code_page_858>.
 # The text in that page is available under the terms of the GNU Free
 # Documentation License.
 0x00-0x7F 0x0000
diff --git a/admin/unidata/blocks.awk b/admin/unidata/blocks.awk
index b0303d7..96b0413 100755
--- a/admin/unidata/blocks.awk
+++ b/admin/unidata/blocks.awk
@@ -243,6 +243,12 @@ END {
     override_start[idx] = "1F590"
     override_end[idx] = "1F590"
 
+    ## These are here so that font_range can choose Emoji presentation
+    ## for the preceding codepoint when it encounters a VS
+    idx++
+    override_start[idx] = "FE00"
+    override_end[idx] = "FE0F"
+
     for (k in override_start)
     {
         i++
diff --git a/doc/lispref/symbols.texi b/doc/lispref/symbols.texi
index 3a76789..8ae2d1f 100644
--- a/doc/lispref/symbols.texi
+++ b/doc/lispref/symbols.texi
@@ -694,7 +694,7 @@ As can be seen, it's quite tedious to read or develop this 
code since
 the symbol names to type are so long.  We can use shorthands to
 alleviate that.
 
-@lisp1
+@lisp
 (defun snu-split (separator s &optional omit-nulls)
   "A match-data saving variation on `split-string'."
   (save-match-data (split-string s separator omit-nulls)))
diff --git a/doc/misc/efaq.texi b/doc/misc/efaq.texi
index 46f7822..f80ccc0 100644
--- a/doc/misc/efaq.texi
+++ b/doc/misc/efaq.texi
@@ -816,7 +816,7 @@ Emacs news, a history of recent user-visible changes
 
 More GNU and FSF information is available at
 
-@uref{https://www.gnu.org} and @uref{http://www.fsf.org}
+@uref{https://www.gnu.org} and @uref{https://www.fsf.org}
 
 @node Help installing Emacs
 @section Where can I get help in installing Emacs?
diff --git a/etc/NEWS b/etc/NEWS
index 72a4b10..015b120 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -157,6 +157,18 @@ as single glyphs instead of multiple ones.  'Noto Color 
Emoji' is one
 such suitable font.
 
 +++
+** Composition of emoji has been improved.
+If autocomposition is triggered by an emoji character, then the emoji
+font is now used to check if composition can be performed, rather than
+the font of the first character of the string being composed.  This
+allows e.g.
+
+'Emoji codepoint' + VS-16
+
+to be displayed using the emoji font even if 'Emoji codepoint' does
+not have emoji presentation by default.
+
++++
 ** New command 'execute-extended-command-for-buffer'.
 This new command, bound to 'M-S-x', works like
 'execute-extended-command', but limits the set of commands to the
@@ -3909,13 +3921,13 @@ It can be used to create Lisp strings with arbitrary 
byte sequences
 +++
 ** Shorthands for Lisp symbols.
 Shorthands are a general purpose namespacing system to make Emacs
-Lisp's symbol-naming etiquette easier to use.  Also known as a
-"renamed symbol", a shorthand is any symbolic form found in Lisp
-source that "abbreviates" a symbol's print name with.  Usually, the
-abbreviated name will be shorter, but that is not necessarily so; this
-feature could also be used for providing namespace prefixes to
-symbols, in order to avoid name clashes and namespace pollution.  For
-details, see the manual section "(elisp) Shorthands".
+Lisp's symbol-naming etiquette easier to use.  A shorthand is any
+symbolic form found in Lisp source that "abbreviates" a symbol's print
+name.  Among other applications, this feature can be used to avoid
+name clashes and namespace pollution by renaming an entire file's
+worth of symbols with proper and longer prefixes, without actually
+touching the Lisp source.  For details, see the manual section
+"(elisp) Shorthands".
 
 +++
 ** New function 'string-search'.
diff --git a/etc/PROBLEMS b/etc/PROBLEMS
index 42d714b..72696e3 100644
--- a/etc/PROBLEMS
+++ b/etc/PROBLEMS
@@ -2247,7 +2247,7 @@ implementation is only available in UNICOWS.DLL, which 
implements the
 Microsoft Layer for Unicode on Windows 9X, or "MSLU".  This article on
 MSDN:
 
-  http://msdn.microsoft.com/en-us/goglobal/bb688166.aspx
+  
https://web.archive.org/web/20151224032644/https://msdn.microsoft.com/en-us/goglobal/bb688166.aspx
 
 includes a short description of MSLU and a link where it can be
 downloaded.
@@ -2314,7 +2314,7 @@ dialogs introduced in Windows 7.  It is explicitly 
described in the
 MSDN documentation of the GetOpenFileName API used by Emacs to pop up
 the file selection dialog.  For the details, see
 
-  
http://msdn.microsoft.com/en-us/library/windows/desktop/ms646839%28v=vs.85%29.aspx
+  
https://msdn.microsoft.com/en-us/library/windows/desktop/ms646839%28v=vs.85%29.aspx
 
 The dialog shows the last directory in which the user selected a file
 in a previous invocation of the dialog with the same initial
diff --git a/lisp/ChangeLog.15 b/lisp/ChangeLog.15
index bd1fbe6..29fbe47 100644
--- a/lisp/ChangeLog.15
+++ b/lisp/ChangeLog.15
@@ -17307,7 +17307,7 @@
        * simple.el (normal-erase-is-backspace-mode): Use input-decode-map
        rather than fiddling with global-map bindings, since it should only
        affect per-terminal settings.
-       See http://bugs.gentoo.org/show_bug.cgi?id=289709.
+       See https://bugs.gentoo.org/show_bug.cgi?id=289709.
 
        * minibuffer.el (completion-table-with-terminator): Allow to specify
        the terminator-regexp.
diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el
index 833c1d1..4e0e323 100644
--- a/lisp/emacs-lisp/cl-macs.el
+++ b/lisp/emacs-lisp/cl-macs.el
@@ -3080,12 +3080,12 @@ Supported keywords for slots are:
                            `(nth ,pos cl-x))))))
              (push slot slots)
              (push default-value defaults)
-             ;; The arg "cl-x" is referenced by name in eg pred-form
+              ;; The arg "cl-x" is referenced by name in e.g. pred-form
              ;; and pred-check, so changing it is not straightforward.
              (push `(,defsym ,accessor (cl-x)
-                       ,(internal--format-docstring-line
-                         "Access slot \"%s\" of `%s' struct CL-X.%s"
-                         slot name
+                       ,(concat
+                         (internal--format-docstring-line
+                          "Access slot \"%s\" of `%s' struct CL-X." slot name)
                          (if doc (concat "\n" doc) ""))
                        (declare (side-effect-free t))
                        ,access-body)
diff --git a/lisp/international/titdic-cnv.el b/lisp/international/titdic-cnv.el
index ccb4c83..dfd4e5b 100644
--- a/lisp/international/titdic-cnv.el
+++ b/lisp/international/titdic-cnv.el
@@ -627,8 +627,8 @@ To get complete usage, invoke \"emacs -batch -f 
batch-titdic-convert -h\"."
      py-converter
      "\
 ;; \"pinyin.map\" is included in a free package called CCE.  It is
-;; available at:
-;;     http://ftp.debian.org/debian/dists/potato/main
+;; available at: [link needs updating  -- SK 2021-09-27]
+;;     https://ftp.debian.org/debian/dists/potato/main
 ;;             /source/utils/cce_0.36.orig.tar.gz
 ;; This package contains the following copyright notice.
 ;;
@@ -655,8 +655,8 @@ To get complete usage, invoke \"emacs -batch -f 
batch-titdic-convert -h\"."
      ziranma-converter
      "\
 ;; \"ziranma.cin\" is included in a free package called CCE.  It is
-;; available at:
-;;     http://ftp.debian.org/debian/dists/potato/main
+;; available at: [link needs updating  -- SK 2021-09-27]
+;;     https://ftp.debian.org/debian/dists/potato/main
 ;;             /source/utils/cce_0.36.orig.tar.gz
 ;; This package contains the following copyright notice.
 ;;
diff --git a/lisp/term/w32-win.el b/lisp/term/w32-win.el
index 80afcb3..5d1dc60 100644
--- a/lisp/term/w32-win.el
+++ b/lisp/term/w32-win.el
@@ -532,7 +532,7 @@ characters from these blocks.")
   (let (val)
     (dolist (elt script-representative-chars)
       (let ((subranges w32-no-usb-subranges)
-            (chars (cdr elt))
+            (chars (append (cdr elt) nil)) ; handle vectors as well
             ch found subrange)
         (while (and (consp chars) (not found))
           (setq ch (car chars)
@@ -595,7 +595,11 @@ default font on FRAME, or its best approximation."
                                              0 nchars script-chars)
                           '[nil]))
                   ;; Does this font support ALL of the script's
-                  ;; representative characters?
+                  ;; representative characters?  Note that, when the
+                  ;; representative characters are specified as a
+                  ;; vector, this is a more stringent test than font
+                  ;; selection does, because supporting _any_
+                  ;; character from the vector is enough.
                   (setq idx 0)
                   (while (and (< idx nchars) (not (null (aref glyphs idx))))
                     (setq idx (1+ idx)))
diff --git a/msdos/autogen/config.in b/msdos/autogen/config.in
index 263cba1..560f5f3 100644
--- a/msdos/autogen/config.in
+++ b/msdos/autogen/config.in
@@ -1712,7 +1712,7 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
   /* Suppress GCC's bogus "no previous prototype for 'FOO'"
      and "no previous declaration for 'FOO'"  diagnostics,
      when FOO is an inline function in the header; see
-     <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54113>.  */
+     <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54113>.  */
 # define _GL_INLINE_HEADER_BEGIN \
     _Pragma ("GCC diagnostic push") \
     _Pragma ("GCC diagnostic ignored \"-Wmissing-prototypes\"") \
diff --git a/nt/ChangeLog.1 b/nt/ChangeLog.1
index 247f10a..d0aed93 100644
--- a/nt/ChangeLog.1
+++ b/nt/ChangeLog.1
@@ -222,7 +222,7 @@
        as earlier versions.  This is so GetVersion and GetVersionEx APIs
        used for bug reporting and other purposes return accurate version
        number on Windows 8.1.  See the discussion on MSDN
-       http://msdn.microsoft.com/en-us/library/windows/desktop/dn302074.aspx
+       https://msdn.microsoft.com/en-us/library/windows/desktop/dn302074.aspx
        for more details.
 
 2013-12-12  Eli Zaretskii  <eliz@gnu.org>
diff --git a/src/composite.c b/src/composite.c
index c37b1fd..f456e7a 100644
--- a/src/composite.c
+++ b/src/composite.c
@@ -882,14 +882,15 @@ fill_gstring_body (Lisp_Object gstring)
 /* Try to compose the characters at CHARPOS according to composition
    rule RULE ([PATTERN PREV-CHARS FUNC]).  LIMIT limits the characters
    to compose.  STRING, if not nil, is a target string.  WIN is a
-   window where the characters are being displayed.  If characters are
+   window where the characters are being displayed.  CH is the
+   character that triggered the composition check.  If characters are
    successfully composed, return the composition as a glyph-string
    object.  Otherwise return nil.  */
 
 static Lisp_Object
 autocmp_chars (Lisp_Object rule, ptrdiff_t charpos, ptrdiff_t bytepos,
               ptrdiff_t limit, struct window *win, struct face *face,
-              Lisp_Object string, Lisp_Object direction)
+              Lisp_Object string, Lisp_Object direction, int ch)
 {
   ptrdiff_t count = SPECPDL_INDEX ();
   Lisp_Object pos = make_fixnum (charpos);
@@ -920,7 +921,7 @@ autocmp_chars (Lisp_Object rule, ptrdiff_t charpos, 
ptrdiff_t bytepos,
   struct frame *f = XFRAME (font_object);
   if (FRAME_WINDOW_P (f))
     {
-      font_object = font_range (charpos, bytepos, &to, win, face, string);
+      font_object = font_range (charpos, bytepos, &to, win, face, string, ch);
       if (! FONT_OBJECT_P (font_object)
          || (! NILP (re)
              && to < limit
@@ -1272,7 +1273,7 @@ composition_reseat_it (struct composition_it *cmp_it, 
ptrdiff_t charpos,
              if (XFIXNAT (AREF (elt, 1)) != cmp_it->lookback)
                goto no_composition;
              lgstring = autocmp_chars (elt, charpos, bytepos, endpos,
-                                       w, face, string, direction);
+                                       w, face, string, direction, cmp_it->ch);
              if (composition_gstring_p (lgstring))
                break;
              lgstring = Qnil;
@@ -1310,7 +1311,7 @@ composition_reseat_it (struct composition_it *cmp_it, 
ptrdiff_t charpos,
          else
            direction = QR2L;
          lgstring = autocmp_chars (elt, cpos, bpos, charpos + 1, w, face,
-                                   string, direction);
+                                   string, direction, cmp_it->ch);
          if (! composition_gstring_p (lgstring)
              || cpos + LGSTRING_CHAR_LEN (lgstring) - 1 != charpos)
            /* Composition failed or didn't cover the current
@@ -1679,7 +1680,7 @@ find_automatic_composition (ptrdiff_t pos, ptrdiff_t 
limit, ptrdiff_t backlim,
                  for (check = cur; check_pos < check.pos; )
                    BACKWARD_CHAR (check, stop);
                  *gstring = autocmp_chars (elt, check.pos, check.pos_byte,
-                                           tail, w, NULL, string, Qnil);
+                                           tail, w, NULL, string, Qnil, c);
                  need_adjustment = 1;
                  if (NILP (*gstring))
                    {
diff --git a/src/font.c b/src/font.c
index e043ef8..82a1dff 100644
--- a/src/font.c
+++ b/src/font.c
@@ -3866,6 +3866,9 @@ font_at (int c, ptrdiff_t pos, struct face *face, struct 
window *w,
    If STRING is not nil, it is the string to check instead of the current
    buffer.  In that case, FACE must be not NULL.
 
+   CH is the character that actually caused the composition
+   process to start, it may be different from the character at POS.
+
    The return value is the font-object for the character at POS.
    *LIMIT is set to the position where that font can't be used.
 
@@ -3873,15 +3876,16 @@ font_at (int c, ptrdiff_t pos, struct face *face, 
struct window *w,
 
 Lisp_Object
 font_range (ptrdiff_t pos, ptrdiff_t pos_byte, ptrdiff_t *limit,
-           struct window *w, struct face *face, Lisp_Object string)
+           struct window *w, struct face *face, Lisp_Object string,
+           int ch)
 {
   ptrdiff_t ignore;
   int c;
   Lisp_Object font_object = Qnil;
+  struct frame *f = XFRAME (w->frame);
 
   if (!face)
     {
-      struct frame *f = XFRAME (w->frame);
       int face_id;
 
       if (NILP (string))
@@ -3900,6 +3904,24 @@ font_range (ptrdiff_t pos, ptrdiff_t pos_byte, ptrdiff_t 
*limit,
       face = FACE_FROM_ID (f, face_id);
     }
 
+  /* If the composition was triggered by an emoji, use a character
+     from 'script-representative-chars', rather than the first
+     character in the string, to determine the font to use.  */
+  if (EQ (CHAR_TABLE_REF (Vchar_script_table, ch),
+         Qemoji))
+    {
+      Lisp_Object val = assq_no_quit (Qemoji, Vscript_representative_chars);
+      if (CONSP (val))
+       {
+         val = XCDR (val);
+         if (CONSP (val))
+           val = XCAR (val);
+         else if (VECTORP (val))
+           val = AREF (val, 0);
+         font_object = font_for_char (face, XFIXNAT (val), pos - 1, string);
+       }
+    }
+
   while (pos < *limit)
     {
       c = (NILP (string)
@@ -5423,6 +5445,7 @@ syms_of_font (void)
   DEFSYM (Qiso8859_1, "iso8859-1");
   DEFSYM (Qiso10646_1, "iso10646-1");
   DEFSYM (Qunicode_bmp, "unicode-bmp");
+  DEFSYM (Qemoji, "emoji");
 
   /* Symbols representing keys of font extra info.  */
   DEFSYM (QCotf, ":otf");
diff --git a/src/font.h b/src/font.h
index d3e1530..1da72cc 100644
--- a/src/font.h
+++ b/src/font.h
@@ -885,7 +885,7 @@ valid_font_driver (struct font_driver const *d)
 extern Lisp_Object font_update_drivers (struct frame *f, Lisp_Object list);
 extern Lisp_Object font_range (ptrdiff_t, ptrdiff_t, ptrdiff_t *,
                               struct window *, struct face *,
-                              Lisp_Object);
+                              Lisp_Object, int);
 extern void font_fill_lglyph_metrics (Lisp_Object, struct font *, unsigned 
int);
 
 extern Lisp_Object font_put_extra (Lisp_Object font, Lisp_Object prop,
diff --git a/src/nsmenu.m b/src/nsmenu.m
index f0c5bb2..9b78643 100644
--- a/src/nsmenu.m
+++ b/src/nsmenu.m
@@ -995,25 +995,24 @@ free_frame_tool_bar (struct frame *f)
   /* Note: This triggers an animation, which calls windowDidResize
      repeatedly.  */
   f->output_data.ns->in_animation = 1;
-  [[[view window] toolbar] setVisible: NO];
+  [[[view window] toolbar] setVisible:NO];
   f->output_data.ns->in_animation = 0;
 
+  [[view window] setToolbar:nil];
+
   unblock_input ();
 }
 
 void
-update_frame_tool_bar (struct frame *f)
+update_frame_tool_bar_1 (struct frame *f, EmacsToolbar *toolbar)
 /* --------------------------------------------------------------------------
     Update toolbar contents.
    -------------------------------------------------------------------------- 
*/
 {
   int i, k = 0;
-  NSWindow *window = [FRAME_NS_VIEW (f) window];
-  EmacsToolbar *toolbar = (EmacsToolbar *)[window toolbar];
 
   NSTRACE ("update_frame_tool_bar");
 
-  if (window == nil || toolbar == nil) return;
   block_input ();
 
 #ifdef NS_IMPL_COCOA
@@ -1094,13 +1093,6 @@ update_frame_tool_bar (struct frame *f)
 #undef TOOLPROP
     }
 
-  if (![toolbar isVisible] != !FRAME_EXTERNAL_TOOL_BAR (f))
-    {
-      f->output_data.ns->in_animation = 1;
-      [toolbar setVisible: FRAME_EXTERNAL_TOOL_BAR (f)];
-      f->output_data.ns->in_animation = 0;
-    }
-
 #ifdef NS_IMPL_COCOA
   if ([toolbar changed])
     {
@@ -1124,9 +1116,28 @@ update_frame_tool_bar (struct frame *f)
       [newDict release];
     }
 #endif
+
+  [toolbar setVisible:YES];
   unblock_input ();
 }
 
+void
+update_frame_tool_bar (struct frame *f)
+{
+  EmacsWindow *window = (EmacsWindow *)[FRAME_NS_VIEW (f) window];
+  EmacsToolbar *toolbar = (EmacsToolbar *)[window toolbar];
+
+  if (!toolbar)
+    {
+      [window createToolbar:f];
+      return;
+    }
+
+  if (window == nil || toolbar == nil) return;
+
+  update_frame_tool_bar_1 (f, toolbar);
+}
+
 
 /* ==========================================================================
 
diff --git a/src/nsterm.h b/src/nsterm.h
index 6d4ea77..8cbc663 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -418,6 +418,7 @@ typedef id instancetype;
 
 - (instancetype)initWithEmacsFrame:(struct frame *)f;
 - (instancetype)initWithEmacsFrame:(struct frame *)f 
fullscreen:(BOOL)fullscreen screen:(NSScreen *)screen;
+- (void)createToolbar:(struct frame *)f;
 - (void)setParentChildRelationships;
 - (NSInteger)borderWidth;
 - (BOOL)restackWindow:(NSWindow *)win above:(BOOL)above;
@@ -488,7 +489,7 @@ typedef id instancetype;
 - (void)lockFocus;
 - (void)unlockFocus;
 #endif
-- (void)copyRect:(NSRect)srcRect to:(NSRect)dstRect;
+- (void)copyRect:(NSRect)srcRect to:(NSPoint)dest;
 
 /* Non-notification versions of NSView methods. Used for direct calls.  */
 - (void)windowWillEnterFullScreen;
@@ -1148,6 +1149,10 @@ extern void ns_init_locale (void);
 
 /* in nsmenu */
 extern void update_frame_tool_bar (struct frame *f);
+#ifdef __OBJC__
+extern void update_frame_tool_bar_1 (struct frame *f, EmacsToolbar *toolbar);
+#endif
+
 extern void free_frame_tool_bar (struct frame *f);
 extern Lisp_Object find_and_return_menu_selection (struct frame *f,
                                                    bool keymaps,
diff --git a/src/nsterm.m b/src/nsterm.m
index 4ef20e4..1970a7a 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -1021,15 +1021,6 @@ ns_update_begin (struct frame *f)
 
   ns_update_auto_hide_menu_bar ();
 
-  NSToolbar *toolbar = [[FRAME_NS_VIEW (f) window] toolbar];
-  if (toolbar)
-  {
-    /* Ensure the toolbars visibility is set correctly.  */
-    BOOL tbar_visible = FRAME_EXTERNAL_TOOL_BAR (f) ? YES : NO;
-    if (! tbar_visible != ! [toolbar isVisible])
-      [toolbar setVisible: tbar_visible];
-  }
-
   ns_updating_frame = f;
   [view lockFocus];
 }
@@ -2710,10 +2701,10 @@ ns_scroll_run (struct window *w, struct run *run)
 
   {
     NSRect srcRect = NSMakeRect (x, from_y, width, height);
-    NSRect dstRect = NSMakeRect (x, to_y, width, height);
+    NSPoint dest = NSMakePoint (x, to_y);
     EmacsView *view = FRAME_NS_VIEW (f);
 
-    [view copyRect:srcRect to:dstRect];
+    [view copyRect:srcRect to:dest];
 #ifdef NS_IMPL_COCOA
     [view setNeedsDisplayInRect:srcRect];
 #endif
@@ -2835,11 +2826,11 @@ ns_shift_glyphs_for_insert (struct frame *f,
    -------------------------------------------------------------------------- 
*/
 {
   NSRect srcRect = NSMakeRect (x, y, width, height);
-  NSRect dstRect = NSMakeRect (x+shift_by, y, width, height);
+  NSPoint dest = NSMakePoint (x+shift_by, y);
 
   NSTRACE ("ns_shift_glyphs_for_insert");
 
-  [FRAME_NS_VIEW (f) copyRect:srcRect to:dstRect];
+  [FRAME_NS_VIEW (f) copyRect:srcRect to:dest];
 }
 
 
@@ -7401,7 +7392,6 @@ not_in_argv (NSString *arg)
     }
   else
     {
-      BOOL tbar_visible = FRAME_EXTERNAL_TOOL_BAR (emacsframe) ? YES : NO;
 #if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 \
   && MAC_OS_X_VERSION_MIN_REQUIRED <= 1070
       unsigned val = (unsigned)[NSApp presentationOptions];
@@ -7419,7 +7409,6 @@ not_in_argv (NSString *arg)
           [NSApp setPresentationOptions: options];
         }
 #endif
-      [[[self window]toolbar] setVisible:tbar_visible];
     }
 }
 
@@ -7460,14 +7449,6 @@ not_in_argv (NSString *arg)
 #if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
   [self updateCollectionBehavior];
 #endif
-  if (FRAME_EXTERNAL_TOOL_BAR (emacsframe))
-    {
-      [[[self window] toolbar] setVisible:YES];
-      update_frame_tool_bar (emacsframe);
-      [[self window] display];
-    }
-  else
-    [[[self window] toolbar] setVisible:NO];
 
   if (next_maximized != -1)
     [[self window] performZoom:self];
@@ -7873,17 +7854,39 @@ not_in_argv (NSString *arg)
 #endif /* NS_IMPL_COCOA */
 
 
-- (void)copyRect:(NSRect)srcRect to:(NSRect)dstRect
+- (void)copyRect:(NSRect)srcRect to:(NSPoint)dest
 {
   NSTRACE ("[EmacsView copyRect:To:]");
   NSTRACE_RECT ("Source", srcRect);
-  NSTRACE_RECT ("Destination", dstRect);
+  NSTRACE_POINT ("Destination", dest);
+
+  NSRect dstRect = NSMakeRect (dest.x, dest.y, NSWidth (srcRect),
+                               NSHeight (srcRect));
+  NSRect frame = [self frame];
+
+  /* TODO: This check is an attempt to debug a rare graphical glitch
+     on macOS and should be removed before the Emacs 28 release.  */
+  if (!NSContainsRect (frame, srcRect)
+      || !NSContainsRect (frame, dstRect))
+    {
+      NSLog (@"[EmacsView copyRect:to:] Attempting to copy to or "
+             "from an area outside the graphics buffer.");
+      NSLog (@"  Frame: (%f, %f) %f×%f",
+             NSMinX (frame), NSMinY (frame),
+             NSWidth (frame), NSHeight (frame));
+      NSLog (@"  Source: (%f, %f) %f×%f",
+             NSMinX (srcRect), NSMinY (srcRect),
+             NSWidth (srcRect), NSHeight (srcRect));
+      NSLog (@"  Destination: (%f, %f) %f×%f",
+             NSMinX (dstRect), NSMinY (dstRect),
+             NSWidth (dstRect), NSHeight (dstRect));
+    }
 
 #ifdef NS_IMPL_COCOA
   if ([self wantsLayer])
     {
       double scale = [[self window] backingScaleFactor];
-      CGContextRef context = [[NSGraphicsContext currentContext] CGContext];
+      CGContextRef context = [(EmacsLayer *)[self layer] getContext];
       int bpp = CGBitmapContextGetBitsPerPixel (context) / 8;
       void *pixels = CGBitmapContextGetData (context);
       int rowSize = CGBitmapContextGetBytesPerRow (context);
@@ -7892,8 +7895,8 @@ not_in_argv (NSString *arg)
                         + (int) (NSMinY (srcRect) * scale * rowSize
                                  + NSMinX (srcRect) * scale * bpp);
       void *dstPixels = (char *) pixels
-                        + (int) (NSMinY (dstRect) * scale * rowSize
-                                 + NSMinX (dstRect) * scale * bpp);
+                        + (int) (dest.y * scale * rowSize
+                                 + dest.x * scale * bpp);
 
       if (NSIntersectsRect (srcRect, dstRect)
           && NSMinY (srcRect) < NSMinY (dstRect))
@@ -8298,8 +8301,7 @@ not_in_argv (NSString *arg)
         [self setOpaque:NO];
 
       /* toolbar support */
-      if (! FRAME_UNDECORATED (f))
-        [self createToolbar:f];
+      [self createToolbar:f];
 
       /* macOS Sierra automatically enables tabbed windows.  We can't
          allow this to be enabled until it's available on a Free system.
@@ -8316,13 +8318,17 @@ not_in_argv (NSString *arg)
 
 - (void)createToolbar: (struct frame *)f
 {
+  if (FRAME_UNDECORATED (f) || !FRAME_EXTERNAL_TOOL_BAR (f))
+    return;
+
   EmacsView *view = (EmacsView *)FRAME_NS_VIEW (f);
 
   EmacsToolbar *toolbar = [[EmacsToolbar alloc]
                             initForView:view
                             withIdentifier:[NSString 
stringWithLispString:f->name]];
-  [toolbar setVisible:NO];
+
   [self setToolbar:toolbar];
+  update_frame_tool_bar_1 (f, toolbar);
 
 #ifdef NS_IMPL_COCOA
   {
diff --git a/src/w16select.c b/src/w16select.c
index 3723913..bbd2ed4 100644
--- a/src/w16select.c
+++ b/src/w16select.c
@@ -87,7 +87,7 @@ static size_t clipboard_storage_size;
 /* C functions to access the Windows 3.1x clipboard from DOS apps.
 
    The information was obtained from the Microsoft Knowledge Base,
-   article Q67675 and can be found at:
+   article Q67675 and can be found at: [broken link  -- SK 2021-09-27]
    http://www.microsoft.com/kb/developr/win_dk/q67675.htm  */
 
 /* See also Ralf Brown's Interrupt List.
diff --git a/test/lisp/subr-tests.el b/test/lisp/subr-tests.el
index 695da10..ed9a3d0 100644
--- a/test/lisp/subr-tests.el
+++ b/test/lisp/subr-tests.el
@@ -767,6 +767,18 @@ See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=19350.";
       (should-not (equal dir default-directory))
       (should (file-exists-p default-directory)))))
 
+(ert-deftest subr-test-internal--format-docstring-line ()
+  (should
+   (string= (let ((fill-column 60))
+              (internal--format-docstring-line
+               "Emacs is the advanced, extensible, customizable, \
+self-documenting editor.  This manual describes how to edit with Emacs and \
+some of the ways to customize it; it corresponds to GNU Emacs version 28.1."))
+            "Emacs is the advanced, extensible, customizable,
+self-documenting editor.  This manual describes how to edit
+with Emacs and some of the ways to customize it; it
+corresponds to GNU Emacs version 28.1.")))
+
 (ert-deftest test-ensure-list ()
   (should (equal (ensure-list nil) nil))
   (should (equal (ensure-list :foo) '(:foo)))
diff --git a/test/src/comp-resources/comp-test-funcs.el 
b/test/src/comp-resources/comp-test-funcs.el
index eb2521e..6352a7c 100644
--- a/test/src/comp-resources/comp-test-funcs.el
+++ b/test/src/comp-resources/comp-test-funcs.el
@@ -478,8 +478,9 @@
              (eq family 'unspecified))
       family)))
 
+;; This function doesn't have a doc string on purpose.
 (defun comp-test-46670-1-f (_)
-  "Foo.")
+  "foo")
 
 (defun comp-test-46670-2-f (s)
   (and (equal (comp-test-46670-1-f (length s)) s)
diff --git a/test/src/comp-tests.el b/test/src/comp-tests.el
index f1778b3..ecf62a4 100644
--- a/test/src/comp-tests.el
+++ b/test/src/comp-tests.el
@@ -285,7 +285,7 @@ Check that the resulting binaries do not differ."
   (should (string= (comp-tests-condition-case-0-f)
                    "arith-error Arithmetic error catched"))
   (should (string= (comp-tests-condition-case-1-f)
-                   "error foo catched"))
+                   "error Foo catched"))
   (should (= (comp-tests-catch-f
               (lambda () (throw 'foo 3)))
              3))
@@ -333,7 +333,7 @@ Check that the resulting binaries do not differ."
 
 (comp-deftest doc ()
   (should (string= (documentation #'comp-tests-doc-f)
-                   "A nice docstring"))
+                   "A nice docstring."))
   ;; Check a preloaded function, we can't use `comp-tests-doc-f' now
   ;; as this is loaded manually with no .elc.
   (should (string-match "\\.*.elc\\'" (symbol-file #'error))))



reply via email to

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