commit 4e817132700f03e97aab1933a1d01945af56a2b5 (HEAD, refs/remotes/origin/master) Author: Thomas Fitzsimmons Date: Fri Sep 25 22:57:25 2020 -0400 soap-client.el: Prevent some invalid encoding warnings * lisp/net/soap-client.el (soap-encode-xs-complex-type): Do not warn about missing non-nillable slot if type iself is optional. diff --git a/lisp/net/soap-client.el b/lisp/net/soap-client.el index 7425e8763f..bb74f47a8b 100644 --- a/lisp/net/soap-client.el +++ b/lisp/net/soap-client.el @@ -1716,6 +1716,7 @@ This is a specialization of `soap-encode-value' for ((and (not (eq indicator 'choice)) (= instance-count 0) (not (soap-xs-element-optional? element)) + (not (soap-xs-complex-type-optional? type)) (and (soap-xs-complex-type-p element-type) (not (soap-xs-complex-type-optional-p element-type)))) commit d58e3b3997228423b81df49035bd584fa1918f13 Author: Glenn Morris Date: Fri Sep 25 11:01:14 2020 -0700 Fix out-of-tree make check * test/lisp/custom-tests.el (custom-test-admin-cus-test): New const. (check-for-wrong-custom-types): Use it. diff --git a/test/lisp/custom-tests.el b/test/lisp/custom-tests.el index d94527b558..07f626fd65 100644 --- a/test/lisp/custom-tests.el +++ b/test/lisp/custom-tests.el @@ -147,9 +147,13 @@ (widget-apply field :value-to-internal origvalue) "bar")))))) +(defconst custom-test-admin-cus-test + (expand-file-name "admin/cus-test.el" source-directory)) + (ert-deftest check-for-wrong-custom-types () :tags '(:expensive-test) - (load (concat installation-directory "admin/cus-test.el")) + (skip-unless (file-readable-p custom-test-admin-cus-test)) + (load custom-test-admin-cus-test) (should (null (cus-test-opts t)))) ;;; custom-tests.el ends here commit 3a3226716b84c29c7eee9e19054ffe7618bd334c Author: Alan Third Date: Fri Sep 25 17:12:51 2020 +0100 Tidy up NS color handling * src/nsimage.m (COLORSPACE_NAME): New macro to find the current colorspace. ([EmacsImage initFromXBM:width:height:fg:bg:reverseBytes:]): ([EmacsImage initForXPMWithDepth:width:height:]): Use the current colorspace. * src/nsterm.h (NSAppKitVersionNumber10_7): (NSAppKitVersionNumber10_10): Define for macOS version checks. * src/nsterm.m ([NSColor colorForEmacsRed:green:blue:alpha:]): Tidy up the version checking. ([NSColor colorUsingDefaultColorSpace]): Tidy the version checking and use [NSColor colorUsingColorSpace:] with GNUstep. diff --git a/src/nsimage.m b/src/nsimage.m index 966e7044f1..da6f01cf6a 100644 --- a/src/nsimage.m +++ b/src/nsimage.m @@ -36,6 +36,14 @@ Updated by Christian Limpach (chris@nice.ch) #include "coding.h" +#if defined (NS_IMPL_GNUSTEP) || MAC_OS_X_VERSION_MAX_ALLOWED < 1070 +# define COLORSPACE_NAME NSCalibratedRGBColorSpace +#else +# define COLORSPACE_NAME \ + ((ns_use_srgb_colorspace && NSAppKitVersionNumber >= NSAppKitVersionNumber10_7) \ + ? NSDeviceRGBColorSpace : NSCalibratedRGBColorSpace) +#endif + /* ========================================================================== @@ -295,7 +303,7 @@ - (instancetype)initFromXBM: (unsigned char *)bits width: (int)w height: (int)h pixelsWide: w pixelsHigh: h bitsPerSample: 8 samplesPerPixel: 4 hasAlpha: YES isPlanar: YES - colorSpaceName: NSCalibratedRGBColorSpace + colorSpaceName: COLORSPACE_NAME bytesPerRow: w bitsPerPixel: 0]; [bmRep getBitmapDataPlanes: planes]; @@ -415,7 +423,7 @@ - (instancetype)initForXPMWithDepth: (int)depth width: (int)width height: (int)h /* keep things simple for now */ bitsPerSample: 8 samplesPerPixel: 4 /*RGB+A*/ hasAlpha: YES isPlanar: YES - colorSpaceName: NSCalibratedRGBColorSpace + colorSpaceName: COLORSPACE_NAME bytesPerRow: width bitsPerPixel: 0]; [bmRep getBitmapDataPlanes: pixmapData]; diff --git a/src/nsterm.h b/src/nsterm.h index 0bdb78e443..f292993d8f 100644 --- a/src/nsterm.h +++ b/src/nsterm.h @@ -1254,6 +1254,19 @@ extern char gnustep_base_version[]; /* version tracking */ ? (min) : (((x)>(max)) ? (max) : (x))) #define SCREENMAXBOUND(x) (IN_BOUND (-SCREENMAX, x, SCREENMAX)) + +#ifdef NS_IMPL_COCOA +/* Add some required AppKit version numbers if they're not defined. */ +#ifndef NSAppKitVersionNumber10_7 +#define NSAppKitVersionNumber10_7 1138 +#endif + +#ifndef NSAppKitVersionNumber10_10 +#define NSAppKitVersionNumber10_10 1343 +#endif +#endif /* NS_IMPL_COCOA */ + + /* macOS 10.7 introduces some new constants. */ #if !defined (NS_IMPL_COCOA) || !defined (MAC_OS_X_VERSION_10_7) #define NSFullScreenWindowMask (1 << 14) diff --git a/src/nsterm.m b/src/nsterm.m index ec96be3d2f..fdcd677d14 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -140,14 +140,9 @@ @implementation NSColor (EmacsColor) + (NSColor *)colorForEmacsRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha { -#if defined (NS_IMPL_COCOA) \ - && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 +#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 if (ns_use_srgb_colorspace -#if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 - && [NSColor respondsToSelector: - @selector(colorWithSRGBRed:green:blue:alpha:)] -#endif - ) + && NSAppKitVersionNumber >= NSAppKitVersionNumber10_7) return [NSColor colorWithSRGBRed: red green: green blue: blue @@ -161,28 +156,12 @@ + (NSColor *)colorForEmacsRed:(CGFloat)red green:(CGFloat)green - (NSColor *)colorUsingDefaultColorSpace { - /* FIXME: We're checking for colorWithSRGBRed here so this will only - work in the same place as in the method above. It should really - be a check whether we're on macOS 10.7 or above. */ -#if defined (NS_IMPL_COCOA) \ - && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 -#if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 - if ([NSColor respondsToSelector: - @selector(colorWithSRGBRed:green:blue:alpha:)]) -#endif - { - if (ns_use_srgb_colorspace) - return [self colorUsingColorSpace: [NSColorSpace sRGBColorSpace]]; - else - return [self colorUsingColorSpace: [NSColorSpace deviceRGBColorSpace]]; - } -#if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 - else -#endif -#endif /* NS_IMPL_COCOA && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 */ -#if defined (NS_IMPL_GNUSTEP) || MAC_OS_X_VERSION_MIN_REQUIRED < 1070 - return [self colorUsingColorSpaceName: NSCalibratedRGBColorSpace]; +#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 + if (ns_use_srgb_colorspace + && NSAppKitVersionNumber >= NSAppKitVersionNumber10_7) + return [self colorUsingColorSpace: [NSColorSpace sRGBColorSpace]]; #endif + return [self colorUsingColorSpace: [NSColorSpace deviceRGBColorSpace]]; } @end @@ -2209,10 +2188,6 @@ so some key presses (TAB) are swallowed by the system. */ NSTRACE ("ns_set_appearance"); -#ifndef NSAppKitVersionNumber10_10 -#define NSAppKitVersionNumber10_10 1343 -#endif - if (NSAppKitVersionNumber < NSAppKitVersionNumber10_10) return; commit dd6876d6e2c57c003edbfe2fb4b12b3dd3e253b8 Author: Alan Third Date: Fri Sep 25 14:32:56 2020 +0100 Remove obsolete macOS support for NS font backend The ns font backend is has been disabled on macOS for a long time and doesn't work correctly even if re-enabled. * src/nsfont.m: (ns_char_width): (ns_ascii_average_width): (ns_get_covering_families): (nsfont_open): (nsfont_close): (nsfont_draw): (ns_uni_to_glyphs): (ns_glyph_metrics): (EmacsGlyphStorage): Remove all Cocoa only code. * src/nsterm.h (EmacsGlyphStorage): Remove. (struct nsfont_info): Make GNUstep only. * src/nsterm.m (ns_compute_glyph_string_overhangs): Remove GNUstep only code from Cocoa builds. diff --git a/src/nsfont.m b/src/nsfont.m index 691becda6d..d1543ec69c 100644 --- a/src/nsfont.m +++ b/src/nsfont.m @@ -39,9 +39,7 @@ #include "pdumper.h" /* TODO: Drop once we can assume gnustep-gui 0.17.1. */ -#ifdef NS_IMPL_GNUSTEP #import -#endif #define NSFONT_TRACE 0 #define LCD_SMOOTHING_MARGIN 2 @@ -237,12 +235,6 @@ static void ns_glyph_metrics (struct nsfont_info *font_info, CGFloat w = -1.0; NSString *cstr = [NSString stringWithFormat: @"%c", c]; -#ifdef NS_IMPL_COCOA - NSGlyph glyph = [sfont glyphWithName: cstr]; - if (glyph) - w = [sfont advancementForGlyph: glyph].width; -#endif - if (w < 0.0) { NSDictionary *attrsDictionary = @@ -273,12 +265,6 @@ static void ns_glyph_metrics (struct nsfont_info *font_info, ascii_printable = [[NSString alloc] initWithFormat: @"%s", chars]; } -#ifdef NS_IMPL_COCOA - NSGlyph glyph = [sfont glyphWithName: ascii_printable]; - if (glyph) - w = [sfont advancementForGlyph: glyph].width; -#endif - if (w < (CGFloat) 0.0) { NSDictionary *attrsDictionary = @@ -511,10 +497,6 @@ but also for ascii (which causes unnecessary font substitution). */ } [charset release]; } -#ifdef NS_IMPL_COCOA - if ([families count] == 0) - [families addObject: @"LastResort"]; -#endif [scriptToFamilies setObject: families forKey: script]; } @@ -734,11 +716,6 @@ when setting family in ns_spec_to_descriptor(). */ traits: traits & ~NSItalicFontMask weight: fixLeopardBug size: pixel_size]; } -#ifdef NS_IMPL_COCOA - /* LastResort not really a family */ - if (nsfont == nil && [@"LastResort" isEqualToString: family]) - nsfont = [NSFont fontWithName: @"LastResort" size: pixel_size]; -#endif if (nsfont == nil) { @@ -765,12 +742,7 @@ when setting family in ns_spec_to_descriptor(). */ font_info->metrics = xzalloc (0x100 * sizeof *font_info->metrics); /* for metrics */ -#ifdef NS_IMPL_COCOA - sfont = [nsfont screenFontWithRenderingMode: - NSFontAntialiasedIntegerAdvancementsRenderingMode]; -#else sfont = [nsfont screenFont]; -#endif if (sfont == nil) sfont = nsfont; @@ -797,11 +769,7 @@ when setting family in ns_spec_to_descriptor(). */ * intended. */ CGFloat adjusted_descender = [sfont descender] + 0.0001; -#ifdef NS_IMPL_GNUSTEP font_info->nsfont = sfont; -#else - font_info->nsfont = nsfont; -#endif [font_info->nsfont retain]; /* set up ns_font (defined in nsgui.h) */ @@ -834,32 +802,6 @@ when setting family in ns_spec_to_descriptor(). */ font_info->max_bounds.rbearing = lrint (brect.size.width - (CGFloat) font_info->width); -#ifdef NS_IMPL_COCOA - /* set up synthItal and the CG font */ - font_info->synthItal = synthItal; - { - ATSFontRef atsFont = ATSFontFindFromPostScriptName - ((CFStringRef)[nsfont fontName], kATSOptionFlagsDefault); - - if (atsFont == kATSFontRefUnspecified) - { - /* see if we can get it by dropping italic (then synthesizing) */ - atsFont = ATSFontFindFromPostScriptName ((CFStringRef) - [[fontMgr convertFont: nsfont toNotHaveTrait: NSItalicFontMask] - fontName], kATSOptionFlagsDefault); - if (atsFont != kATSFontRefUnspecified) - font_info->synthItal = YES; - else - { - /* last resort fallback */ - atsFont = ATSFontFindFromPostScriptName - ((CFStringRef)@"Monaco", kATSOptionFlagsDefault); - } - } - font_info->cgfont = CGFontCreateWithPlatformFont ((void *) &atsFont); - } -#endif - /* set up metrics portion of font struct */ font->ascent = lrint([sfont ascender]); font->descent = -lrint(floor(adjusted_descender)); @@ -901,9 +843,6 @@ when setting family in ns_spec_to_descriptor(). */ xfree (font_info->glyphs); xfree (font_info->metrics); [font_info->nsfont release]; -#ifdef NS_IMPL_COCOA - CGFontRelease (font_info->cgfont); -#endif xfree (font_info->name); font_info->name = NULL; } @@ -994,17 +933,12 @@ is false when (FROM > 0 || TO < S->nchars). */ { static unsigned char cbuf[1024]; unsigned char *c = cbuf; -#ifdef NS_IMPL_GNUSTEP #if GNUSTEP_GUI_MAJOR_VERSION > 0 || GNUSTEP_GUI_MINOR_VERSION > 22 static CGFloat advances[1024]; CGFloat *adv = advances; #else static float advances[1024]; float *adv = advances; -#endif -#else - static CGSize advances[1024]; - CGSize *adv = advances; #endif struct face *face; NSRect r; @@ -1073,11 +1007,7 @@ is false when (FROM > 0 || TO < S->nchars). */ else { cwidth = LGLYPH_WADJUST (glyph); -#ifdef NS_IMPL_GNUSTEP *(adv-1) += LGLYPH_XOFF (glyph); -#else - (*(adv-1)).width += LGLYPH_XOFF (glyph); -#endif } } } @@ -1088,12 +1018,8 @@ is false when (FROM > 0 || TO < S->nchars). */ cwidth = font->metrics[hi][lo].width; } twidth += cwidth; -#ifdef NS_IMPL_GNUSTEP *adv++ = cwidth; c += CHAR_STRING (*t, c); /* This converts the char to UTF-8. */ -#else - (*adv++).width = cwidth; -#endif } len = adv - advances; r.size.width = twidth; @@ -1192,61 +1118,6 @@ is false when (FROM > 0 || TO < S->nchars). */ DPSgrestore (context); } -#else /* NS_IMPL_COCOA */ - { - CGContextRef gcontext = - [[NSGraphicsContext currentContext] graphicsPort]; - static CGAffineTransform fliptf; - static BOOL firstTime = YES; - - if (firstTime) - { - firstTime = NO; - fliptf = CGAffineTransformMakeScale (1.0, -1.0); - } - - CGContextSaveGState (gcontext); - - // Used to be Fix2X (kATSItalicQDSkew), but Fix2X is deprecated - // and kATSItalicQDSkew is 0.25. - fliptf.c = font->synthItal ? 0.25 : 0.0; - - CGContextSetFont (gcontext, font->cgfont); - CGContextSetFontSize (gcontext, font->size); - if (NILP (ns_antialias_text) || font->size <= ns_antialias_threshold) - CGContextSetShouldAntialias (gcontext, 0); - else - CGContextSetShouldAntialias (gcontext, 1); - - CGContextSetTextMatrix (gcontext, fliptf); - - if (bgCol != nil) - { - /* foreground drawing; erase first to avoid overstrike */ - [bgCol set]; - CGContextSetTextDrawingMode (gcontext, kCGTextFillStroke); - CGContextSetTextPosition (gcontext, r.origin.x, r.origin.y); - CGContextShowGlyphsWithAdvances (gcontext, s->char2b, advances, len); - CGContextSetTextDrawingMode (gcontext, kCGTextFill); - } - - [col set]; - - CGContextSetTextPosition (gcontext, r.origin.x, r.origin.y); - CGContextShowGlyphsWithAdvances (gcontext, s->char2b + from, - advances, len); - - if (face->overstrike) - { - CGContextSetTextPosition (gcontext, r.origin.x+0.5, r.origin.y); - CGContextShowGlyphsWithAdvances (gcontext, s->char2b + from, - advances, len); - } - - CGContextRestoreGState (gcontext); - } -#endif /* NS_IMPL_COCOA */ - unblock_input (); return to-from; } @@ -1264,10 +1135,6 @@ is false when (FROM > 0 || TO < S->nchars). */ static void ns_uni_to_glyphs (struct nsfont_info *font_info, unsigned char block) { -#ifdef NS_IMPL_COCOA - static EmacsGlyphStorage *glyphStorage; - static char firstTime = 1; -#endif unichar *unichars = xmalloc (0x101 * sizeof (unichar)); unsigned int i, g, idx; unsigned short *glyphs; @@ -1278,14 +1145,6 @@ is false when (FROM > 0 || TO < S->nchars). */ block_input (); -#ifdef NS_IMPL_COCOA - if (firstTime) - { - firstTime = 0; - glyphStorage = [[EmacsGlyphStorage alloc] initWithCapacity: 0x100]; - } -#endif - font_info->glyphs[block] = xmalloc (0x100 * sizeof (unsigned short)); if (!unichars || !(font_info->glyphs[block])) emacs_abort (); @@ -1299,38 +1158,16 @@ is false when (FROM > 0 || TO < S->nchars). */ unichars[0x100] = 0; { -#ifdef NS_IMPL_COCOA - NSString *allChars = [[NSString alloc] - initWithCharactersNoCopy: unichars - length: 0x100 - freeWhenDone: NO]; - NSGlyphGenerator *glyphGenerator = [NSGlyphGenerator sharedGlyphGenerator]; - /* NSCharacterSet *coveredChars = [nsfont coveredCharacterSet]; */ - unsigned int numGlyphs = [font_info->nsfont numberOfGlyphs]; - NSUInteger gInd = 0, cInd = 0; - - [glyphStorage setString: allChars font: font_info->nsfont]; - [glyphGenerator generateGlyphsForGlyphStorage: glyphStorage - desiredNumberOfCharacters: glyphStorage->maxChar - glyphIndex: &gInd characterIndex: &cInd]; -#endif glyphs = font_info->glyphs[block]; for (i = 0; i < 0x100; i++, glyphs++) { -#ifdef NS_IMPL_GNUSTEP g = unichars[i]; -#else g = glyphStorage->cglyphs[i]; /* TODO: is this a good check? Maybe need to use coveredChars. */ if (g > numGlyphs || g == NSNullGlyph) g = INVALID_GLYPH; /* Hopefully unused... */ -#endif *glyphs = g; } - -#ifdef NS_IMPL_COCOA - [allChars release]; -#endif } unblock_input (); @@ -1352,19 +1189,12 @@ is false when (FROM > 0 || TO < S->nchars). */ fprintf (stderr, "%p\tComputing metrics for glyphs in block %d\n", font_info, block); -#ifdef NS_IMPL_GNUSTEP /* not implemented yet (as of startup 0.18), so punt */ if (numGlyphs == 0) numGlyphs = 0x10000; -#endif block_input (); -#ifdef NS_IMPL_COCOA - sfont = [font_info->nsfont screenFontWithRenderingMode: - NSFontAntialiasedIntegerAdvancementsRenderingMode]; -#else sfont = [font_info->nsfont screenFont]; -#endif font_info->metrics[block] = xzalloc (0x100 * sizeof (struct font_metrics)); if (!(font_info->metrics[block])) @@ -1397,76 +1227,6 @@ is false when (FROM > 0 || TO < S->nchars). */ } -#ifdef NS_IMPL_COCOA -/* Helper for font glyph setup. */ -@implementation EmacsGlyphStorage - -- init -{ - return [self initWithCapacity: 1024]; -} - -- initWithCapacity: (unsigned long) c -{ - self = [super init]; - maxChar = 0; - maxGlyph = 0; - dict = [NSMutableDictionary new]; - cglyphs = xmalloc (c * sizeof (CGGlyph)); - return self; -} - -- (void) dealloc -{ - if (attrStr != nil) - [attrStr release]; - [dict release]; - xfree (cglyphs); - [super dealloc]; -} - -- (void) setString: (NSString *)str font: (NSFont *)font -{ - [dict setObject: font forKey: NSFontAttributeName]; - if (attrStr != nil) - [attrStr release]; - attrStr = [[NSAttributedString alloc] initWithString: str attributes: dict]; - maxChar = [str length]; - maxGlyph = 0; -} - -/* NSGlyphStorage protocol */ -- (NSUInteger)layoutOptions -{ - return 0; -} - -- (NSAttributedString *)attributedString -{ - return attrStr; -} - -- (void)insertGlyphs: (const NSGlyph *)glyphs length: (NSUInteger)length - forStartingGlyphAtIndex: (NSUInteger)glyphIndex - characterIndex: (NSUInteger)charIndex -{ - len = glyphIndex+length; - for (i =glyphIndex; i maxGlyph) - maxGlyph = len; -} - -- (void)setIntAttribute: (NSInteger)attributeTag value: (NSInteger)val - forGlyphAtIndex: (NSUInteger)glyphIndex -{ - return; -} - -@end -#endif /* NS_IMPL_COCOA */ - - /* Debugging */ void ns_dump_glyphstring (struct glyph_string *s) diff --git a/src/nsterm.h b/src/nsterm.h index b56bcad4dc..0bdb78e443 100644 --- a/src/nsterm.h +++ b/src/nsterm.h @@ -718,22 +718,6 @@ typedef id instancetype; ========================================================================== */ -#ifdef NS_IMPL_COCOA -/* rendering util */ -@interface EmacsGlyphStorage : NSObject -{ -@public - NSAttributedString *attrStr; - NSMutableDictionary *dict; - CGGlyph *cglyphs; - unsigned long maxChar, maxGlyph; - long i, len; -} -- (instancetype)initWithCapacity: (unsigned long) c; -- (void) setString: (NSString *)str font: (NSFont *)font; -@end -#endif /* NS_IMPL_COCOA */ - extern NSArray *ns_send_types, *ns_return_types; extern NSString *ns_app_name; extern EmacsMenu *svcsMenu; @@ -811,6 +795,7 @@ struct ns_color_table #define GREEN16_FROM_ULONG(color) (GREEN_FROM_ULONG(color) * 0x101) #define BLUE16_FROM_ULONG(color) (BLUE_FROM_ULONG(color) * 0x101) +#ifdef NS_IMPL_GNUSTEP /* this extends font backend font */ struct nsfont_info { @@ -827,14 +812,8 @@ struct nsfont_info float size; #ifdef __OBJC__ NSFont *nsfont; -#if defined (NS_IMPL_COCOA) - CGFontRef cgfont; -#else /* GNUstep */ - void *cgfont; -#endif #else /* ! OBJC */ void *nsfont; - void *cgfont; #endif char bold, ital; /* convenience flags */ char synthItal; @@ -844,7 +823,7 @@ struct nsfont_info unsigned short **glyphs; /* map Unicode index to glyph */ struct font_metrics **metrics; }; - +#endif /* Initialized in ns_initialize_display_info (). */ struct ns_display_info @@ -1107,7 +1086,7 @@ extern void ns_term_shutdown (int sig); #define NS_DUMPGLYPH_MOUSEFACE 3 - +#ifdef NS_IMPL_GNUSTEP /* In nsfont, called from fontset.c */ extern void nsfont_make_fontset_for_font (Lisp_Object name, Lisp_Object font_object); @@ -1115,6 +1094,7 @@ extern void nsfont_make_fontset_for_font (Lisp_Object name, /* In nsfont, for debugging */ struct glyph_string; void ns_dump_glyphstring (struct glyph_string *s) EXTERNALLY_VISIBLE; +#endif /* Implemented in nsterm, published in or needed from nsfns. */ extern Lisp_Object ns_list_fonts (struct frame *f, Lisp_Object pattern, diff --git a/src/nsterm.m b/src/nsterm.m index 4b1cf65964..ec96be3d2f 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -3194,10 +3194,12 @@ so some key presses (TAB) are swallowed by the system. */ else { s->left_overhang = 0; +#ifdef NS_IMPL_GNUSTEP if (EQ (font->driver->type, Qns)) s->right_overhang = ((struct nsfont_info *)font)->ital ? FONT_HEIGHT (font) * 0.2 : 0; else +#endif s->right_overhang = 0; } } commit c4c5db3de70b55f8bc03c9fee35e29d60f41f16e Author: Alan Third Date: Wed Sep 23 13:57:50 2020 +0100 Implement internal border colors on NS (bug#41071) * src/nsterm.m (ns_clear_under_internal_border): New function. (ns_after_update_window_line): Use the correct background color. (ns_redisplay_interface): Add ns_clear_under_internal_border. diff --git a/src/nsterm.m b/src/nsterm.m index 5e5d09f058..4b1cf65964 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -3052,6 +3052,40 @@ so some key presses (TAB) are swallowed by the system. */ } +static void +ns_clear_under_internal_border (struct frame *f) +{ + NSTRACE ("ns_clear_under_internal_border"); + + if (FRAME_INTERNAL_BORDER_WIDTH (f) > 0) + { + int border_width = FRAME_INTERNAL_BORDER_WIDTH (f); + NSView *view = FRAME_NS_VIEW (f); + NSRect edge_rect, frame_rect = [view bounds]; + NSRectEdge edge[] = {NSMinXEdge, NSMinYEdge, NSMaxXEdge, NSMaxYEdge}; + + int face_id = + !NILP (Vface_remapping_alist) + ? lookup_basic_face (NULL, f, INTERNAL_BORDER_FACE_ID) + : INTERNAL_BORDER_FACE_ID; + struct face *face = FACE_FROM_ID_OR_NULL (f, face_id); + + if (!face) + face = FRAME_DEFAULT_FACE (f); + + ns_focus (f, &frame_rect, 1); + [ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), f) set]; + for (int i = 0; i < 4 ; i++) + { + NSDivideRect (frame_rect, &edge_rect, &frame_rect, border_width, edge[i]); + + NSRectFill (edge_rect); + } + ns_unfocus (f); + } +} + + static void ns_after_update_window_line (struct window *w, struct glyph_row *desired_row) /* -------------------------------------------------------------------------- @@ -3080,12 +3114,32 @@ so some key presses (TAB) are swallowed by the system. */ height > 0)) { int y = WINDOW_TO_FRAME_PIXEL_Y (w, max (0, desired_row->y)); + int face_id = + !NILP (Vface_remapping_alist) + ? lookup_basic_face (NULL, f, INTERNAL_BORDER_FACE_ID) + : INTERNAL_BORDER_FACE_ID; + struct face *face = FACE_FROM_ID_OR_NULL (f, face_id); block_input (); - ns_clear_frame_area (f, 0, y, width, height); - ns_clear_frame_area (f, - FRAME_PIXEL_WIDTH (f) - width, - y, width, height); + if (face) + { + NSRect r = NSMakeRect (0, y, FRAME_PIXEL_WIDTH (f), height); + ns_focus (f, &r, 1); + + [ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), f) set]; + NSRectFill (NSMakeRect (0, y, width, height)); + NSRectFill (NSMakeRect (FRAME_PIXEL_WIDTH (f) - width, + y, width, height)); + + ns_unfocus (f); + } + else + { + ns_clear_frame_area (f, 0, y, width, height); + ns_clear_frame_area (f, + FRAME_PIXEL_WIDTH (f) - width, + y, width, height); + } unblock_input (); } } @@ -5301,7 +5355,7 @@ static Lisp_Object ns_string_to_lispmod (const char *s) ns_draw_glyph_string, ns_define_frame_cursor, ns_clear_frame_area, - 0, /* clear_under_internal_border */ + ns_clear_under_internal_border, /* clear_under_internal_border */ ns_draw_window_cursor, ns_draw_vertical_window_border, ns_draw_window_divider, commit 497a1ed8bba528bf4078c80bb00b29870eb01e6f Author: Mattias Engdegård Date: Fri Sep 25 17:00:17 2020 +0200 string-search robustness and documentation improvement (bug#43598) * src/fns.c (Fstring_search): Check START-POS argument range. Simplify logic. Improve doc string. * test/src/fns-tests.el (string-search): Add test cases. * doc/lispref/strings.texi (Text Comparison): Elaborate. * lisp/emacs-lisp/byte-opt.el (pure-fns): Mark string-search as pure. diff --git a/doc/lispref/strings.texi b/doc/lispref/strings.texi index 6eb3d6f310..0f157c39d6 100644 --- a/doc/lispref/strings.texi +++ b/doc/lispref/strings.texi @@ -660,8 +660,10 @@ ignores case differences. Return the position of the first instance of @var{needle} in @var{haystack}, both of which are strings. If @var{start-pos} is non-@code{nil}, start searching from that position in @var{needle}. +Return @code{nil} if no match was found. This function only considers the characters in the strings when doing -the comparison; text properties are ignored. +the comparison; text properties are ignored. Matching is always +case-sensitive. @end defun @defun compare-strings string1 start1 end1 string2 start2 end2 &optional ignore-case diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el index 2c95c87060..8a6c0b9a7f 100644 --- a/lisp/emacs-lisp/byte-opt.el +++ b/lisp/emacs-lisp/byte-opt.el @@ -1264,6 +1264,7 @@ floor ceiling round truncate ffloor fceiling fround ftruncate string= string-equal string< string-lessp + string-search consp atom listp nlistp propert-list-p sequencep arrayp vectorp stringp bool-vector-p hash-table-p null not diff --git a/src/fns.c b/src/fns.c index 3927e4306e..2f64d95576 100644 --- a/src/fns.c +++ b/src/fns.c @@ -5456,15 +5456,18 @@ It should not be used for anything security-related. See DEFUN ("string-search", Fstring_search, Sstring_search, 2, 3, 0, doc: /* Search for the string NEEDLE in the string HAYSTACK. -The return value is the position of the first instance of NEEDLE in -HAYSTACK. +The return value is the position of the first occurrence of NEEDLE in +HAYSTACK, or nil if no match was found. The optional START-POS argument says where to start searching in -HAYSTACK. If not given, start at the beginning. */) +HAYSTACK and defaults to zero (start at the beginning). +It must be between zero and the length of HAYSTACK, inclusive. + +Case is always significant and text properties are ignored. */) (register Lisp_Object needle, Lisp_Object haystack, Lisp_Object start_pos) { ptrdiff_t start_byte = 0, haybytes; - char *res = NULL, *haystart; + char *res, *haystart; CHECK_STRING (needle); CHECK_STRING (haystack); @@ -5472,7 +5475,10 @@ HAYSTACK. If not given, start at the beginning. */) if (!NILP (start_pos)) { CHECK_FIXNUM (start_pos); - start_byte = string_char_to_byte (haystack, XFIXNUM (start_pos)); + EMACS_INT start = XFIXNUM (start_pos); + if (start < 0 || start > SCHARS (haystack)) + xsignal1 (Qargs_out_of_range, start_pos); + start_byte = string_char_to_byte (haystack, start); } haystart = SSDATA (haystack) + start_byte; @@ -5481,13 +5487,13 @@ HAYSTACK. If not given, start at the beginning. */) if (STRING_MULTIBYTE (haystack) == STRING_MULTIBYTE (needle)) res = memmem (haystart, haybytes, SSDATA (needle), SBYTES (needle)); - else if (STRING_MULTIBYTE (haystack) && !STRING_MULTIBYTE (needle)) + else if (STRING_MULTIBYTE (haystack)) /* unibyte needle */ { Lisp_Object multi_needle = string_to_multibyte (needle); res = memmem (haystart, haybytes, SSDATA (multi_needle), SBYTES (multi_needle)); } - else if (!STRING_MULTIBYTE (haystack) && STRING_MULTIBYTE (needle)) + else /* unibyte haystack, multibyte needle */ { Lisp_Object uni_needle = Fstring_as_unibyte (needle); res = memmem (haystart, haybytes, diff --git a/test/src/fns-tests.el b/test/src/fns-tests.el index 8c2b1300dc..323743d842 100644 --- a/test/src/fns-tests.el +++ b/test/src/fns-tests.el @@ -907,6 +907,12 @@ (should (equal (string-search "foo" "foobarzot") 0)) (should (not (string-search "fooz" "foobarzot"))) (should (not (string-search "zot" "foobarzo"))) + (should (equal (string-search "ab" "ab") 0)) + (should (equal (string-search "ab\0" "ab") nil)) + (should (equal (string-search "ab" "abababab" 3) 4)) + (should (equal (string-search "ab" "ababac" 3) nil)) + (let ((case-fold-search t)) + (should (equal (string-search "ab" "AB") nil))) (should (equal (string-search (make-string 2 130) @@ -923,4 +929,26 @@ (should (not (string-search (make-string 1 255) "a\377ø"))) (should (not (string-search (make-string 1 255) "a\377a"))) - (should (equal (string-search "fóo" "zotfóo") 3))) + (should (equal (string-search "fóo" "zotfóo") 3)) + + (should (equal (string-search (string-to-multibyte "\377") "ab\377c") 2)) + (should (equal (string-search "\303" "aøb") nil)) + (should (equal (string-search "\270" "aøb") nil)) + ;; This test currently fails, but it shouldn't! + ;;(should (equal (string-search "ø" "\303\270") nil)) + + (should-error (string-search "a" "abc" -1)) + (should-error (string-search "a" "abc" 4)) + (should-error (string-search "a" "abc" 100000000000)) + + (should (equal (string-search "a" "aaa" 3) nil)) + (should (equal (string-search "\0" "") nil)) + + (should (equal (string-search "" "") 0)) + (should-error (string-search "" "" 1)) + (should (equal (string-search "" "abc") 0)) + (should (equal (string-search "" "abc" 2) 2)) + (should (equal (string-search "" "abc" 3) 3)) + (should-error (string-search "" "abc" 4)) + (should-error (string-search "" "abc" -1)) + ) commit 499848d8407855d8ca24f0c175c602a0f24da074 Author: Noam Postavsky Date: Fri Sep 25 16:10:56 2020 +0200 * CONTRIBUTE: Don't recommend action stamps * CONTRIBUTE: Remove mention of the "action stamp" thing (bug#20609). diff --git a/CONTRIBUTE b/CONTRIBUTE index 4e42c7aafc..cb09391c32 100644 --- a/CONTRIBUTE +++ b/CONTRIBUTE @@ -257,13 +257,12 @@ them right the first time, so here are guidelines for formatting them: - There is no standard or recommended way to identify revisions in ChangeLog entries. Using Git SHA1 values limits the usability of the references to Git, and will become much less useful if Emacs - switches to a different VCS. So we recommend against that. + switches to a different VCS. So we recommend against doing only that. One way to identify revisions is by quoting their summary line. - Another is with an action stamp - an RFC3339 date followed by ! - followed by the committer's email - for example, - "2014-01-16T05:43:35Z!esr@thyrsus.com". Often, "my previous commit" - will suffice. + Prefixing the summary with the commit date can give useful context + (use 'git show -s "--pretty=format:%cd \"%s\"" --date=short HASH' to + produce that). Often, "my previous commit" will suffice. - There is no need to mention files such as NEWS and MAINTAINERS, or to indicate regeneration of files such as 'lib/gnulib.mk', in the commit 307b6f935318b7de23feeba72f66e6fecb0e79d0 Author: Lars Ingebrigtsen Date: Fri Sep 25 16:06:35 2020 +0200 Partially revert previous prolog.el cleanup * lisp/progmodes/prolog.el (prolog-font-lock-keywords): Partially revert previous patch -- we want the prolog-warning-face symbol, not its value. diff --git a/lisp/progmodes/prolog.el b/lisp/progmodes/prolog.el index a82fd38803..124f652ed6 100644 --- a/lisp/progmodes/prolog.el +++ b/lisp/progmodes/prolog.el @@ -1997,7 +1997,7 @@ Argument BOUND is a buffer position limiting searching." (if (eq prolog-system 'mercury) (list (regexp-opt prolog-directives-i 'words) - 0 prolog-warning-face))) + 0 'prolog-warning-face))) ;; Inferior mode specific patterns (prompt ;; FIXME: Should be handled by comint already. commit 6c7fad4ac48c1f3093438be7037496f8a9357bcd Author: Lars Ingebrigtsen Date: Fri Sep 25 15:42:35 2020 +0200 Fix defcustom type in sql.el for sql-postgres-login-params * lisp/progmodes/sql.el (sql-login-params): Fix defcustom type to match sql-postgres-login-params value. diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el index 814a1ad8a3..c31c5ddd87 100644 --- a/lisp/progmodes/sql.el +++ b/lisp/progmodes/sql.el @@ -342,8 +342,7 @@ file. Since that is a plaintext file, this could be dangerous." (const :format "" :completion) (sexp :tag ":completion") (const :format "" :must-match) - (restricted-sexp - :match-alternatives (listp stringp)))) + (symbol :tag ":must-match"))) (const port))) ;; SQL Product support commit c27096296f97c86a05b0ffb099172cefe92b89f7 Author: Lars Ingebrigtsen Date: Fri Sep 25 15:38:53 2020 +0200 Fix a defcustom type in gdb-mi.el * lisp/progmodes/gdb-mi.el (gdb-display-source-buffer-action): Fix defcustom type to match the value. diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el index c71574ec3c..086f0b6a08 100644 --- a/lisp/progmodes/gdb-mi.el +++ b/lisp/progmodes/gdb-mi.el @@ -650,7 +650,7 @@ Note that this variable only takes effect when variable (defcustom gdb-display-source-buffer-action '(nil . ((inhibit-same-window . t))) "`display-buffer' action used when GDB displays a source buffer." - :type 'list + :type 'sexp :group 'gdb :version "28.1") commit a9ad0bbf14db51d44ad787892cc85eb9ebc397e7 Author: Lars Ingebrigtsen Date: Fri Sep 25 15:35:23 2020 +0200 Fix defcustom type in whitespace.el * lisp/whitespace.el (whitespace-space-after-tab-regexp) (whitespace-indentation-regexp): The first string here isn't a regexp, it's a string (that's expanded with format to be a regexp). diff --git a/lisp/whitespace.el b/lisp/whitespace.el index 8355105303..2e05d93bf5 100644 --- a/lisp/whitespace.el +++ b/lisp/whitespace.el @@ -728,7 +728,7 @@ and the cons cdr is used for TABs visualization. Used when `whitespace-style' includes `indentation', `indentation::tab' or `indentation::space'." - :type '(cons (regexp :tag "Indentation SPACEs") + :type '(cons (string :tag "Indentation SPACEs") (regexp :tag "Indentation TABs")) :group 'whitespace) @@ -759,8 +759,8 @@ and the cons cdr is used for TABs visualization. Used when `whitespace-style' includes `space-after-tab', `space-after-tab::tab' or `space-after-tab::space'." - :type '(cons (regexp :tag "SPACEs After TAB") - regexp) + :type '(cons (string :tag "SPACEs After TAB") + string) :group 'whitespace) (defcustom whitespace-big-indent-regexp commit bf1b3714cc5ebae7cdd0100fdb1bf2e90c56511e Author: Lars Ingebrigtsen Date: Fri Sep 25 15:17:36 2020 +0200 Fix the defcustom type fix in python.el * lisp/progmodes/python.el (python-pdbtrack-exit-command): Fix defcustom type (bug#30990). diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 68081b80aa..95b6a037bb 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -3805,7 +3805,7 @@ After one of this commands is sent to pdb, pdbtracking session is considered over. See `python-pdbtrack-activate' for pdbtracking session overview." - :type '(repeast string) + :type '(repeat string) :version "27.1") (defcustom python-pdbtrack-kill-buffers t commit e1c33e29d58175e159443babd96f230eb0bb4a88 Author: Lars Ingebrigtsen Date: Fri Sep 25 15:15:21 2020 +0200 Fix some defcustom types * lisp/whitespace.el (whitespace-style): * lisp/gnus/message.el (message-screenshot-command): * lisp/progmodes/compile.el (compilation-transform-file-match-alist): * lisp/progmodes/gdb-mi.el (gdb-default-window-configuration-file): * lisp/progmodes/python.el (python-pdbtrack-exit-command): Fix the defcustom types. * lisp/progmodes/sql.el (sql-password-wallet): Fix the value. diff --git a/lisp/erc/erc-status-sidebar.el b/lisp/erc/erc-status-sidebar.el index ab9883665d..08dc8d6015 100644 --- a/lisp/erc/erc-status-sidebar.el +++ b/lisp/erc/erc-status-sidebar.el @@ -68,7 +68,8 @@ (defcustom erc-status-sidebar-header-line-format nil "Header line format for the status sidebar." - :type 'string + :type '(choice (const :tag "No header line" nil) + string) :group 'erc-status-sidebar) (defcustom erc-status-sidebar-width 15 diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el index 4484b95075..b1147924ff 100644 --- a/lisp/gnus/gnus-art.el +++ b/lisp/gnus/gnus-art.el @@ -274,6 +274,7 @@ This can also be a list of the above values." If it is a string, the command will be executed in a sub-shell asynchronously. The compressed face will be piped to this command." :type '(choice string + (const :tag "None" nil) (function-item gnus-display-x-face-in-from) function) :version "27.1" diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index 16f47c8d4c..2ad479b59d 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -307,7 +307,7 @@ any confusion." "Command to take a screenshot. The command should insert a PNG in the current buffer." :group 'message-various - :type '(list string) + :type '(repeat string) :version "28.1") ;;; Start of variables adopted from `message-utils.el'. diff --git a/lisp/gnus/nnselect.el b/lisp/gnus/nnselect.el index 8cd658100f..21206b683c 100644 --- a/lisp/gnus/nnselect.el +++ b/lisp/gnus/nnselect.el @@ -257,7 +257,8 @@ Returns either the retrieved header format 'nov or 'headers. If this variable is nil, or if the provided function returns nil, `gnus-retrieve-headers' will be called instead." - :version "28.1" :type '(function) :group 'nnselect) + :version "28.1" + :type '(repeat function)) ;; Gnus backend interface functions. diff --git a/lisp/net/tramp-crypt.el b/lisp/net/tramp-crypt.el index c9788fcff5..3e96daa7b1 100644 --- a/lisp/net/tramp-crypt.el +++ b/lisp/net/tramp-crypt.el @@ -120,7 +120,7 @@ initializing a new crypted remote directory." "Whether to keep the encfs configuration file in the crypted remote directory." :group 'tramp :version "28.1" - :type 'booleanp) + :type 'boolean) ;;;###tramp-autoload (defvar tramp-crypt-directories nil diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index 06bdd1e98d..a408d16e37 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el @@ -64,7 +64,8 @@ If nil, use Emacs default." If the replacement is nil, the file will not be considered an error after all. If not nil, it should be a regexp replacement string." - :type '(repeat (list regexp string)) + :type '(repeat (list regexp (choice (const :tag "No replacement" nil) + string))) :version "27.1") (defvar compilation-filter-hook nil diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el index 8d6f8af232..c71574ec3c 100644 --- a/lisp/progmodes/gdb-mi.el +++ b/lisp/progmodes/gdb-mi.el @@ -643,7 +643,8 @@ and looks under `gdb-window-configuration-directory'. Note that this variable only takes effect when variable `gdb-many-windows' is t." - :type 'string + :type '(choice (const :tag "None" nil) + string) :group 'gdb :version "28.1") diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 7c3b611cd9..68081b80aa 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -3796,7 +3796,7 @@ was `continue'. This behavior slightly differentiates the `continue' command from the `exit' command listed in `python-pdbtrack-exit-command'. See `python-pdbtrack-activate' for pdbtracking session overview." - :type 'list + :type '(repeat string) :version "27.1") (defcustom python-pdbtrack-exit-command '("q" "quit" "exit") @@ -3805,7 +3805,7 @@ After one of this commands is sent to pdb, pdbtracking session is considered over. See `python-pdbtrack-activate' for pdbtracking session overview." - :type 'list + :type '(repeast string) :version "27.1") (defcustom python-pdbtrack-kill-buffers t diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el index e554b2b8b0..814a1ad8a3 100644 --- a/lisp/progmodes/sql.el +++ b/lisp/progmodes/sql.el @@ -838,11 +838,11 @@ host key." (setq w (locate-user-emacs-file (concat "sql-wallet" ext) (concat ".sql-wallet" ext))) (when (file-exists-p w) - (setq wallet w))))) + (setq wallet (list w)))))) "Identification of the password wallet. See `sql-password-search-wallet-function' to understand how this value is used to locate the password wallet." - :type `(plist-get (symbol-plist 'auth-sources) 'custom-type) + :type (plist-get (symbol-plist 'auth-sources) 'custom-type) :version "27.1") (defvar sql-password-search-wallet-function #'sql-auth-source-search-wallet diff --git a/lisp/whitespace.el b/lisp/whitespace.el index 8a1bb8ade8..8355105303 100644 --- a/lisp/whitespace.el +++ b/lisp/whitespace.el @@ -445,6 +445,8 @@ See also `whitespace-display-mappings' for documentation." (const :tag "(Face) Lines" lines) (const :tag "(Face) Lines, only overlong part" lines-tail) (const :tag "(Face) NEWLINEs" newline) + (const :tag "(Face) Missing newlines at EOB" + missing-newline-at-eof) (const :tag "(Face) Empty Lines At BOB And/Or EOB" empty) (const :tag "(Face) Indentation SPACEs" indentation::tab) (const :tag "(Face) Indentation TABs" commit 664927b5257fdaf26f24063edb1f41c407805ed8 Author: Lars Ingebrigtsen Date: Fri Sep 25 14:46:36 2020 +0200 Add an expensive test for defcustom types * admin/cus-test.el (cus-test-opts): Return the tests. * test/lisp/custom-tests.el (check-for-wrong-custom-types): Test custom types (bug#30990). diff --git a/admin/cus-test.el b/admin/cus-test.el index 842240946e..cee8c19ba1 100644 --- a/admin/cus-test.el +++ b/admin/cus-test.el @@ -370,7 +370,9 @@ This function is suitable for batch mode. E.g., invoke in the Emacs source directory. Normally only tests options belonging to files in loaddefs.el. -If optional argument ALL is non-nil, test all files with defcustoms." +If optional argument ALL is non-nil, test all files with defcustoms. + +Returns a list of variables with suspicious types." (interactive) (and noninteractive command-line-args-left @@ -382,9 +384,12 @@ If optional argument ALL is non-nil, test all files with defcustoms." (message "Running %s" 'cus-test-apropos) (cus-test-apropos "") (if (not cus-test-errors) - (message "No problems found") + (progn + (message "No problems found") + nil) (message "The following options might have problems:") - (cus-test-message cus-test-errors))) + (cus-test-message cus-test-errors) + cus-test-errors)) (defun cus-test-deps () "Run a verbose version of `custom-load-symbol' on all atoms. diff --git a/test/lisp/custom-tests.el b/test/lisp/custom-tests.el index cabbf861f1..d94527b558 100644 --- a/test/lisp/custom-tests.el +++ b/test/lisp/custom-tests.el @@ -147,4 +147,9 @@ (widget-apply field :value-to-internal origvalue) "bar")))))) +(ert-deftest check-for-wrong-custom-types () + :tags '(:expensive-test) + (load (concat installation-directory "admin/cus-test.el")) + (should (null (cus-test-opts t)))) + ;;; custom-tests.el ends here commit 79762ffa618ba0f0b8b4483c1cca8ccb1aab2606 Author: Lars Ingebrigtsen Date: Fri Sep 25 14:30:13 2020 +0200 Mark string-search as being side effect free * lisp/emacs-lisp/byte-opt.el (side-effect-free-fns): Add string-search. diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el index 4987596bf9..2c95c87060 100644 --- a/lisp/emacs-lisp/byte-opt.el +++ b/lisp/emacs-lisp/byte-opt.el @@ -1173,7 +1173,8 @@ degrees-to-radians radians-to-degrees rassq rassoc read-from-string regexp-quote region-beginning region-end reverse round - sin sqrt string string< string= string-equal string-lessp string-to-char + sin sqrt string string< string= string-equal string-lessp + string-search string-to-char string-to-number substring sxhash sxhash-equal sxhash-eq sxhash-eql symbol-function symbol-name symbol-plist symbol-value string-make-unibyte commit 9fd9c9c2c00a95640b32b63dc20041ec6d512f0b Author: Noam Postavsky Date: Fri Sep 25 13:39:24 2020 +0200 Make the Man completion code work better if man -k fails * lisp/man.el (Man-completion-table): Check the return code for "man -k" and assume it failed if there's a non-zero exit code (bug#16722). diff --git a/lisp/man.el b/lisp/man.el index 5ee60cae9f..bd55d7eff0 100644 --- a/lisp/man.el +++ b/lisp/man.el @@ -927,15 +927,18 @@ foo(sec)[, bar(sec) [, ...]] [other stuff] - description" ;; run differently in Man-getpage-in-background, an error ;; here may not necessarily mean that we'll also get an ;; error later. - (ignore-errors - (call-process manual-program nil '(t nil) nil - "-k" (concat (when (or Man-man-k-use-anchor - (string-equal prefix "")) - "^") - prefix)))) - (setq table (Man-parse-man-k))) + (when (eq 0 + (ignore-errors + (call-process + manual-program nil '(t nil) nil + "-k" (concat (when (or Man-man-k-use-anchor + (string-equal prefix "")) + "^") + prefix)))) + (setq table (Man-parse-man-k))))) ;; Cache the table for later reuse. - (setq Man-completion-cache (cons prefix table))) + (when table + (setq Man-completion-cache (cons prefix table)))) ;; The table may contain false positives since the match is made ;; by "man -k" not just on the manpage's name. (if section commit 830e876d94a8cfc5a516e7fcd867525754508cf3 Author: Tino Calancha Date: Fri Sep 25 13:25:08 2020 +0200 Use the char history in zap-up-to-char * lisp/misc.el (zap-up-to-char): Use read-char-from-minibuffer (bug#39154). diff --git a/etc/NEWS b/etc/NEWS index 9cd8aaa41c..4cd40c3657 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1064,6 +1064,13 @@ window after starting). This variable defaults to nil. ** Miscellaneous +--- +*** 'zap-up-to-char' now uses 'read-char-from-minibuffer'. +This allows navigating through the history of characters that have +been input. This is mostly useful for characters that have complex +input methods where inputting the character again may involve many +keystrokes. + +++ *** Interactive regular expression search now uses faces for sub-groups. E.g., 'C-M-s foo-\([0-9]+\)' will now use the 'isearch-group-1' face diff --git a/lisp/misc.el b/lisp/misc.el index 8c39492784..be191c50d2 100644 --- a/lisp/misc.el +++ b/lisp/misc.el @@ -69,7 +69,9 @@ The characters copied are inserted in the buffer before point." Case is ignored if `case-fold-search' is non-nil in the current buffer. Goes backward if ARG is negative; error if CHAR not found. Ignores CHAR at point." - (interactive "p\ncZap up to char: ") + (interactive (list (prefix-numeric-value current-prefix-arg) + (read-char-from-minibuffer "Zap up to char: " + nil 'read-char-history))) (let ((direction (if (>= arg 0) 1 -1))) (kill-region (point) (progn commit 8a253a96a0db4dd585ab787345657d952c7babec Author: Mattias Engdegård Date: Fri Sep 25 13:15:42 2020 +0200 Fix replace-in-string infloop with empty pattern string (bug#43598) * lisp/subr.el (replace-in-string): Raise an error if FROMSTRING is empty. * test/lisp/subr-tests.el (replace-in-string): Add test case. diff --git a/lisp/subr.el b/lisp/subr.el index 33ed0bc936..fba31b7cf7 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -4432,6 +4432,8 @@ Unless optional argument INPLACE is non-nil, return a new string." (defun replace-in-string (fromstring tostring instring) "Replace FROMSTRING with TOSTRING in INSTRING each time it occurs." (declare (pure t)) + (when (equal fromstring "") + (signal 'wrong-length-argument fromstring)) (let ((start 0) (result nil) pos) diff --git a/test/lisp/subr-tests.el b/test/lisp/subr-tests.el index fa728e430f..505408fa11 100644 --- a/test/lisp/subr-tests.el +++ b/test/lisp/subr-tests.el @@ -464,7 +464,9 @@ See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=19350." (should (equal (replace-in-string "\377" "x" "a\377b") "axb")) (should (equal (replace-in-string "\377" "x" "a\377ø") - "axø"))) + "axø")) + + (should-error (replace-in-string "" "x" "abc"))) (provide 'subr-tests) ;;; subr-tests.el ends here commit d964375ad3bc0ec3edbce0bfcf72a0a0d7dda426 Author: Lars Ingebrigtsen Date: Fri Sep 25 11:47:59 2020 +0200 Tweak updating the process mark in set-process-buffer * src/process.c (Fset_process_buffer): Only update the process mark if we actually change the buffer. diff --git a/src/process.c b/src/process.c index ee8dcbbf74..50c425077a 100644 --- a/src/process.c +++ b/src/process.c @@ -1227,11 +1227,14 @@ Return BUFFER. */) if (!NILP (buffer)) CHECK_BUFFER (buffer); p = XPROCESS (process); - pset_buffer (p, buffer); + if (!EQ (p->buffer, buffer)) + { + pset_buffer (p, buffer); + update_process_mark (p); + } if (NETCONN1_P (p) || SERIALCONN1_P (p) || PIPECONN1_P (p)) pset_childp (p, Fplist_put (p->childp, QCbuffer, buffer)); setup_process_coding_systems (process); - update_process_mark (p); return buffer; } commit d067ac5b9e956c8cdf2f61133e72ce580cf878d7 Author: Lars Ingebrigtsen Date: Fri Sep 25 11:37:45 2020 +0200 Remove more compat code from prolog.el * lisp/progmodes/prolog.el (prolog-font-lock-keywords): Remove compat test for a face that's always defined. diff --git a/lisp/progmodes/prolog.el b/lisp/progmodes/prolog.el index 43c5b8575d..a82fd38803 100644 --- a/lisp/progmodes/prolog.el +++ b/lisp/progmodes/prolog.el @@ -1913,6 +1913,8 @@ Argument BOUND is a buffer position limiting searching." (t (:underline t))) "Face name to use for compiler warnings." :group 'prolog-faces) + (define-obsolete-face-alias 'prolog-warning-face + 'font-lock-warning-face "28.1") (defface prolog-builtin-face '((((class color) (background light)) (:foreground "Purple")) (((class color) (background dark)) (:foreground "Cyan")) @@ -1922,15 +1924,11 @@ Argument BOUND is a buffer position limiting searching." (t (:bold t))) "Face name to use for compiler warnings." :group 'prolog-faces) - (defvar prolog-warning-face - (if (facep 'font-lock-warning-face) - 'font-lock-warning-face - 'prolog-warning-face) + (define-obsolete-face-alias 'prolog-builtin-face + 'font-lock-builtin-face "28.1") + (defvar prolog-warning-face 'font-lock-warning-face "Face name to use for built in predicates.") - (defvar prolog-builtin-face - (if (facep 'font-lock-builtin-face) - 'font-lock-builtin-face - 'prolog-builtin-face) + (defvar prolog-builtin-face 'font-lock-builtin-face "Face name to use for built in predicates.") (defvar prolog-redo-face 'prolog-redo-face "Face name to use for redo trace lines.") @@ -1999,7 +1997,7 @@ Argument BOUND is a buffer position limiting searching." (if (eq prolog-system 'mercury) (list (regexp-opt prolog-directives-i 'words) - 0 'prolog-warning-face))) + 0 prolog-warning-face))) ;; Inferior mode specific patterns (prompt ;; FIXME: Should be handled by comint already.