From 5f6e88ec9b43fef259f0303d167107fc56f70a5c Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Mon, 27 Sep 2021 09:28:34 +0200 Subject: [PATCH 01/10] Fix two doc-related test failures --- test/src/comp-tests.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/src/comp-tests.el b/test/src/comp-tests.el index f1778b38568..ecf62a4c128 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)))) From da4e58458f6659d075143083a9f04be3a42853da Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Mon, 27 Sep 2021 09:33:56 +0200 Subject: [PATCH 02/10] Fix checkdoc-related test failure --- test/src/comp-resources/comp-test-funcs.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/src/comp-resources/comp-test-funcs.el b/test/src/comp-resources/comp-test-funcs.el index eb2521e5d34..6352a7c7e94 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) From a2a62f71051f1295492780f320e9b7bc02b6e6f4 Mon Sep 17 00:00:00 2001 From: Robert Pluim Date: Sun, 26 Sep 2021 17:26:22 +0200 Subject: [PATCH 03/10] Enhance font_range to check for emoji composition triggers If the codepoint that triggered composition is from the emoji script, use the emoji font to check the string being composed, rather than the font of the first character of the string. This makes e.g. "emoji codepoint with Emoji_Presentation = No followed by VS-16 (FE0F)" display the emoji version of the glyph for that codepoint. * admin/unidata/blocks.awk: Add VS-1 through VS-16 to the emoji script. * src/composite.c (autocmp_chars): Accept additional argument CH for the codepoint that triggered composition, pass it to font_range. (composition_reseat_it, find_automatic_composition): Pass codepoint that triggered composition to autocmp_chars. * src/font.c (font_range): Accept additional argument CH for the triggering codepoint. If the codepoint is from the 'emoji' script, use Vscript_representative_chars to find the font to use for the composition attempt. (syms_of_font): Add Qemoji symbol. * src/font.h: Update font_range prototype for argument CH. * etc/NEWS: Announce change. --- admin/unidata/blocks.awk | 6 ++++++ etc/NEWS | 12 ++++++++++++ src/composite.c | 13 +++++++------ src/font.c | 27 +++++++++++++++++++++++++-- src/font.h | 2 +- 5 files changed, 51 insertions(+), 9 deletions(-) diff --git a/admin/unidata/blocks.awk b/admin/unidata/blocks.awk index b0303d7e669..96b0413875d 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/etc/NEWS b/etc/NEWS index 72a4b100b3c..381712f05dc 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -156,6 +156,18 @@ sequences (if a suitable font is installed) so that they are displayed 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 diff --git a/src/composite.c b/src/composite.c index c37b1fd4b95..f456e7a835d 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 e043ef8d01b..82a1dffc011 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 d3e15306427..1da72cca079 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, From 93d200b23c9f2c89c39166e7e3ef3c6ef0806348 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20T=C3=A1vora?= Date: Mon, 27 Sep 2021 10:19:35 +0100 Subject: [PATCH 04/10] * etc/NEWS (Shorthands for Lisp symbols): Reword. --- etc/NEWS | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 381712f05dc..015b120e04b 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -3921,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'. From 129efd9c0b05610794cbfbb4d88facda435a8fe6 Mon Sep 17 00:00:00 2001 From: "Basil L. Contovounesios" Date: Mon, 27 Sep 2021 10:20:54 +0100 Subject: [PATCH 05/10] ; Fix compilation of doc/lispref/symbols.texi. --- doc/lispref/symbols.texi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/lispref/symbols.texi b/doc/lispref/symbols.texi index 3a767892ff1..8ae2d1fc88b 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))) From 2403deca2bcffc62ff80e4c90a61fea1ea30a768 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Mon, 27 Sep 2021 12:28:54 +0300 Subject: [PATCH 06/10] Minor fix in 'w32-find-non-USB-fonts' * lisp/term/w32-win.el (w32--filter-USB-scripts): Handle representative characters given as a vector, not a list. --- lisp/term/w32-win.el | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lisp/term/w32-win.el b/lisp/term/w32-win.el index 80afcb36040..5d1dc606676 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))) From 3d2d7e8ea235a13543ed475836f8f7ea4c88520e Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Mon, 27 Sep 2021 11:26:31 +0200 Subject: [PATCH 07/10] Fix automatic filling of docstring in cl-defstruct * lisp/emacs-lisp/cl-macs.el (cl-defstruct): Fix bug where a paragraph was filled as if it were a single line, which led to garbled output in the docstring. (Bug#50839) * test/lisp/subr-tests.el (subr-test-internal--format-docstring-line): New test. --- lisp/emacs-lisp/cl-macs.el | 8 ++++---- test/lisp/subr-tests.el | 12 ++++++++++++ 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index 833c1d19737..4e0e323cfa1 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/test/lisp/subr-tests.el b/test/lisp/subr-tests.el index 695da10408e..ed9a3d01498 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))) From 86bf8afa45f8d8fe19c82a9351ca445bc6f0e12e Mon Sep 17 00:00:00 2001 From: Alan Third Date: Sun, 26 Sep 2021 11:12:48 +0100 Subject: [PATCH 08/10] Fix NS toolbar again (bug#50534) * src/nsmenu.m (free_frame_tool_bar): Remove toolbar. (update_frame_tool_bar_1): New function. (update_frame_tool_bar): Move most of the functionality to update_frame_tool_bar_1. * src/nsterm.h: Definitions of functions and methods. * src/nsterm.m (ns_update_begin): ([EmacsView windowDidEnterFullScreen]): ([EmacsView windowDidExitFullScreen]): We no longer need to reset the toolbar visibility as that's done when we create the new fullscreen window. ([EmacsWindow initWithEmacsFrame:fullscreen:screen:]): Move the check for undecorated frames into createToolbar:. ([EmacsWindow createToolbar:]): Check whether a toolbar should be created, and run the toolbar update immediately. --- src/nsmenu.m | 35 +++++++++++++++++++++++------------ src/nsterm.h | 5 +++++ src/nsterm.m | 28 ++++++---------------------- 3 files changed, 34 insertions(+), 34 deletions(-) diff --git a/src/nsmenu.m b/src/nsmenu.m index f0c5bb24e63..9b78643d56a 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 6d4ea771212..1bedf78bcb1 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; @@ -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 4ef20e4c2b7..3363fac475a 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]; } @@ -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]; @@ -8298,8 +8279,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 +8296,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 { From d22d7d6be8c6348eead9412d6f05b18de3f481b6 Mon Sep 17 00:00:00 2001 From: Alan Third Date: Mon, 27 Sep 2021 10:50:02 +0100 Subject: [PATCH 09/10] Attempt to debug a graphical glitch on macOS * src/nsterm.m (ns_scroll_run): (ns_shift_glyphs_for_insert): Switch to using NSPoint for destination. ([EmacsView copyRect:to:]): Use NSPoint for the destination, always use the view's layer, and log any questionable copy requests. --- src/nsterm.h | 2 +- src/nsterm.m | 40 +++++++++++++++++++++++++++++++--------- 2 files changed, 32 insertions(+), 10 deletions(-) diff --git a/src/nsterm.h b/src/nsterm.h index 1bedf78bcb1..8cbc663651c 100644 --- a/src/nsterm.h +++ b/src/nsterm.h @@ -489,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; diff --git a/src/nsterm.m b/src/nsterm.m index 3363fac475a..1970a7a1c1a 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -2701,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 @@ -2826,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]; } @@ -7854,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); @@ -7873,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)) From dc12ad8978853991c16d27778152526bd91a9f89 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Mon, 27 Sep 2021 12:40:04 +0200 Subject: [PATCH 10/10] ; Update some links to HTTPS and note some broken links --- admin/charsets/mapfiles/CP720.map | 2 +- admin/charsets/mapfiles/CP858.map | 2 +- doc/misc/efaq.texi | 2 +- etc/PROBLEMS | 4 ++-- lisp/ChangeLog.15 | 2 +- lisp/international/titdic-cnv.el | 8 ++++---- msdos/autogen/config.in | 2 +- nt/ChangeLog.1 | 2 +- src/w16select.c | 2 +- 9 files changed, 13 insertions(+), 13 deletions(-) diff --git a/admin/charsets/mapfiles/CP720.map b/admin/charsets/mapfiles/CP720.map index e27deac7eee..0e95b5d66e5 100644 --- a/admin/charsets/mapfiles/CP720.map +++ b/admin/charsets/mapfiles/CP720.map @@ -1,4 +1,4 @@ -# Created manually from . +# Created manually from . # 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 753dc50946e..d5a59b2c52f 100644 --- a/admin/charsets/mapfiles/CP858.map +++ b/admin/charsets/mapfiles/CP858.map @@ -1,4 +1,4 @@ -# Created manually from . +# Created manually from . # The text in that page is available under the terms of the GNU Free # Documentation License. 0x00-0x7F 0x0000 diff --git a/doc/misc/efaq.texi b/doc/misc/efaq.texi index 46f78220fe6..f80ccc080a0 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/PROBLEMS b/etc/PROBLEMS index 42d714bf1e7..72696e36fc1 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 bd1fbe61ad1..29fbe474891 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/international/titdic-cnv.el b/lisp/international/titdic-cnv.el index ccb4c8390bb..dfd4e5b8291 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/msdos/autogen/config.in b/msdos/autogen/config.in index 263cba15a28..560f5f346ff 100644 --- a/msdos/autogen/config.in +++ b/msdos/autogen/config.in @@ -1712,7 +1712,7 @@ along with GNU Emacs. If not, see . */ /* 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 - . */ + . */ # 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 247f10a7335..d0aed936d19 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 diff --git a/src/w16select.c b/src/w16select.c index 37239137cf0..bbd2ed4bb97 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.