commit 5e5ee391d958980148227083120f176754e0edca (HEAD, refs/remotes/origin/master) Author: YAMAMOTO Mitsuharu Date: Sat Aug 29 17:03:55 2015 +0900 Use Core Text types/functions/variables/enumerators directly * src/macfont.h (FontDescriptorRef, FontRef, FontSymbolicTraits) (CharacterCollection): Remove typedefs. All uses replaced with definitions. (MAC_FONT_NAME_ATTRIBUTE, MAC_FONT_FAMILY_NAME_ATTRIBUTE) (MAC_FONT_TRAITS_ATTRIBUTE, MAC_FONT_SIZE_ATTRIBUTE) (MAC_FONT_CASCADE_LIST_ATTRIBUTE) (MAC_FONT_CHARACTER_SET_ATTRIBUTE, MAC_FONT_LANGUAGES_ATTRIBUTE) (MAC_FONT_FORMAT_ATTRIBUTE, MAC_FONT_SYMBOLIC_TRAIT) (MAC_FONT_WEIGHT_TRAIT, MAC_FONT_WIDTH_TRAIT) (MAC_FONT_SLANT_TRAIT): Remove macros. All uses replaced with definitions. (MAC_FONT_TRAIT_ITALIC, MAC_FONT_TRAIT_BOLD) (MAC_FONT_TRAIT_MONO_SPACE, MAC_FONT_TRAIT_COLOR_GLYPHS) (MAC_FONT_FORMAT_BITMAP) (MAC_CHARACTER_COLLECTION_IDENTITY_MAPPING) (MAC_CHARACTER_COLLECTION_ADOBE_JAPAN1): Remove enumerators. All uses replaced with definitions. (kCTFontTraitItalic, kCTFontTraitBold, kCTFontTraitMonoSpace) (kCTFontTraitColorGlyphs, kCTCharacterCollectionIdentityMapping) (kCTCharacterCollectionAdobeJapan1 kCTFontOrientationDefault): Add compatibility enumerators for older versions. (mac_font_descriptor_create_with_attributes) (mac_font_descriptor_create_matching_font_descriptors) (mac_font_descriptor_create_matching_font_descriptor) (mac_font_descriptor_copy_attribute) (mac_font_descriptor_supports_languages) (mac_font_create_with_name, mac_font_get_size) (mac_font_copy_family_name, mac_font_copy_character_set) (mac_font_get_glyphs_for_characters, mac_font_get_ascent) (mac_font_get_descent, mac_font_get_leading) (mac_font_get_underline_position) (mac_font_get_underline_thickness, mac_font_copy_graphics_font) (mac_font_copy_non_synthetic_table): Remove macros. All uses replaced with definitions. (mac_font_create_preferred_family_for_attributes) (mac_font_get_advance_width_for_glyph) (mac_font_get_bounding_rect_for_glyph) (mac_font_create_available_families, mac_font_shape): Remove macros for renamed functions. (mac_nsctfont_copy_font_descriptor): Remove unused macro. * src/macterm.m (mac_font_descriptor_supports_languages): Rename from mac_ctfont_descriptor_supports_languages. (mac_font_create_preferred_family_for_attributes): Rename from mac_ctfont_create_preferred_family_for_attributes. (mac_font_get_advance_width_for_glyph): Rename from mac_ctfont_get_advance_width_for_glyph. Use kCTFontOrientationDefault also for older versions. (mac_font_get_bounding_rect_for_glyph): Rename from mac_ctfont_get_bounding_rect_for_glyph. Use kCTFontOrientationDefault also for older versions. (mac_font_create_available_families): Rename from mac_ctfont_create_available_families. (mac_font_equal_in_postscript_name): Rename from mac_ctfont_equal_in_postscript_name. All uses changed. (mac_font_create_line_with_string_and_font): Rename from mac_ctfont_create_line_with_string_and_font. All uses changed. (mac_font_shape): Rename from mac_ctfont_shape. (mac_font_family_compare): Remove unused declaration. diff --git a/src/macfont.h b/src/macfont.h index 403be94..cab5737 100644 --- a/src/macfont.h +++ b/src/macfont.h @@ -45,82 +45,32 @@ struct mac_glyph_layout CGGlyph glyph_id; }; -typedef CTFontDescriptorRef FontDescriptorRef; -typedef CTFontRef FontRef; -typedef CTFontSymbolicTraits FontSymbolicTraits; -typedef NSCharacterCollection CharacterCollection; - -#define MAC_FONT_NAME_ATTRIBUTE kCTFontNameAttribute -#define MAC_FONT_FAMILY_NAME_ATTRIBUTE kCTFontFamilyNameAttribute -#define MAC_FONT_TRAITS_ATTRIBUTE kCTFontTraitsAttribute -#define MAC_FONT_SIZE_ATTRIBUTE kCTFontSizeAttribute -#define MAC_FONT_CASCADE_LIST_ATTRIBUTE kCTFontCascadeListAttribute -#define MAC_FONT_CHARACTER_SET_ATTRIBUTE kCTFontCharacterSetAttribute -#define MAC_FONT_LANGUAGES_ATTRIBUTE kCTFontLanguagesAttribute -#define MAC_FONT_FORMAT_ATTRIBUTE kCTFontFormatAttribute -#define MAC_FONT_SYMBOLIC_TRAIT kCTFontSymbolicTrait -#define MAC_FONT_WEIGHT_TRAIT kCTFontWeightTrait -#define MAC_FONT_WIDTH_TRAIT kCTFontWidthTrait -#define MAC_FONT_SLANT_TRAIT kCTFontSlantTrait - +#if MAC_OS_X_VERSION_MAX_ALLOWED < 1080 enum { - MAC_FONT_TRAIT_ITALIC = kCTFontItalicTrait, - MAC_FONT_TRAIT_BOLD = kCTFontBoldTrait, - MAC_FONT_TRAIT_MONO_SPACE = kCTFontMonoSpaceTrait, + kCTFontTraitItalic = kCTFontItalicTrait, + kCTFontTraitBold = kCTFontBoldTrait, + kCTFontTraitMonoSpace = kCTFontMonoSpaceTrait, #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 - MAC_FONT_TRAIT_COLOR_GLYPHS = kCTFontColorGlyphsTrait + kCTFontTraitColorGlyphs = kCTFontColorGlyphsTrait #else - MAC_FONT_TRAIT_COLOR_GLYPHS = (1 << 13) + kCTFontTraitColorGlyphs = (1 << 13) #endif }; enum { - MAC_FONT_FORMAT_BITMAP = kCTFontFormatBitmap + kCTCharacterCollectionIdentityMapping = kCTIdentityMappingCharacterCollection, + kCTCharacterCollectionAdobeJapan1 = kCTAdobeJapan1CharacterCollection }; enum { - MAC_CHARACTER_COLLECTION_IDENTITY_MAPPING = NSIdentityMappingCharacterCollection, - MAC_CHARACTER_COLLECTION_ADOBE_JAPAN1 = NSAdobeJapan1CharacterCollection + kCTFontOrientationDefault = kCTFontDefaultOrientation }; +#endif -#define mac_font_descriptor_create_with_attributes \ - CTFontDescriptorCreateWithAttributes -#define mac_font_descriptor_create_matching_font_descriptors \ - CTFontDescriptorCreateMatchingFontDescriptors -#define mac_font_descriptor_create_matching_font_descriptor \ - CTFontDescriptorCreateMatchingFontDescriptor -#define mac_font_descriptor_copy_attribute CTFontDescriptorCopyAttribute -#define mac_font_descriptor_supports_languages \ - mac_ctfont_descriptor_supports_languages -#define mac_font_create_with_name(name, size) \ - CTFontCreateWithName (name, size, NULL) -#define mac_font_get_size CTFontGetSize -#define mac_font_copy_family_name CTFontCopyFamilyName -#define mac_font_copy_character_set CTFontCopyCharacterSet -#define mac_font_get_glyphs_for_characters CTFontGetGlyphsForCharacters -#define mac_font_get_ascent CTFontGetAscent -#define mac_font_get_descent CTFontGetDescent -#define mac_font_get_leading CTFontGetLeading -#define mac_font_get_underline_position CTFontGetUnderlinePosition -#define mac_font_get_underline_thickness CTFontGetUnderlineThickness -#define mac_font_copy_graphics_font(font) CTFontCopyGraphicsFont (font, NULL) -#define mac_font_copy_non_synthetic_table(font, table) \ - CTFontCopyTable (font, table, kCTFontTableOptionNoOptions) - -#define mac_font_create_preferred_family_for_attributes \ - mac_ctfont_create_preferred_family_for_attributes -#define mac_font_get_advance_width_for_glyph \ - mac_ctfont_get_advance_width_for_glyph -#define mac_font_get_bounding_rect_for_glyph \ - mac_ctfont_get_bounding_rect_for_glyph -#define mac_font_create_available_families mac_ctfont_create_available_families -#define mac_font_shape mac_ctfont_shape #if USE_CT_GLYPH_INFO #define mac_font_get_glyph_for_cid mac_ctfont_get_glyph_for_cid #endif -#define mac_nsctfont_copy_font_descriptor CTFontCopyFontDescriptor - #ifndef kCTVersionNumber10_9 #define kCTVersionNumber10_9 0x00060000 #endif diff --git a/src/macfont.m b/src/macfont.m index d0d7252..23d272c 100644 --- a/src/macfont.m +++ b/src/macfont.m @@ -40,29 +40,21 @@ Original author: YAMAMOTO Mitsuharu static struct font_driver macfont_driver; -static double mac_ctfont_get_advance_width_for_glyph (CTFontRef, CGGlyph); -static CGRect mac_ctfont_get_bounding_rect_for_glyph (CTFontRef, CGGlyph); -static CFArrayRef mac_ctfont_create_available_families (void); -static Boolean mac_ctfont_equal_in_postscript_name (CTFontRef, CTFontRef); -static CTLineRef mac_ctfont_create_line_with_string_and_font (CFStringRef, - CTFontRef); -static CFComparisonResult mac_font_family_compare (const void *, - const void *, void *); -static Boolean mac_ctfont_descriptor_supports_languages (CTFontDescriptorRef, - CFArrayRef); -static CFStringRef mac_ctfont_create_preferred_family_for_attributes (CFDictionaryRef); -static CFIndex mac_ctfont_shape (CTFontRef, CFStringRef, - struct mac_glyph_layout *, CFIndex); -static CFArrayRef -mac_font_copy_default_descriptors_for_language (CFStringRef language); - -static CFStringRef -mac_font_copy_default_name_for_charset_and_languages (CFCharacterSetRef charset, - CFArrayRef languages); - +static double mac_font_get_advance_width_for_glyph (CTFontRef, CGGlyph); +static CGRect mac_font_get_bounding_rect_for_glyph (CTFontRef, CGGlyph); +static CFArrayRef mac_font_create_available_families (void); +static Boolean mac_font_equal_in_postscript_name (CTFontRef, CTFontRef); +static CTLineRef mac_font_create_line_with_string_and_font (CFStringRef, + CTFontRef); +static Boolean mac_font_descriptor_supports_languages (CTFontDescriptorRef, + CFArrayRef); +static CFStringRef mac_font_create_preferred_family_for_attributes (CFDictionaryRef); +static CFIndex mac_font_shape (CTFontRef, CFStringRef, + struct mac_glyph_layout *, CFIndex); +static CFArrayRef mac_font_copy_default_descriptors_for_language (CFStringRef); +static CFStringRef mac_font_copy_default_name_for_charset_and_languages (CFCharacterSetRef, CFArrayRef); #if USE_CT_GLYPH_INFO -static CGGlyph mac_ctfont_get_glyph_for_cid (CTFontRef, - CTCharacterCollection, +static CGGlyph mac_ctfont_get_glyph_for_cid (CTFontRef, CTCharacterCollection, CGFontIndex); #endif @@ -73,7 +65,7 @@ struct macfont_metrics; struct macfont_info { struct font font; - FontRef macfont; + CTFontRef macfont; CGFontRef cgfont; ScreenFontRef screen_font; struct macfont_cache *cache; @@ -112,23 +104,22 @@ static const CGAffineTransform synthetic_italic_atfm = {1, 0, 0.25, 1, 0, 0}; static const CGFloat synthetic_bold_factor = 0.024; static Boolean cfnumber_get_font_symbolic_traits_value (CFNumberRef, - FontSymbolicTraits *); -static void macfont_store_descriptor_attributes (FontDescriptorRef, + CTFontSymbolicTraits *); +static void macfont_store_descriptor_attributes (CTFontDescriptorRef, Lisp_Object); -static Lisp_Object macfont_descriptor_entity (FontDescriptorRef, - Lisp_Object, - FontSymbolicTraits); +static Lisp_Object macfont_descriptor_entity (CTFontDescriptorRef, Lisp_Object, + CTFontSymbolicTraits); static CFStringRef macfont_create_family_with_symbol (Lisp_Object); static int macfont_glyph_extents (struct font *, CGGlyph, struct font_metrics *, CGFloat *, int); static CFMutableDictionaryRef macfont_create_attributes_with_spec (Lisp_Object); -static Boolean macfont_supports_charset_and_languages_p (FontDescriptorRef, +static Boolean macfont_supports_charset_and_languages_p (CTFontDescriptorRef, CFCharacterSetRef, Lisp_Object, CFArrayRef); -static Boolean macfont_closest_traits_index_p (CFArrayRef, FontSymbolicTraits, +static Boolean macfont_closest_traits_index_p (CFArrayRef, CTFontSymbolicTraits, CFIndex); -static CFDataRef mac_font_copy_uvs_table (FontRef); +static CFDataRef mac_font_copy_uvs_table (CTFontRef); static void mac_font_get_glyphs_for_variants (CFDataRef, UTF32Char, const UTF32Char [], CGGlyph [], CFIndex); @@ -208,7 +199,7 @@ mac_screen_font_get_advance_width_for_glyph (ScreenFontRef font, CGGlyph glyph) } static CGGlyph -mac_font_get_glyph_for_cid (FontRef font, CharacterCollection collection, +mac_font_get_glyph_for_cid (CTFontRef font, CTCharacterCollection collection, CGFontIndex cid) { #if USE_CT_GLYPH_INFO @@ -755,7 +746,7 @@ macfont_store_utf32char_to_unichars (UTF32Char c, UniChar *unichars) static Boolean cfnumber_get_font_symbolic_traits_value (CFNumberRef number, - FontSymbolicTraits *sym_traits) + CTFontSymbolicTraits *sym_traits) { SInt64 sint64_value; @@ -763,7 +754,7 @@ cfnumber_get_font_symbolic_traits_value (CFNumberRef number, OS X 10.6 when the value is greater than or equal to 1 << 31. */ if (CFNumberGetValue (number, kCFNumberSInt64Type, &sint64_value)) { - *sym_traits = (FontSymbolicTraits) sint64_value; + *sym_traits = (CTFontSymbolicTraits) sint64_value; return true; } @@ -772,7 +763,7 @@ cfnumber_get_font_symbolic_traits_value (CFNumberRef number, } static void -macfont_store_descriptor_attributes (FontDescriptorRef desc, +macfont_store_descriptor_attributes (CTFontDescriptorRef desc, Lisp_Object spec_or_entity) { CFStringRef str; @@ -780,15 +771,14 @@ macfont_store_descriptor_attributes (FontDescriptorRef desc, CFNumberRef num; CGFloat floatval; - str = mac_font_descriptor_copy_attribute (desc, - MAC_FONT_FAMILY_NAME_ATTRIBUTE); + str = CTFontDescriptorCopyAttribute (desc, kCTFontFamilyNameAttribute); if (str) { ASET (spec_or_entity, FONT_FAMILY_INDEX, macfont_intern_prop_cfstring (str)); CFRelease (str); } - dict = mac_font_descriptor_copy_attribute (desc, MAC_FONT_TRAITS_ATTRIBUTE); + dict = CTFontDescriptorCopyAttribute (desc, kCTFontTraitsAttribute); if (dict) { struct { @@ -796,16 +786,16 @@ macfont_store_descriptor_attributes (FontDescriptorRef desc, CFStringRef trait; CGPoint points[6]; } numeric_traits[] = - {{FONT_WEIGHT_INDEX, MAC_FONT_WEIGHT_TRAIT, + {{FONT_WEIGHT_INDEX, kCTFontWeightTrait, {{-0.4, 50}, /* light */ {-0.24, 87.5}, /* (semi-light + normal) / 2 */ {0, 100}, /* normal */ {0.24, 140}, /* (semi-bold + normal) / 2 */ {0.4, 200}, /* bold */ {CGFLOAT_MAX, CGFLOAT_MAX}}}, - {FONT_SLANT_INDEX, MAC_FONT_SLANT_TRAIT, + {FONT_SLANT_INDEX, kCTFontSlantTrait, {{0, 100}, {0.1, 200}, {CGFLOAT_MAX, CGFLOAT_MAX}}}, - {FONT_WIDTH_INDEX, MAC_FONT_WIDTH_TRAIT, + {FONT_WIDTH_INDEX, kCTFontWidthTrait, {{0, 100}, {1, 200}, {CGFLOAT_MAX, CGFLOAT_MAX}}}}; int i; @@ -830,21 +820,21 @@ macfont_store_descriptor_attributes (FontDescriptorRef desc, } } - num = CFDictionaryGetValue (dict, MAC_FONT_SYMBOLIC_TRAIT); + num = CFDictionaryGetValue (dict, kCTFontSymbolicTrait); if (num) { - FontSymbolicTraits sym_traits; + CTFontSymbolicTraits sym_traits; int spacing; cfnumber_get_font_symbolic_traits_value (num, &sym_traits); - spacing = (sym_traits & MAC_FONT_TRAIT_MONO_SPACE + spacing = (sym_traits & kCTFontTraitMonoSpace ? FONT_SPACING_MONO : FONT_SPACING_PROPORTIONAL); ASET (spec_or_entity, FONT_SPACING_INDEX, make_number (spacing)); } CFRelease (dict); } - num = mac_font_descriptor_copy_attribute (desc, MAC_FONT_SIZE_ATTRIBUTE); + num = CTFontDescriptorCopyAttribute (desc, kCTFontSizeAttribute); if (num && CFNumberGetValue (num, kCFNumberCGFloatType, &floatval)) ASET (spec_or_entity, FONT_SIZE_INDEX, make_number (floatval)); else @@ -854,12 +844,12 @@ macfont_store_descriptor_attributes (FontDescriptorRef desc, } static Lisp_Object -macfont_descriptor_entity (FontDescriptorRef desc, Lisp_Object extra, - FontSymbolicTraits synth_sym_traits) +macfont_descriptor_entity (CTFontDescriptorRef desc, Lisp_Object extra, + CTFontSymbolicTraits synth_sym_traits) { Lisp_Object entity; CFDictionaryRef dict; - FontSymbolicTraits sym_traits = 0; + CTFontSymbolicTraits sym_traits = 0; CFStringRef name; entity = font_make_entity (); @@ -869,10 +859,10 @@ macfont_descriptor_entity (FontDescriptorRef desc, Lisp_Object extra, macfont_store_descriptor_attributes (desc, entity); - dict = mac_font_descriptor_copy_attribute (desc, MAC_FONT_TRAITS_ATTRIBUTE); + dict = CTFontDescriptorCopyAttribute (desc, kCTFontTraitsAttribute); if (dict) { - CFNumberRef num = CFDictionaryGetValue (dict, MAC_FONT_SYMBOLIC_TRAIT); + CFNumberRef num = CFDictionaryGetValue (dict, kCTFontSymbolicTrait); if (num) cfnumber_get_font_symbolic_traits_value (num, &sym_traits); @@ -881,16 +871,16 @@ macfont_descriptor_entity (FontDescriptorRef desc, Lisp_Object extra, if (EQ (AREF (entity, FONT_SIZE_INDEX), make_number (0))) ASET (entity, FONT_AVGWIDTH_INDEX, make_number (0)); ASET (entity, FONT_EXTRA_INDEX, Fcopy_sequence (extra)); - name = mac_font_descriptor_copy_attribute (desc, MAC_FONT_NAME_ATTRIBUTE); + name = CTFontDescriptorCopyAttribute (desc, kCTFontNameAttribute); font_put_extra (entity, QCfont_entity, make_save_ptr_int ((void *) name, sym_traits)); - if (synth_sym_traits & MAC_FONT_TRAIT_ITALIC) + if (synth_sym_traits & kCTFontTraitItalic) FONT_SET_STYLE (entity, FONT_SLANT_INDEX, make_number (FONT_SLANT_SYNTHETIC_ITALIC)); - if (synth_sym_traits & MAC_FONT_TRAIT_BOLD) + if (synth_sym_traits & kCTFontTraitBold) FONT_SET_STYLE (entity, FONT_WEIGHT_INDEX, make_number (FONT_WEIGHT_SYNTHETIC_BOLD)); - if (synth_sym_traits & MAC_FONT_TRAIT_MONO_SPACE) + if (synth_sym_traits & kCTFontTraitMonoSpace) ASET (entity, FONT_SPACING_INDEX, make_number (FONT_SPACING_SYNTHETIC_MONO)); @@ -1039,7 +1029,7 @@ macfont_create_family_with_symbol (Lisp_Object symbol) { CFStringRef result = NULL, family_name; CFDictionaryRef attributes = NULL; - FontDescriptorRef pat_desc = NULL; + CTFontDescriptorRef pat_desc = NULL; if (macfont_get_family_cache_if_present (symbol, &result)) return result ? CFRetain (result) : NULL; @@ -1049,7 +1039,7 @@ macfont_create_family_with_symbol (Lisp_Object symbol) { attributes = CFDictionaryCreate (NULL, - (const void **) &MAC_FONT_FAMILY_NAME_ATTRIBUTE, + (const void **) &kCTFontFamilyNameAttribute, (const void **) &family_name, 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); @@ -1057,19 +1047,18 @@ macfont_create_family_with_symbol (Lisp_Object symbol) } if (attributes) { - pat_desc = mac_font_descriptor_create_with_attributes (attributes); + pat_desc = CTFontDescriptorCreateWithAttributes (attributes); CFRelease (attributes); } if (pat_desc) { - FontDescriptorRef desc = - mac_font_descriptor_create_matching_font_descriptor (pat_desc, NULL); + CTFontDescriptorRef desc = + CTFontDescriptorCreateMatchingFontDescriptor (pat_desc, NULL); if (desc) { result = - mac_font_descriptor_copy_attribute (desc, - MAC_FONT_FAMILY_NAME_ATTRIBUTE); + CTFontDescriptorCopyAttribute (desc, kCTFontFamilyNameAttribute); CFRelease (desc); } macfont_set_family_cache (symbol, result); @@ -1126,7 +1115,7 @@ macfont_glyph_extents (struct font *font, CGGlyph glyph, int force_integral_p) { struct macfont_info *macfont_info = (struct macfont_info *) font; - FontRef macfont = macfont_info->macfont; + CTFontRef macfont = macfont_info->macfont; int row, col; struct macfont_metrics *cache; int width; @@ -1196,10 +1185,9 @@ macfont_glyph_extents (struct font *font, CGGlyph glyph, } if (macfont_info->synthetic_bold_p && ! force_integral_p) { - CGFloat d = - - synthetic_bold_factor * mac_font_get_size (macfont) / 2; + CGFloat d = - synthetic_bold_factor * CTFontGetSize (macfont) / 2; - bounds = CGRectInset (bounds, d, d); + bounds = CGRectInset (bounds, d, d); } switch (macfont_info->spacing) { @@ -1302,8 +1290,8 @@ struct macfont_cache /* Character collection specifying the destination of the mapping provided by `table' above. If `table' is obtained from the UVS subtable in the font cmap table, then the value of this member - should be MAC_CHARACTER_COLLECTION_IDENTITY_MAPPING. */ - CharacterCollection collection; + should be kCTCharacterCollectionIdentityMapping. */ + CTCharacterCollection collection; } uvs; }; @@ -1314,8 +1302,8 @@ static CFCharacterSetRef macfont_get_cf_charset (struct font *); static CFCharacterSetRef macfont_get_cf_charset_for_name (CFStringRef); static CGGlyph macfont_get_glyph_for_character (struct font *, UTF32Char); static CGGlyph macfont_get_glyph_for_cid (struct font *font, - CharacterCollection, CGFontIndex); -static CFDataRef macfont_get_uvs_table (struct font *, CharacterCollection *); + CTCharacterCollection, CGFontIndex); +static CFDataRef macfont_get_uvs_table (struct font *, CTCharacterCollection *); static struct macfont_cache * macfont_lookup_cache (CFStringRef key) @@ -1335,7 +1323,7 @@ macfont_lookup_cache (CFStringRef key) if (cache == NULL) { - FontRef macfont = mac_font_create_with_name (key, 0); + CTFontRef macfont = CTFontCreateWithName (key, 0, NULL); if (macfont) { @@ -1353,7 +1341,7 @@ macfont_lookup_cache (CFStringRef key) CFCharacterSetCreateWithCharactersInRange (NULL, range); } if (cache->cf_charset == NULL) - cache->cf_charset = mac_font_copy_character_set (macfont); + cache->cf_charset = CTFontCopyCharacterSet (macfont); CFDictionaryAddValue (macfont_cache_dictionary, key, (const void *) cache); CFRelease (macfont); @@ -1410,7 +1398,7 @@ static CGGlyph macfont_get_glyph_for_character (struct font *font, UTF32Char c) { struct macfont_info *macfont_info = (struct macfont_info *) font; - FontRef macfont = macfont_info->macfont; + CTFontRef macfont = macfont_info->macfont; struct macfont_cache *cache = macfont_info->cache; if (c < 0xD800 || (c > 0xDFFF && c < 0x10000)) @@ -1449,8 +1437,7 @@ macfont_get_glyph_for_character (struct font *font, UTF32Char c) if (nkeys_or_perm + 1 != ROW_PERM_OFFSET) { ch = c; - if (!mac_font_get_glyphs_for_characters (macfont, &ch, - &glyph, 1) + if (!CTFontGetGlyphsForCharacters (macfont, &ch, &glyph, 1) || glyph == 0) glyph = kCGFontIndexInvalid; @@ -1493,8 +1480,7 @@ macfont_get_glyph_for_character (struct font *font, UTF32Char c) glyphs = xmalloc (sizeof (CGGlyph) * 256); if (len > 0) { - mac_font_get_glyphs_for_characters (macfont, unichars, - glyphs, len); + CTFontGetGlyphsForCharacters (macfont, unichars, glyphs, len); while (i > len) { int next = unichars[len - 1] % 256; @@ -1550,8 +1536,7 @@ macfont_get_glyph_for_character (struct font *font, UTF32Char c) CGGlyph glyphs[2]; CFIndex count = macfont_store_utf32char_to_unichars (c, unichars); - if (mac_font_get_glyphs_for_characters (macfont, unichars, glyphs, - count)) + if (CTFontGetGlyphsForCharacters (macfont, unichars, glyphs, count)) glyph = glyphs[0]; if (glyph == 0) glyph = kCGFontIndexInvalid; @@ -1566,33 +1551,33 @@ macfont_get_glyph_for_character (struct font *font, UTF32Char c) } static CGGlyph -macfont_get_glyph_for_cid (struct font *font, CharacterCollection collection, +macfont_get_glyph_for_cid (struct font *font, CTCharacterCollection collection, CGFontIndex cid) { struct macfont_info *macfont_info = (struct macfont_info *) font; - FontRef macfont = macfont_info->macfont; + CTFontRef macfont = macfont_info->macfont; /* Cache it? */ return mac_font_get_glyph_for_cid (macfont, collection, cid); } static CFDataRef -macfont_get_uvs_table (struct font *font, CharacterCollection *collection) +macfont_get_uvs_table (struct font *font, CTCharacterCollection *collection) { struct macfont_info *macfont_info = (struct macfont_info *) font; - FontRef macfont = macfont_info->macfont; + CTFontRef macfont = macfont_info->macfont; struct macfont_cache *cache = macfont_info->cache; CFDataRef result = NULL; if (cache->uvs.table == NULL) { CFDataRef uvs_table = mac_font_copy_uvs_table (macfont); - CharacterCollection uvs_collection = - MAC_CHARACTER_COLLECTION_IDENTITY_MAPPING; + CTCharacterCollection uvs_collection = + kCTCharacterCollectionIdentityMapping; if (uvs_table == NULL && mac_font_get_glyph_for_cid (macfont, - MAC_CHARACTER_COLLECTION_ADOBE_JAPAN1, + kCTCharacterCollectionAdobeJapan1, 6480) != kCGFontIndexInvalid) { /* If the glyph for U+4E55 is accessible via its CID 6480, @@ -1609,7 +1594,7 @@ macfont_get_uvs_table (struct font *font, CharacterCollection *collection) if (mac_uvs_table_adobe_japan1) { uvs_table = CFRetain (mac_uvs_table_adobe_japan1); - uvs_collection = MAC_CHARACTER_COLLECTION_ADOBE_JAPAN1; + uvs_collection = kCTCharacterCollectionAdobeJapan1; } } if (uvs_table == NULL) @@ -1852,16 +1837,16 @@ macfont_create_attributes_with_spec (Lisp_Object spec) CFStringRef trait; CGPoint points[6]; } numeric_traits[] = - {{FONT_WEIGHT_INDEX, MAC_FONT_WEIGHT_TRAIT, + {{FONT_WEIGHT_INDEX, kCTFontWeightTrait, {{-0.4, 50}, /* light */ {-0.24, 87.5}, /* (semi-light + normal) / 2 */ {0, 100}, /* normal */ {0.24, 140}, /* (semi-bold + normal) / 2 */ {0.4, 200}, /* bold */ {CGFLOAT_MAX, CGFLOAT_MAX}}}, - {FONT_SLANT_INDEX, MAC_FONT_SLANT_TRAIT, + {FONT_SLANT_INDEX, kCTFontSlantTrait, {{0, 100}, {0.1, 200}, {CGFLOAT_MAX, CGFLOAT_MAX}}}, - {FONT_WIDTH_INDEX, MAC_FONT_WIDTH_TRAIT, + {FONT_WIDTH_INDEX, kCTFontWidthTrait, {{0, 100}, {1, 200}, {CGFLOAT_MAX, CGFLOAT_MAX}}}}; registry = AREF (spec, FONT_REGISTRY_INDEX); @@ -1977,7 +1962,7 @@ macfont_create_attributes_with_spec (Lisp_Object spec) if (! family) goto err; - CFDictionaryAddValue (attributes, MAC_FONT_FAMILY_NAME_ATTRIBUTE, + CFDictionaryAddValue (attributes, kCTFontFamilyNameAttribute, family); CFRelease (family); } @@ -2018,16 +2003,16 @@ macfont_create_attributes_with_spec (Lisp_Object spec) } } if (CFDictionaryGetCount (traits)) - CFDictionaryAddValue (attributes, MAC_FONT_TRAITS_ATTRIBUTE, traits); + CFDictionaryAddValue (attributes, kCTFontTraitsAttribute, traits); if (charset) - CFDictionaryAddValue (attributes, MAC_FONT_CHARACTER_SET_ATTRIBUTE, + CFDictionaryAddValue (attributes, kCTFontCharacterSetAttribute, charset); if (charset_string) CFDictionaryAddValue (attributes, MAC_FONT_CHARACTER_SET_STRING_ATTRIBUTE, charset_string); if (langarray) - CFDictionaryAddValue (attributes, MAC_FONT_LANGUAGES_ATTRIBUTE, langarray); + CFDictionaryAddValue (attributes, kCTFontLanguagesAttribute, langarray); goto finish; @@ -2056,7 +2041,7 @@ macfont_create_attributes_with_spec (Lisp_Object spec) } static Boolean -macfont_supports_charset_and_languages_p (FontDescriptorRef desc, +macfont_supports_charset_and_languages_p (CTFontDescriptorRef desc, CFCharacterSetRef charset, Lisp_Object chars, CFArrayRef languages) @@ -2066,8 +2051,7 @@ macfont_supports_charset_and_languages_p (FontDescriptorRef desc, if (charset || VECTORP (chars)) { CFCharacterSetRef desc_charset = - mac_font_descriptor_copy_attribute (desc, - MAC_FONT_CHARACTER_SET_ATTRIBUTE); + CTFontDescriptorCopyAttribute (desc, kCTFontCharacterSetAttribute); if (desc_charset == NULL) result = false; @@ -2097,20 +2081,20 @@ macfont_supports_charset_and_languages_p (FontDescriptorRef desc, } static int -macfont_traits_distance (FontSymbolicTraits sym_traits1, - FontSymbolicTraits sym_traits2) +macfont_traits_distance (CTFontSymbolicTraits sym_traits1, + CTFontSymbolicTraits sym_traits2) { - FontSymbolicTraits diff = (sym_traits1 ^ sym_traits2); + CTFontSymbolicTraits diff = (sym_traits1 ^ sym_traits2); int distance = 0; /* We prefer synthetic bold of italic to synthetic italic of bold when both bold and italic are available but bold-italic is not available. */ - if (diff & MAC_FONT_TRAIT_BOLD) + if (diff & kCTFontTraitBold) distance |= (1 << 0); - if (diff & MAC_FONT_TRAIT_ITALIC) + if (diff & kCTFontTraitItalic) distance |= (1 << 1); - if (diff & MAC_FONT_TRAIT_MONO_SPACE) + if (diff & kCTFontTraitMonoSpace) distance |= (1 << 2); return distance; @@ -2118,21 +2102,21 @@ macfont_traits_distance (FontSymbolicTraits sym_traits1, static Boolean macfont_closest_traits_index_p (CFArrayRef traits_array, - FontSymbolicTraits target, + CTFontSymbolicTraits target, CFIndex index) { CFIndex i, count = CFArrayGetCount (traits_array); - FontSymbolicTraits traits; + CTFontSymbolicTraits traits; int my_distance; - traits = ((FontSymbolicTraits) (uintptr_t) + traits = ((CTFontSymbolicTraits) (uintptr_t) CFArrayGetValueAtIndex (traits_array, index)); my_distance = macfont_traits_distance (target, traits); for (i = 0; i < count; i++) if (i != index) { - traits = ((FontSymbolicTraits) (uintptr_t) + traits = ((CTFontSymbolicTraits) (uintptr_t) CFArrayGetValueAtIndex (traits_array, i)); if (macfont_traits_distance (target, traits) < my_distance) return false; @@ -2150,7 +2134,7 @@ macfont_list (struct frame *f, Lisp_Object spec) CFMutableDictionaryRef attributes = NULL, traits; Lisp_Object chars = Qnil; int spacing = -1; - FontSymbolicTraits synth_sym_traits = 0; + CTFontSymbolicTraits synth_sym_traits = 0; CFArrayRef families; CFIndex families_count; CFCharacterSetRef charset = NULL; @@ -2170,28 +2154,28 @@ macfont_list (struct frame *f, Lisp_Object spec) if (! attributes) goto finish; - languages = CFDictionaryGetValue (attributes, MAC_FONT_LANGUAGES_ATTRIBUTE); + languages = CFDictionaryGetValue (attributes, kCTFontLanguagesAttribute); if (INTEGERP (AREF (spec, FONT_SPACING_INDEX))) spacing = XINT (AREF (spec, FONT_SPACING_INDEX)); traits = ((CFMutableDictionaryRef) - CFDictionaryGetValue (attributes, MAC_FONT_TRAITS_ATTRIBUTE)); + CFDictionaryGetValue (attributes, kCTFontTraitsAttribute)); n = FONT_SLANT_NUMERIC (spec); if (n < 0 || n == FONT_SLANT_SYNTHETIC_ITALIC) { - synth_sym_traits |= MAC_FONT_TRAIT_ITALIC; + synth_sym_traits |= kCTFontTraitItalic; if (traits) - CFDictionaryRemoveValue (traits, MAC_FONT_SLANT_TRAIT); + CFDictionaryRemoveValue (traits, kCTFontSlantTrait); } n = FONT_WEIGHT_NUMERIC (spec); if (n < 0 || n == FONT_WEIGHT_SYNTHETIC_BOLD) { - synth_sym_traits |= MAC_FONT_TRAIT_BOLD; + synth_sym_traits |= kCTFontTraitBold; if (traits) - CFDictionaryRemoveValue (traits, MAC_FONT_WEIGHT_TRAIT); + CFDictionaryRemoveValue (traits, kCTFontWeightTrait); } if (languages @@ -2202,7 +2186,7 @@ macfont_list (struct frame *f, Lisp_Object spec) if (CFStringHasPrefix (language, CFSTR ("ja")) || CFStringHasPrefix (language, CFSTR ("ko")) || CFStringHasPrefix (language, CFSTR ("zh"))) - synth_sym_traits |= MAC_FONT_TRAIT_MONO_SPACE; + synth_sym_traits |= kCTFontTraitMonoSpace; } /* Create array of families. */ @@ -2254,12 +2238,11 @@ macfont_list (struct frame *f, Lisp_Object spec) } } - charset = CFDictionaryGetValue (attributes, - MAC_FONT_CHARACTER_SET_ATTRIBUTE); + charset = CFDictionaryGetValue (attributes, kCTFontCharacterSetAttribute); if (charset) { CFRetain (charset); - CFDictionaryRemoveValue (attributes, MAC_FONT_CHARACTER_SET_ATTRIBUTE); + CFDictionaryRemoveValue (attributes, kCTFontCharacterSetAttribute); } else { @@ -2276,7 +2259,7 @@ macfont_list (struct frame *f, Lisp_Object spec) if (languages) { CFRetain (languages); - CFDictionaryRemoveValue (attributes, MAC_FONT_LANGUAGES_ATTRIBUTE); + CFDictionaryRemoveValue (attributes, kCTFontLanguagesAttribute); } val = Qnil; @@ -2285,16 +2268,16 @@ macfont_list (struct frame *f, Lisp_Object spec) for (i = 0; i < families_count; i++) { CFStringRef family_name = CFArrayGetValueAtIndex (families, i); - FontDescriptorRef pat_desc; + CTFontDescriptorRef pat_desc; CFArrayRef descs; CFIndex descs_count; CFMutableArrayRef filtered_descs, traits_array; Lisp_Object entity; int j; - CFDictionarySetValue (attributes, MAC_FONT_FAMILY_NAME_ATTRIBUTE, + CFDictionarySetValue (attributes, kCTFontFamilyNameAttribute, family_name); - pat_desc = mac_font_descriptor_create_with_attributes (attributes); + pat_desc = CTFontDescriptorCreateWithAttributes (attributes); if (! pat_desc) goto err; @@ -2303,13 +2286,11 @@ macfont_list (struct frame *f, Lisp_Object spec) So we use CTFontDescriptorCreateMatchingFontDescriptor (no trailing "s") for such a font. */ if (!CFEqual (family_name, CFSTR ("LastResort"))) - descs = mac_font_descriptor_create_matching_font_descriptors (pat_desc, - NULL); + descs = CTFontDescriptorCreateMatchingFontDescriptors (pat_desc, NULL); else { - FontDescriptorRef lr_desc = - mac_font_descriptor_create_matching_font_descriptor (pat_desc, - NULL); + CTFontDescriptorRef lr_desc = + CTFontDescriptorCreateMatchingFontDescriptor (pat_desc, NULL); if (lr_desc) { descs = CFArrayCreate (NULL, (const void **) &lr_desc, 1, @@ -2338,31 +2319,30 @@ macfont_list (struct frame *f, Lisp_Object spec) traits_array = CFArrayCreateMutable (NULL, descs_count, NULL); for (j = 0; j < descs_count; j++) { - FontDescriptorRef desc = CFArrayGetValueAtIndex (descs, j); + CTFontDescriptorRef desc = CFArrayGetValueAtIndex (descs, j); CFDictionaryRef dict; CFNumberRef num; - FontSymbolicTraits sym_traits; + CTFontSymbolicTraits sym_traits; - dict = mac_font_descriptor_copy_attribute (desc, - MAC_FONT_TRAITS_ATTRIBUTE); + dict = CTFontDescriptorCopyAttribute (desc, kCTFontTraitsAttribute); if (dict == NULL) continue; - num = CFDictionaryGetValue (dict, MAC_FONT_SYMBOLIC_TRAIT); + num = CFDictionaryGetValue (dict, kCTFontSymbolicTrait); CFRelease (dict); if (num == NULL || !cfnumber_get_font_symbolic_traits_value (num, &sym_traits)) continue; if (spacing >= 0 - && !(synth_sym_traits & MAC_FONT_TRAIT_MONO_SPACE) - && (((sym_traits & MAC_FONT_TRAIT_MONO_SPACE) != 0) + && !(synth_sym_traits & kCTFontTraitMonoSpace) + && (((sym_traits & kCTFontTraitMonoSpace) != 0) != (spacing >= FONT_SPACING_MONO))) continue; /* Don't use a color bitmap font unless its family is explicitly specified. */ - if ((sym_traits & MAC_FONT_TRAIT_COLOR_GLYPHS) && NILP (family)) + if ((sym_traits & kCTFontTraitColorGlyphs) && NILP (family)) continue; if (j > 0 @@ -2381,27 +2361,26 @@ macfont_list (struct frame *f, Lisp_Object spec) for (j = 0; j < descs_count; j++) { - FontDescriptorRef desc = CFArrayGetValueAtIndex (descs, j); - FontSymbolicTraits sym_traits = - ((FontSymbolicTraits) (uintptr_t) + CTFontDescriptorRef desc = CFArrayGetValueAtIndex (descs, j); + CTFontSymbolicTraits sym_traits = + ((CTFontSymbolicTraits) (uintptr_t) CFArrayGetValueAtIndex (traits_array, j)); - FontSymbolicTraits mask_min, mask_max, imask, bmask, mmask; + CTFontSymbolicTraits mask_min, mask_max, imask, bmask, mmask; mask_min = ((synth_sym_traits ^ sym_traits) - & (MAC_FONT_TRAIT_ITALIC | MAC_FONT_TRAIT_BOLD)); + & (kCTFontTraitItalic | kCTFontTraitBold)); if (FONT_SLANT_NUMERIC (spec) < 0) - mask_min &= ~MAC_FONT_TRAIT_ITALIC; + mask_min &= ~kCTFontTraitItalic; if (FONT_WEIGHT_NUMERIC (spec) < 0) - mask_min &= ~MAC_FONT_TRAIT_BOLD; + mask_min &= ~kCTFontTraitBold; mask_max = (synth_sym_traits & ~sym_traits); /* Synthetic bold does not work for bitmap-only fonts on Mac OS X 10.6. */ - if ((mask_min ^ mask_max) & MAC_FONT_TRAIT_BOLD) + if ((mask_min ^ mask_max) & kCTFontTraitBold) { CFNumberRef format = - mac_font_descriptor_copy_attribute (desc, - MAC_FONT_FORMAT_ATTRIBUTE); + CTFontDescriptorCopyAttribute (desc, kCTFontFormatAttribute); if (format) { @@ -2409,24 +2388,24 @@ macfont_list (struct frame *f, Lisp_Object spec) if (CFNumberGetValue (format, kCFNumberSInt32Type, &format_val) - && format_val == MAC_FONT_FORMAT_BITMAP) - mask_max &= ~MAC_FONT_TRAIT_BOLD; + && format_val == kCTFontFormatBitmap) + mask_max &= ~kCTFontTraitBold; } } if (spacing >= 0) - mask_min |= (mask_max & MAC_FONT_TRAIT_MONO_SPACE); - - for (mmask = (mask_min & MAC_FONT_TRAIT_MONO_SPACE); - mmask <= (mask_max & MAC_FONT_TRAIT_MONO_SPACE); - mmask += MAC_FONT_TRAIT_MONO_SPACE) - for (bmask = (mask_min & MAC_FONT_TRAIT_BOLD); - bmask <= (mask_max & MAC_FONT_TRAIT_BOLD); - bmask += MAC_FONT_TRAIT_BOLD) - for (imask = (mask_min & MAC_FONT_TRAIT_ITALIC); - imask <= (mask_max & MAC_FONT_TRAIT_ITALIC); - imask += MAC_FONT_TRAIT_ITALIC) + mask_min |= (mask_max & kCTFontTraitMonoSpace); + + for (mmask = (mask_min & kCTFontTraitMonoSpace); + mmask <= (mask_max & kCTFontTraitMonoSpace); + mmask += kCTFontTraitMonoSpace) + for (bmask = (mask_min & kCTFontTraitBold); + bmask <= (mask_max & kCTFontTraitBold); + bmask += kCTFontTraitBold) + for (imask = (mask_min & kCTFontTraitItalic); + imask <= (mask_max & kCTFontTraitItalic); + imask += kCTFontTraitItalic) { - FontSymbolicTraits synth = (imask | bmask | mmask); + CTFontSymbolicTraits synth = (imask | bmask | mmask); if (synth == 0 || macfont_closest_traits_index_p (traits_array, @@ -2467,20 +2446,19 @@ macfont_match (struct frame * frame, Lisp_Object spec) { Lisp_Object entity = Qnil; CFMutableDictionaryRef attributes; - FontDescriptorRef pat_desc = NULL, desc = NULL; + CTFontDescriptorRef pat_desc = NULL, desc = NULL; block_input (); attributes = macfont_create_attributes_with_spec (spec); if (attributes) { - pat_desc = mac_font_descriptor_create_with_attributes (attributes); + pat_desc = CTFontDescriptorCreateWithAttributes (attributes); CFRelease (attributes); } if (pat_desc) { - desc = mac_font_descriptor_create_matching_font_descriptor (pat_desc, - NULL); + desc = CTFontDescriptorCreateMatchingFontDescriptor (pat_desc, NULL); CFRelease (pat_desc); } if (desc) @@ -2538,8 +2516,8 @@ macfont_open (struct frame * f, Lisp_Object entity, int pixel_size) struct macfont_info *macfont_info = NULL; struct font *font; int size; - FontRef macfont; - FontSymbolicTraits sym_traits; + CTFontRef macfont; + CTFontSymbolicTraits sym_traits; char name[256]; int len, i, total_width; CGGlyph glyph; @@ -2558,7 +2536,7 @@ macfont_open (struct frame * f, Lisp_Object entity, int pixel_size) size = pixel_size; block_input (); - macfont = mac_font_create_with_name (font_name, size); + macfont = CTFontCreateWithName (font_name, size, NULL); if (macfont) { int fontsize = (int) [((NSFont *) macfont) pointSize]; @@ -2579,7 +2557,7 @@ macfont_open (struct frame * f, Lisp_Object entity, int pixel_size) macfont_info = (struct macfont_info *) font; macfont_info->macfont = macfont; - macfont_info->cgfont = mac_font_copy_graphics_font (macfont); + macfont_info->cgfont = CTFontCopyGraphicsFont (macfont, NULL); val = assq_no_quit (QCdestination, AREF (entity, FONT_EXTRA_INDEX)); if (CONSP (val) && EQ (XCDR (val), make_number (1))) @@ -2595,13 +2573,13 @@ macfont_open (struct frame * f, Lisp_Object entity, int pixel_size) macfont_info->synthetic_bold_p = 0; macfont_info->spacing = MACFONT_SPACING_PROPORTIONAL; macfont_info->antialias = MACFONT_ANTIALIAS_DEFAULT; - if (!(sym_traits & MAC_FONT_TRAIT_ITALIC) + if (!(sym_traits & kCTFontTraitItalic) && FONT_SLANT_NUMERIC (entity) == FONT_SLANT_SYNTHETIC_ITALIC) macfont_info->synthetic_italic_p = 1; - if (!(sym_traits & MAC_FONT_TRAIT_BOLD) + if (!(sym_traits & kCTFontTraitBold) && FONT_WEIGHT_NUMERIC (entity) == FONT_WEIGHT_SYNTHETIC_BOLD) macfont_info->synthetic_bold_p = 1; - if (sym_traits & MAC_FONT_TRAIT_MONO_SPACE) + if (sym_traits & kCTFontTraitMonoSpace) macfont_info->spacing = MACFONT_SPACING_MONO; else if (INTEGERP (AREF (entity, FONT_SPACING_INDEX)) && (XINT (AREF (entity, FONT_SPACING_INDEX)) @@ -2617,7 +2595,7 @@ macfont_open (struct frame * f, Lisp_Object entity, int pixel_size) NILP (XCDR (val)) ? MACFONT_ANTIALIAS_OFF : MACFONT_ANTIALIAS_ON; } macfont_info->color_bitmap_p = 0; - if (sym_traits & MAC_FONT_TRAIT_COLOR_GLYPHS) + if (sym_traits & kCTFontTraitColorGlyphs) macfont_info->color_bitmap_p = 1; glyph = macfont_get_glyph_for_character (font, ' '); @@ -2646,12 +2624,12 @@ macfont_open (struct frame * f, Lisp_Object entity, int pixel_size) { CFStringRef family_name; - ascent = mac_font_get_ascent (macfont); - descent = mac_font_get_descent (macfont); - leading = mac_font_get_leading (macfont); + ascent = CTFontGetAscent (macfont); + descent = CTFontGetDescent (macfont); + leading = CTFontGetLeading (macfont); /* AppKit and WebKit do some adjustment to the heights of Courier, Helvetica, and Times. */ - family_name = mac_font_copy_family_name (macfont); + family_name = CTFontCopyFamilyName (macfont); if (family_name) { if (CFEqual (family_name, CFSTR ("Courier")) @@ -2674,8 +2652,8 @@ macfont_open (struct frame * f, Lisp_Object entity, int pixel_size) font->descent = descent + leading + 0.5f; font->height = font->ascent + font->descent; - font->underline_position = - mac_font_get_underline_position (macfont) + 0.5f; - font->underline_thickness = mac_font_get_underline_thickness (macfont) + 0.5f; + font->underline_position = - CTFontGetUnderlinePosition (macfont) + 0.5f; + font->underline_thickness = CTFontGetUnderlineThickness (macfont) + 0.5f; unblock_input (); @@ -2798,7 +2776,7 @@ macfont_draw (struct glyph_string *s, int from, int to, int x, int y, CGPoint text_position; CGGlyph *glyphs; CGPoint *positions; - CGFloat font_size = mac_font_get_size (macfont_info->macfont); + CGFloat font_size = CTFontGetSize (macfont_info->macfont); bool no_antialias_p = (NILP (ns_antialias_text) || macfont_info->antialias == MACFONT_ANTIALIAS_OFF @@ -2913,7 +2891,7 @@ macfont_shape (Lisp_Object lgstring) { struct font *font = CHECK_FONT_GET_OBJECT (LGSTRING_FONT (lgstring)); struct macfont_info *macfont_info = (struct macfont_info *) font; - FontRef macfont = macfont_info->macfont; + CTFontRef macfont = macfont_info->macfont; ptrdiff_t glyph_len, len, i, j; CFIndex nonbmp_len; UniChar *unichars; @@ -3110,11 +3088,12 @@ struct non_default_uvs_table found or ill-formatted, then return NULL. */ static CFDataRef -mac_font_copy_uvs_table (FontRef font) +mac_font_copy_uvs_table (CTFontRef font) { CFDataRef cmap_table, uvs_table = NULL; - cmap_table = mac_font_copy_non_synthetic_table (font, cmapFontTableTag); + cmap_table = CTFontCopyTable (font, cmapFontTableTag, + kCTFontTableOptionNoOptions); if (cmap_table) { sfntCMapHeader *cmap = (sfntCMapHeader *) CFDataGetBytePtr (cmap_table); @@ -3337,7 +3316,7 @@ static int macfont_variation_glyphs (struct font *font, int c, unsigned variations[256]) { CFDataRef uvs_table; - CharacterCollection uvs_collection; + CTCharacterCollection uvs_collection; int i, n = 0; block_input (); @@ -3357,7 +3336,7 @@ macfont_variation_glyphs (struct font *font, int c, unsigned variations[256]) { CGGlyph glyph = glyphs[i]; - if (uvs_collection != MAC_CHARACTER_COLLECTION_IDENTITY_MAPPING + if (uvs_collection != kCTCharacterCollectionIdentityMapping && glyph != kCGFontIndexInvalid) glyph = macfont_get_glyph_for_cid (font, uvs_collection, glyph); if (glyph == kCGFontIndexInvalid) @@ -3395,8 +3374,8 @@ macfont_filter_properties (Lisp_Object font, Lisp_Object alist) } static Boolean -mac_ctfont_descriptor_supports_languages (CTFontDescriptorRef descriptor, - CFArrayRef languages) +mac_font_descriptor_supports_languages (CTFontDescriptorRef descriptor, + CFArrayRef languages) { Boolean result = true; CFArrayRef desc_languages = @@ -3425,7 +3404,7 @@ mac_ctfont_descriptor_supports_languages (CTFontDescriptorRef descriptor, } static CFStringRef -mac_ctfont_create_preferred_family_for_attributes (CFDictionaryRef attributes) +mac_font_create_preferred_family_for_attributes (CFDictionaryRef attributes) { CFStringRef result = NULL; CFStringRef charset_string = @@ -3443,7 +3422,7 @@ mac_ctfont_create_preferred_family_for_attributes (CFDictionaryRef attributes) CFTypeRef values[] = {NULL}; CFIndex num_values = 0; CFArrayRef languages - = CFDictionaryGetValue (attributes, MAC_FONT_LANGUAGES_ATTRIBUTE); + = CFDictionaryGetValue (attributes, kCTFontLanguagesAttribute); if (languages && CFArrayGetCount (languages) > 0) { @@ -3452,8 +3431,7 @@ mac_ctfont_create_preferred_family_for_attributes (CFDictionaryRef attributes) else { CFCharacterSetRef charset = - CFDictionaryGetValue (attributes, - MAC_FONT_CHARACTER_SET_ATTRIBUTE); + CFDictionaryGetValue (attributes, kCTFontCharacterSetAttribute); result = mac_font_copy_default_name_for_charset_and_languages (charset, languages); } @@ -3499,8 +3477,8 @@ mac_ctfont_create_preferred_family_for_attributes (CFDictionaryRef attributes) break; if (i == 0) font = font_in_run; - else if (!mac_ctfont_equal_in_postscript_name (font, - font_in_run)) + else if (!mac_font_equal_in_postscript_name (font, + font_in_run)) break; } if (nruns > 0 && i == nruns) @@ -3514,63 +3492,50 @@ mac_ctfont_create_preferred_family_for_attributes (CFDictionaryRef attributes) } static inline double -mac_ctfont_get_advance_width_for_glyph (CTFontRef font, CGGlyph glyph) +mac_font_get_advance_width_for_glyph (CTFontRef font, CGGlyph glyph) { - return CTFontGetAdvancesForGlyphs (font, -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1080 - kCTFontOrientationDefault, -#else - kCTFontDefaultOrientation, -#endif + return CTFontGetAdvancesForGlyphs (font, kCTFontOrientationDefault, &glyph, NULL, 1); } static inline CGRect -mac_ctfont_get_bounding_rect_for_glyph (CTFontRef font, CGGlyph glyph) +mac_font_get_bounding_rect_for_glyph (CTFontRef font, CGGlyph glyph) { - return CTFontGetBoundingRectsForGlyphs (font, -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1080 - kCTFontOrientationDefault, -#else - kCTFontDefaultOrientation, -#endif + return CTFontGetBoundingRectsForGlyphs (font, kCTFontOrientationDefault, &glyph, NULL, 1); } static CFArrayRef -mac_ctfont_create_available_families (void) +mac_font_create_available_families (void) { CFMutableArrayRef families = NULL; + CFArrayRef orig_families = CTFontManagerCopyAvailableFontFamilyNames (); + if (orig_families) { - CFArrayRef orig_families = CTFontManagerCopyAvailableFontFamilyNames (); - - if (orig_families) - { - CFIndex i, count = CFArrayGetCount (orig_families); + CFIndex i, count = CFArrayGetCount (orig_families); - families = CFArrayCreateMutable (NULL, count, &kCFTypeArrayCallBacks); - if (families) - for (i = 0; i < count; i++) - { - CFStringRef family = CFArrayGetValueAtIndex (orig_families, i); - - if (!CFStringHasPrefix (family, CFSTR (".")) - && (CTFontManagerCompareFontFamilyNames (family, - CFSTR ("LastResort"), - NULL) - != kCFCompareEqualTo)) - CFArrayAppendValue (families, family); - } - CFRelease (orig_families); - } + families = CFArrayCreateMutable (NULL, count, &kCFTypeArrayCallBacks); + if (families) + for (i = 0; i < count; i++) + { + CFStringRef family = CFArrayGetValueAtIndex (orig_families, i); + + if (!CFStringHasPrefix (family, CFSTR (".")) + && (CTFontManagerCompareFontFamilyNames (family, + CFSTR ("LastResort"), + NULL) + != kCFCompareEqualTo)) + CFArrayAppendValue (families, family); + } + CFRelease (orig_families); } - return families; + return families; } static Boolean -mac_ctfont_equal_in_postscript_name (CTFontRef font1, CTFontRef font2) +mac_font_equal_in_postscript_name (CTFontRef font1, CTFontRef font2) { Boolean result; CFStringRef name1, name2; @@ -3595,8 +3560,8 @@ mac_ctfont_equal_in_postscript_name (CTFontRef font1, CTFontRef font2) } static CTLineRef -mac_ctfont_create_line_with_string_and_font (CFStringRef string, - CTFontRef macfont) +mac_font_create_line_with_string_and_font (CFStringRef string, + CTFontRef macfont) { CFStringRef keys[] = {kCTFontAttributeName, kCTKernAttributeName}; CFTypeRef values[] = {NULL, NULL}; @@ -3645,7 +3610,7 @@ mac_ctfont_create_line_with_string_and_font (CFStringRef string, CFDictionaryGetValue (attributes, kCTFontAttributeName); if (font_in_run == NULL) break; - if (!mac_ctfont_equal_in_postscript_name (macfont, font_in_run)) + if (!mac_font_equal_in_postscript_name (macfont, font_in_run)) break; } if (i < nruns) @@ -3659,11 +3624,11 @@ mac_ctfont_create_line_with_string_and_font (CFStringRef string, } static CFIndex -mac_ctfont_shape (CTFontRef font, CFStringRef string, - struct mac_glyph_layout *glyph_layouts, CFIndex glyph_len) +mac_font_shape (CTFontRef font, CFStringRef string, + struct mac_glyph_layout *glyph_layouts, CFIndex glyph_len) { CFIndex used, result = 0; - CTLineRef ctline = mac_ctfont_create_line_with_string_and_font (string, font); + CTLineRef ctline = mac_font_create_line_with_string_and_font (string, font); if (ctline == NULL) return 0; @@ -3870,7 +3835,7 @@ mac_ctfont_get_glyph_for_cid (CTFontRef font, CTCharacterCollection collection, CFDictionaryGetValue (attributes, kCTFontAttributeName); if (font_in_run - && mac_ctfont_equal_in_postscript_name (font_in_run, font)) + && mac_font_equal_in_postscript_name (font_in_run, font)) { CTRunGetGlyphs (run, CFRangeMake (0, 1), &result); if (result >= CTFontGetGlyphCount (font)) @@ -3940,7 +3905,7 @@ mac_font_copy_default_descriptors_for_language (CFStringRef language) CFDictionaryRef attributes = CFDictionaryCreate (NULL, ((const void **) - &MAC_FONT_NAME_ATTRIBUTE), + &kCTFontNameAttribute), ((const void **) &macfont_language_default_font_names[i].font_names[j]), 1, &kCFTypeDictionaryKeyCallBacks, @@ -3948,13 +3913,13 @@ mac_font_copy_default_descriptors_for_language (CFStringRef language) if (attributes) { - FontDescriptorRef pat_desc = - mac_font_descriptor_create_with_attributes (attributes); + CTFontDescriptorRef pat_desc = + CTFontDescriptorCreateWithAttributes (attributes); if (pat_desc) { - FontDescriptorRef descriptor = - mac_font_descriptor_create_matching_font_descriptor (pat_desc, NULL); + CTFontDescriptorRef descriptor = + CTFontDescriptorCreateMatchingFontDescriptor (pat_desc, NULL); if (descriptor) { @@ -3992,15 +3957,15 @@ mac_font_copy_default_name_for_charset_and_languages (CFCharacterSetRef charset, for (i = 0; i < count; i++) { - FontDescriptorRef descriptor = + CTFontDescriptorRef descriptor = CFArrayGetValueAtIndex (descriptors, i); if (macfont_supports_charset_and_languages_p (descriptor, charset, Qnil, languages)) { CFStringRef family = - mac_font_descriptor_copy_attribute (descriptor, - MAC_FONT_FAMILY_NAME_ATTRIBUTE); + CTFontDescriptorCopyAttribute (descriptor, + kCTFontFamilyNameAttribute); if (family) { if (!CFStringHasPrefix (family, CFSTR (".")) @@ -4024,7 +3989,7 @@ void * macfont_get_nsctfont (struct font *font) { struct macfont_info *macfont_info = (struct macfont_info *) font; - FontRef macfont = macfont_info->macfont; + CTFontRef macfont = macfont_info->macfont; return (void *) macfont; } commit 5e63c842007b0f85e91735a7c4e00be0b7fe9ba5 Author: Paul Eggert Date: Fri Aug 28 22:24:10 2015 -0700 Fix minor text quoting in calc, calendar, vc * lisp/calc/calc-ext.el (calc-shift-Z-prefix-help): * lisp/calc/calc-help.el (calc-j-prefix-help): * lisp/calc/calc-misc.el (calc-help): * lisp/calc/calc.el (calc-algebraic-mode, calc-mode): Escape an apostrophe in a docstring. * lisp/calc/calc-forms.el (calc-hms-notation): * lisp/calc/calc-mode.el (calc-display-raw, calc-algebraic-mode): Escape an apostrophe in a diagnostic. * lisp/calc/calc-misc.el (calc-help): * lisp/calendar/diary-lib.el (diary-include-files): * lisp/calendar/todo-mode.el (todo-prefix, todo-item-mark): * lisp/vc/diff-mode.el (diff-delete-trailing-whitespace): * lisp/vc/ediff-diff.el (ediff-same-contents): * lisp/vc/ediff-merg.el (ediff-re-merge): * lisp/vc/ediff-ptch.el (ediff-patch-file-internal): * lisp/vc/ediff-util.el (ediff-test-save-region) (ediff-status-info): * lisp/vc/ediff.el (ediff-merge-revisions) (ediff-merge-revisions-with-ancestor): * lisp/vc/pcvs.el (cvs-mode-checkout, cvs-vc-command-advice): * lisp/vc/vc-cvs.el (vc-cvs-mode-line-string): Respect text quoting style in doc string or diagnostic. * lisp/calc/calc-prog.el (calc-kbd-push, calc-kbd-pop): * lisp/vc/add-log.el (change-log-goto-source): Avoid double-formatting. * lisp/vc/ediff-init.el (format-message): New backward-compatibility alias. diff --git a/lisp/calc/calc-ext.el b/lisp/calc/calc-ext.el index bd33fbe..2442f02 100644 --- a/lisp/calc/calc-ext.el +++ b/lisp/calc/calc-ext.el @@ -1988,7 +1988,7 @@ calc-kill calc-kill-region calc-yank)))) "kbd-macros: [ (if), : (else), | (else-if), ] (end-if)" "kbd-macros: < > (repeat), ( ) (for), { } (loop)" "kbd-macros: / (break)" - "kbd-macros: \\=` (save), ' (restore)") + "kbd-macros: \\=` (save), \\=' (restore)") "user" ?Z)) diff --git a/lisp/calc/calc-forms.el b/lisp/calc/calc-forms.el index c6e1fdb..08fa5ce 100644 --- a/lisp/calc/calc-forms.el +++ b/lisp/calc/calc-forms.el @@ -63,7 +63,7 @@ (defun calc-hms-notation (fmt) - (interactive "sHours-minutes-seconds format (hms, @ ' \", etc.): ") + (interactive "sHours-minutes-seconds format (hms, @ \\=' \", etc.): ") (calc-wrapper (if (string-match "\\`\\([^,; ]+\\)\\([,; ]*\\)\\([^,; ]\\)\\([,; ]*\\)\\([^,; ]\\)\\'" fmt) (progn @@ -273,7 +273,7 @@ (m (math-normalize (nth 2 a))) (s (let ((calc-internal-prec (max (- calc-internal-prec 4) 3))) (math-normalize (nth 3 a))))) - (if (or + (if (or (math-negp h) (and (= h 0) (math-negp m)) (and (= h 0) (= m 0) (math-negp s))) @@ -378,15 +378,15 @@ ;;; A numerical date is the number of days since midnight on ;;; the morning of December 31, 1 B.C. (Gregorian) or January 2, 1 A.D. (Julian). ;;; Emacs's calendar refers to such a date as an absolute date, some Calc function -;;; names also use that terminology. If the date is a non-integer, it represents -;;; a specific date and time. +;;; names also use that terminology. If the date is a non-integer, it represents +;;; a specific date and time. ;;; A "dt" is a list of the form, (year month day), corresponding to ;;; an integer code, or (year month day hour minute second), corresponding ;;; to a non-integer code. (defun math-date-to-gregorian-dt (date) "Return the day (YEAR MONTH DAY) in the Gregorian calendar. -DATE is the number of days since December 31, -1 in the Gregorian calendar." +DATE is the number of days since December 31, -1 in the Gregorian calendar." (let* ((month 1) day (year (math-quotient (math-add date (if (Math-lessp date 711859) @@ -399,7 +399,7 @@ DATE is the number of days since December 31, -1 in the Gregorian calendar." (setq year (math-add year -1))) (if (eq year 0) (setq year -1)) (setq date (1+ (math-sub date temp))) - (setq temp + (setq temp (if (math-leap-year-p year) [1 32 61 92 122 153 183 214 245 275 306 336 999] [1 32 60 91 121 152 182 213 244 274 305 335 999])) @@ -410,7 +410,7 @@ DATE is the number of days since December 31, -1 in the Gregorian calendar." (defun math-date-to-julian-dt (date) "Return the day (YEAR MONTH DAY) in the Julian calendar. -DATE is the number of days since December 31, -1 in the Gregorian calendar." +DATE is the number of days since December 31, -1 in the Gregorian calendar." (let* ((month 1) day (year (math-quotient (math-add date (if (Math-lessp date 711859) @@ -423,7 +423,7 @@ DATE is the number of days since December 31, -1 in the Gregorian calendar." (setq year (math-add year -1))) (if (eq year 0) (setq year -1)) (setq date (1+ (math-sub date temp))) - (setq temp + (setq temp (if (math-leap-year-p year t) [1 32 61 92 122 153 183 214 245 275 306 336 999] [1 32 60 91 121 152 182 213 244 274 305 335 999])) @@ -444,7 +444,7 @@ in the Gregorian calendar and the remaining part determines the time." (date (car parts)) (time (nth 1 parts)) (dt (if (and calc-gregorian-switch - (Math-lessp value + (Math-lessp value (or (nth 3 calc-gregorian-switch) (apply 'math-absolute-from-gregorian-dt calc-gregorian-switch)) @@ -453,7 +453,7 @@ in the Gregorian calendar and the remaining part determines the time." (math-date-to-gregorian-dt date)))) (if (math-integerp value) dt - (append dt + (append dt (list (/ time 3600) (% (/ time 60) 60) @@ -467,13 +467,13 @@ in the Gregorian calendar and the remaining part determines the time." (year (math-add approx (let ((y approx) (sum 0)) - (while (>= (math-compare date + (while (>= (math-compare date (math-absolute-from-iso-dt (setq y (math-add y 1)) 1 1)) 0) (setq sum (+ sum 1))) sum)))) - (list + (list year - (math-add (car (math-idivmod + (math-add (car (math-idivmod (math-sub date (math-absolute-from-iso-dt year 1 1)) 7)) 1) @@ -525,7 +525,7 @@ in the Gregorian calendar and the remaining part determines the time." (defun math-leap-year-p (year &optional julian) "Non-nil if YEAR is a leap year. If JULIAN is non-nil, then use the criterion for leap years -in the Julian calendar, otherwise use the criterion in the +in the Julian calendar, otherwise use the criterion in the Gregorian calendar." (if julian (if (math-negp year) @@ -584,7 +584,7 @@ Recall that DATE is the number of days since December 31, -1 in the Gregorian calendar." (if (eq year 0) (setq year -1)) (let ((yearm1 (math-sub year 1))) - (math-sub + (math-sub ;; Add the number of days of the year and the numbers of days ;; in the previous years (leap year days to be added separately) (math-add (math-day-in-year year month day) @@ -595,9 +595,9 @@ in the Gregorian calendar." (math-sub 365 (math-quotient (math-sub 3 year) 4))))) - ;; Subtract the number of Julian leap years which are not - ;; Gregorian leap years. In C=4N+r centuries, there will - ;; be 3N+r of these days. The following will compute + ;; Subtract the number of Julian leap years which are not + ;; Gregorian leap years. In C=4N+r centuries, there will + ;; be 3N+r of these days. The following will compute ;; 3N+r. (let* ((correction (math-mul (math-quotient yearm1 100) 3)) (res (math-idivmod correction 4))) @@ -612,7 +612,7 @@ Recall that DATE is the number of days since December 31, -1 in the Gregorian calendar." (if (eq year 0) (setq year -1)) (let ((yearm1 (math-sub year 1))) - (math-sub + (math-sub ;; Add the number of days of the year and the numbers of days ;; in the previous years (leap year days to be added separately) (math-add (math-day-in-year year month day) @@ -731,11 +731,11 @@ as measured in the integer number of days before December 31, 1 BC (Gregorian)." ((eq x 'n) (math-format-number (math-floor math-fd-date))) ((eq x 'J) - (math-format-number + (math-format-number (math-add math-fd-date math-julian-date-beginning))) ((eq x 'j) - (math-format-number (math-add - (math-floor math-fd-date) + (math-format-number (math-add + (math-floor math-fd-date) math-julian-date-beginning-int))) ((eq x 'U) (math-format-number (nth 1 (math-date-parts math-fd-date 719164)))) @@ -1082,7 +1082,7 @@ as measured in the integer number of days before December 31, 1 BC (Gregorian)." (throw 'syntax "Day value is out of range")) (and hour (progn - (if (or (< hour 0) + (if (or (< hour 0) (> hour 24) (and (= hour 24) (not (= minute 0)) @@ -1102,7 +1102,7 @@ as measured in the integer number of days before December 31, 1 BC (Gregorian)." (throw 'syntax "Weekday value is out of range")) (and hour (progn - (if (or (< hour 0) + (if (or (< hour 0) (> hour 24) (and (= hour 24) (not (= minute 0)) @@ -1473,7 +1473,7 @@ as measured in the integer number of days before December 31, 1 BC (Gregorian)." ;; From cal-dst (defvar calendar-current-time-zone-cache) -(defvar math-calendar-tzinfo +(defvar math-calendar-tzinfo nil "Information about the timezone, retrieved from the calendar.") @@ -1523,7 +1523,7 @@ second, the number of seconds offset for daylight savings." (if (calc-var-value 'var-TimeZone) (calcFunc-tzone (calc-var-value 'var-TimeZone) date) (let ((tzinfo (math-get-calendar-tzinfo))) - (+ (nth 0 tzinfo) + (+ (nth 0 tzinfo) (* (math-cal-daylight-savings-adjust date) (nth 1 tzinfo))))))) (defvar math-daylight-savings-hook 'math-std-daylight-savings) @@ -1559,8 +1559,8 @@ second, the number of seconds offset for daylight savings." (+ (nth 3 dt) (/ (nth 4 dt) 60.0))) (t 0))) - (rounded-abs-date - (+ + (rounded-abs-date + (+ (calendar-absolute-from-gregorian (list (nth 1 dt) (nth 2 dt) (nth 0 dt))) (/ (round (* 60 time)) 60.0 24.0)))) @@ -1700,7 +1700,7 @@ and ends on the last Sunday of October at 2 a.m." (let* ((dt (math-date-to-dt date)) (dim (math-days-in-month (car dt) (nth 1 dt))) (julian (if calc-gregorian-switch - (math-date-to-dt (math-sub + (math-date-to-dt (math-sub (or (nth 3 calc-gregorian-switch) (apply 'math-absolute-from-gregorian-dt calc-gregorian-switch)) 1))))) @@ -1727,14 +1727,14 @@ and ends on the last Sunday of October at 2 a.m." (list 'date (math-dt-to-date (list (car dt) (nth 1 dt) (1+ day)))) ;; Otherwise do some computations (let ((tm (+ day (- (nth 2 calc-gregorian-switch) (nth 2 julian))))) - (list 'date (math-dt-to-date + (list 'date (math-dt-to-date (list (car dt) (nth 1 dt) - ;; + ;; (if (> tm dim) dim tm))))))) ((and (eq (car dt) (car julian)) (= (nth 1 dt) (nth 1 julian))) - ;; In this case, the current month is truncated because of the switch + ;; In this case, the current month is truncated because of the switch ;; to the Gregorian calendar (list 'date (math-dt-to-date (list (car dt) @@ -1742,7 +1742,7 @@ and ends on the last Sunday of October at 2 a.m." (if (>= day (nth 2 julian)) (nth 2 julian) (1+ day)))))) - (t + (t ;; The default (list 'date (math-add (math-dt-to-date (list (car dt) (nth 1 dt) 1)) day)))) (list 'date (math-add (math-dt-to-date (list (car dt) (nth 1 dt) 1)) day))))) @@ -1779,7 +1779,7 @@ and ends on the last Sunday of October at 2 a.m." ;; Otherwise, just make sure the date doesn't go past the end of the year (list 'date (math-min (math-add (math-dt-to-date (list (car dt) 1 1)) (1- day)) (math-dt-to-date (list (car dt) 12 31)))))) - (t + (t (list 'date (math-add (math-dt-to-date (list (car dt) 1 1)) (1- day))))) (list 'date (math-add (math-dt-to-date (list (car dt) 1 1)) diff --git a/lisp/calc/calc-help.el b/lisp/calc/calc-help.el index 18c3b76..395b12d 100644 --- a/lisp/calc/calc-help.el +++ b/lisp/calc/calc-help.el @@ -546,7 +546,7 @@ C-w Describe how there is no warranty for Calc." '("Select, Additional, Once; eVal, Formula; Rewrite" "More, Less, 1-9, Next, Previous" "Unselect, Clear; Display; Enable; Breakable" - "' (replace), \\=` (edit), +, -, *, /, RET (grab), DEL" + "\\=' (replace), \\=` (edit), +, -, *, /, RET (grab), DEL" "SHIFT + swap: Left, Right; maybe: Select, Once" "SHIFT + Commute, Merge, Distrib, jump-Eqn, Isolate" "SHIFT + Negate, & (invert); Unpack") diff --git a/lisp/calc/calc-misc.el b/lisp/calc/calc-misc.el index 4d84146..e141589 100644 --- a/lisp/calc/calc-misc.el +++ b/lisp/calc/calc-misc.el @@ -225,7 +225,7 @@ Calc user interface as before (either C-x * C or C-x * K; initially C-x * C). "Letter keys: SHIFT + Num-eval; More-recn; eXec-kbd-macro; Keep-args" "Other keys: +, -, *, /, ^, \\ (int div), : (frac div)" "Other keys: & (1/x), | (concat), % (modulo), ! (factorial)" - "Other keys: ' (alg-entry), = (eval), \\=` (edit); M-RET (last-args)" + "Other keys: \\=' (alg-entry), = (eval), \\=` (edit); M-RET (last-args)" "Other keys: SPC/RET (enter/dup), LFD (over); < > (scroll horiz)" "Other keys: DEL (drop), M-DEL (drop-above); { } (scroll vert)" "Other keys: TAB (swap/roll-dn), M-TAB (roll-up)" @@ -253,11 +253,12 @@ Calc user interface as before (either C-x * C or C-x * K; initially C-x * C). 0)) (let ((msg (nth calc-help-phase msgs))) (message "%s" (if msg - (concat msg ":" + (concat (substitute-command-keys msg) ":" (make-string (- (apply 'max (mapcar 'length msgs)) - (length msg)) 32) + (length msg)) + ?\ ) " [?=MORE]") "")))))))) diff --git a/lisp/calc/calc-mode.el b/lisp/calc/calc-mode.el index 605084e..b5eef7f 100644 --- a/lisp/calc/calc-mode.el +++ b/lisp/calc/calc-mode.el @@ -258,7 +258,7 @@ (setq calc-display-raw (if calc-display-raw nil (if arg 0 t))) (calc-do-refresh) (if calc-display-raw - (message "Press d ' again to cancel \"raw\" display mode")))) + (message "%s" "Press d ' again to cancel \"raw\" display mode")))) @@ -446,11 +446,11 @@ (calc-change-mode '(calc-algebraic-mode calc-incomplete-algebraic-mode) (list (not calc-algebraic-mode) nil))) (use-local-map calc-mode-map) - (message (if calc-algebraic-mode - "Numeric keys and ( and [ begin algebraic entry" - (if calc-incomplete-algebraic-mode - "Only ( and [ begin algebraic entry" - "No keys except ' and $ begin algebraic entry"))))) + (message "%s" (if calc-algebraic-mode + "Numeric keys and ( and [ begin algebraic entry" + (if calc-incomplete-algebraic-mode + "Only ( and [ begin algebraic entry" + "No keys except ' and $ begin algebraic entry"))))) (defun calc-symbolic-mode (n) (interactive "P") diff --git a/lisp/calc/calc-prog.el b/lisp/calc/calc-prog.el index cc1d270..58d2b5c 100644 --- a/lisp/calc/calc-prog.el +++ b/lisp/calc/calc-prog.el @@ -1441,7 +1441,7 @@ Redefine the corresponding command." (let ((calc-kbd-push-level 0)) (execute-kbd-macro (substring body 0 -2)))) (let ((calc-kbd-push-level (1+ calc-kbd-push-level))) - (message "Saving modes; type Z' to restore") + (message "%s" "Saving modes; type Z' to restore") (recursive-edit)))))) (defun calc-kbd-pop () @@ -1450,7 +1450,7 @@ Redefine the corresponding command." (progn (message "Mode settings restored") (exit-recursive-edit)) - (error "Unbalanced Z' in keyboard macro"))) + (error "%s" "Unbalanced Z' in keyboard macro"))) ;; (defun calc-kbd-report (msg) diff --git a/lisp/calc/calc.el b/lisp/calc/calc.el index 8e4df58..ea20986 100644 --- a/lisp/calc/calc.el +++ b/lisp/calc/calc.el @@ -736,7 +736,7 @@ If hms, angles are in degrees-minutes-seconds.") (defcalcmodevar calc-algebraic-mode nil "If non-nil, numeric entry accepts whole algebraic expressions. -If nil, algebraic expressions must be preceded by \"'\".") +If nil, algebraic expressions must be preceded by \"\\='\".") (defcalcmodevar calc-incomplete-algebraic-mode nil "Like calc-algebraic-mode except only affects ( and [ keys.") @@ -1311,7 +1311,7 @@ This is an RPN calculator featuring arbitrary-precision integer, rational, floating-point, complex, matrix, and symbolic arithmetic. RPN calculation: 2 RET 3 + produces 5. -Algebraic style: ' 2+3 RET produces 5. +Algebraic style: \\=' 2+3 RET produces 5. Basic operators are +, -, *, /, ^, & (reciprocal), % (modulo), n (change-sign). @@ -1330,7 +1330,7 @@ Notations: 3.14e6 3.14 * 10^6 [1 .. 4) semi-open interval, 1 <= x < 4 2 +/- 3 (p key) number with mean 2, standard deviation 3 2 mod 3 (M key) number 2 computed modulo 3 - <1 jan 91> Date form (enter using ' key) + <1 jan 91> Date form (enter using \\=' key) \\{calc-mode-map} diff --git a/lisp/calendar/diary-lib.el b/lisp/calendar/diary-lib.el index ec02900..b21fc68 100644 --- a/lisp/calendar/diary-lib.el +++ b/lisp/calendar/diary-lib.el @@ -910,10 +910,12 @@ This is recursive; that is, included files may include other files." (diary-list-entries original-date number t))))) (display-warning :error - (format "Can't read included diary file %s\n" diary-file))) + (format-message "Can't read included diary file %s\n" + diary-file))) (display-warning :error - (format "Can't find included diary file %s\n" diary-file))))) + (format-message "Can't find included diary file %s\n" + diary-file))))) (goto-char (point-min))) (defun diary-include-other-diary-files () diff --git a/lisp/calendar/todo-mode.el b/lisp/calendar/todo-mode.el index 925d008..83f2fed 100644 --- a/lisp/calendar/todo-mode.el +++ b/lisp/calendar/todo-mode.el @@ -237,7 +237,8 @@ The final element is \"*\", indicating an unspecified month.") (when (string= (widget-value widget) todo-item-mark) (widget-put widget :error - "Invalid value: must be distinct from ‘todo-item-mark’") + (format-message + "Invalid value: must be distinct from ‘todo-item-mark’")) widget))) :initialize 'custom-initialize-default :set 'todo-reset-prefix @@ -1694,7 +1695,8 @@ only when no items are marked." (when (string= (widget-value widget) todo-prefix) (widget-put widget :error - "Invalid value: must be distinct from ‘todo-prefix’") + (format-message + "Invalid value: must be distinct from ‘todo-prefix’")) widget))) :set (lambda (symbol value) (custom-set-default symbol (propertize value 'face 'todo-mark))) diff --git a/lisp/vc/add-log.el b/lisp/vc/add-log.el index e24b6cc..d120d05 100644 --- a/lisp/vc/add-log.el +++ b/lisp/vc/add-log.el @@ -481,9 +481,9 @@ try to visit the file for the change under `point' instead." (apply 'change-log-goto-source-1 (append change-log-find-head change-log-find-tail)) (error - (format "Cannot find more matches for tag `%s' in file `%s'" - (car change-log-find-head) - (nth 2 change-log-find-head))))) + "Cannot find more matches for tag `%s' in file `%s'" + (car change-log-find-head) + (nth 2 change-log-find-head)))) (save-excursion (let* ((at (point)) (tag-at (change-log-search-tag-name)) @@ -515,9 +515,8 @@ try to visit the file for the change under `point' instead." (condition-case nil (setq change-log-find-tail (apply 'change-log-goto-source-1 change-log-find-head)) - (error - (format "Cannot find matches for tag `%s' in file `%s'" - tag file))))))))) + (error "Cannot find matches for tag `%s' in file `%s'" + tag file)))))))) (defun change-log-next-error (&optional argp reset) "Move to the Nth (default 1) next match in a ChangeLog buffer. diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el index 948a45e..37ed4a5 100644 --- a/lisp/vc/diff-mode.el +++ b/lisp/vc/diff-mode.el @@ -2128,7 +2128,8 @@ fixed, visit it in a buffer." (goto-char hunk-end)) (if modified-buffers (message "Deleted trailing whitespace from %s." - (mapconcat (lambda (buf) (concat "`" (buffer-name buf) "'")) + (mapconcat (lambda (buf) (format-message + "`%s'" (buffer-name buf))) modified-buffers ", ")) (message "No trailing whitespace to delete."))))) diff --git a/lisp/vc/ediff-diff.el b/lisp/vc/ediff-diff.el index b309394..352892c 100644 --- a/lisp/vc/ediff-diff.el +++ b/lisp/vc/ediff-diff.el @@ -1373,7 +1373,7 @@ affects only files whose names match the expression." ;; Normalize empty filter RE to nil. (unless (> (length filter-re) 0) (setq filter-re nil)) ;; Indicate progress - (message "Comparing ‘%s’ and ‘%s’ modulo ‘%s’" d1 d2 filter-re) + (message "Comparing `%s' and `%s' modulo `%s'" d1 d2 filter-re) (cond ;; D1 & D2 directories => recurse ((and (file-directory-p d1) diff --git a/lisp/vc/ediff-init.el b/lisp/vc/ediff-init.el index d6b538c..8c935bf 100644 --- a/lisp/vc/ediff-init.el +++ b/lisp/vc/ediff-init.el @@ -1719,6 +1719,9 @@ Unless optional argument INPLACE is non-nil, return a new string." (aset newstr i tochar))) newstr))) +(unless (fboundp 'format-message) + (defalias 'format-message 'format)) + (defun ediff-abbrev-jobname (jobname) (cond ((eq jobname 'ediff-directories) "Compare two directories") diff --git a/lisp/vc/ediff-merg.el b/lisp/vc/ediff-merg.el index 72dfc08..2da3de1 100644 --- a/lisp/vc/ediff-merg.el +++ b/lisp/vc/ediff-merg.el @@ -268,8 +268,8 @@ Buffer B." (setq ediff-default-variant (intern (completing-read - (format "Current merge default is `%S'. New default: " - ediff-default-variant) + (format-message "Current merge default is `%S'. New default: " + ediff-default-variant) actual-alist nil 'must-match))) (ediff-do-merge ediff-current-difference 'remerge) (ediff-recenter) diff --git a/lisp/vc/ediff-ptch.el b/lisp/vc/ediff-ptch.el index 80990fe..b665034 100644 --- a/lisp/vc/ediff-ptch.el +++ b/lisp/vc/ediff-ptch.el @@ -723,7 +723,7 @@ optional argument, then use it." (with-output-to-temp-buffer ediff-msg-buffer (ediff-with-current-buffer standard-output (fundamental-mode)) - (princ (format + (princ (format-message "Patch program has failed due to a bad patch file, it couldn't apply all hunks, OR it couldn't create the backup for the file being patched. diff --git a/lisp/vc/ediff-util.el b/lisp/vc/ediff-util.el index 26bba40..bf5bb5c 100644 --- a/lisp/vc/ediff-util.el +++ b/lisp/vc/ediff-util.el @@ -2097,7 +2097,7 @@ ARG is a prefix argument. If nil, copy the current difference region." (if this-buf-n-th-diff-saved (if (yes-or-no-p - (format + (format-message "You've previously copied diff region %d to buffer %S. Confirm? " (1+ n) buf-type)) t @@ -2858,13 +2858,14 @@ Hit \\[ediff-recenter] to reset the windows afterward." (B-line (ediff-with-current-buffer ediff-buffer-B (1+ (count-lines (point-min) (point))))) C-line) - (princ (format "\Buffer A's point is on line %d\n" A-line)) - (princ (format "Buffer B's point is on line %d\n" B-line)) + (princ (format-message "Buffer A's point is on line %d\n" A-line)) + (princ (format-message "Buffer B's point is on line %d\n" B-line)) (if ediff-3way-job (progn (setq C-line (ediff-with-current-buffer ediff-buffer-C (1+ (count-lines (point-min) (point))))) - (princ (format "Buffer C's point is on line %d\n" C-line))))) + (princ (format-message + "Buffer C's point is on line %d\n" C-line))))) (princ (format "\nCurrent difference number = %S\n" (cond ((< ediff-current-difference 0) 'start) @@ -2890,7 +2891,7 @@ Hit \\[ediff-recenter] to reset the windows afterward." (princ "\nIgnoring regions that match") (princ - (format + (format-message "\n\t regexp `%s' in buffer A %S\n\t regexp `%s' in buffer B\n" ediff-regexp-hide-A ediff-hide-regexp-connective ediff-regexp-hide-B))) @@ -2899,15 +2900,16 @@ Hit \\[ediff-recenter] to reset the windows afterward." (princ "\nFocusing on regions that match") (princ - (format + (format-message "\n\t regexp `%s' in buffer A %S\n\t regexp `%s' in buffer B\n" ediff-regexp-focus-A ediff-focus-regexp-connective ediff-regexp-focus-B))) (t (princ "\nSelective browsing via a user-defined method.\n"))) (princ - (format "\nBugs/suggestions: type `%s' while in Ediff Control Panel." - (substitute-command-keys "\\[ediff-submit-report]"))) + (format-message + "\nBugs/suggestions: type `%s' while in Ediff Control Panel." + (substitute-command-keys "\\[ediff-submit-report]"))) ) ; with output (if (frame-live-p ediff-control-frame) (ediff-reset-mouse ediff-control-frame)) diff --git a/lisp/vc/ediff.el b/lisp/vc/ediff.el index 837940c..65ca0bd 100644 --- a/lisp/vc/ediff.el +++ b/lisp/vc/ediff.el @@ -1294,7 +1294,7 @@ buffer." (let (rev1 rev2) (setq rev1 (read-string - (format + (format-message "Version 1 to merge (default %s's working version): " (if (stringp file) (file-name-nondirectory file) "current buffer"))) @@ -1326,7 +1326,7 @@ buffer." (let (rev1 rev2 ancestor-rev) (setq rev1 (read-string - (format + (format-message "Version 1 to merge (default %s's working version): " (if (stringp file) (file-name-nondirectory file) "current buffer"))) @@ -1338,7 +1338,7 @@ buffer." (file-name-nondirectory file) "current buffer"))) ancestor-rev (read-string - (format + (format-message "Ancestor version (default %s's base revision): " (if (stringp file) (file-name-nondirectory file) "current buffer")))) diff --git a/lisp/vc/pcvs.el b/lisp/vc/pcvs.el index 6d8e537..f6a9e08 100644 --- a/lisp/vc/pcvs.el +++ b/lisp/vc/pcvs.el @@ -968,10 +968,10 @@ With a prefix argument, prompt for cvs FLAGS to use." The files are stored to DIR." (interactive (let* ((branch (cvs-prefix-get 'cvs-branch-prefix)) - (prompt (format "CVS Checkout Directory for `%s%s': " - (cvs-get-module) - (if branch (format " (branch: %s)" branch) - "")))) + (prompt (format-message "CVS Checkout Directory for `%s%s': " + (cvs-get-module) + (if branch (format " (branch: %s)" branch) + "")))) (list (read-directory-name prompt nil default-directory nil)))) (let ((modules (split-string-and-unquote (cvs-get-module))) (flags (cvs-add-branch-prefix @@ -2403,9 +2403,9 @@ The exact behavior is determined also by `cvs-dired-use-hook'." (goto-char (point-min)) (looking-at ".*to add this file permanently\n\\'")) (dolist (file (if (listp files) files (list files))) - (insert "cvs add: scheduling file `" - (file-name-nondirectory file) - "' for addition\n"))) + (insert (format-message + "cvs add: scheduling file `%s' for addition\n" + (file-name-nondirectory file))))) ;; VC never (?) does `cvs -n update' so dcd=nil ;; should probably always be the right choice. (cvs-parse-process nil subdir)))))))) diff --git a/lisp/vc/vc-cvs.el b/lisp/vc/vc-cvs.el index 298bcef..0aa9c5a 100644 --- a/lisp/vc/vc-cvs.el +++ b/lisp/vc/vc-cvs.el @@ -281,7 +281,7 @@ committed and support display of sticky tags." (propertize (if (zerop (length sticky-tag)) string - (setq help-echo (format-message "%s on the ‘%s’ branch" + (setq help-echo (format-message "%s on the `%s' branch" help-echo sticky-tag)) (concat string "[" sticky-tag "]")) 'help-echo help-echo))) commit ff441d3508add9eed3c5217ae7b0a8800b9fc917 Author: Paul Eggert Date: Fri Aug 28 20:32:03 2015 -0700 Fix minor text quoting problems in lisp top level * lisp/apropos.el (apropos-describe-plist): * lisp/cus-theme.el (customize-themes): * lisp/dired.el (dired-log): * lisp/help-fns.el (describe-variable): * lisp/hexl.el (hexl-insert-multibyte-char): * lisp/info.el (Info-finder-find-node): * lisp/json.el (json-read-string): * lisp/novice.el (disabled-command-function) (disabled-command-function): * lisp/startup.el (normal-mouse-startup-screen): * lisp/woman.el (WoMan-log, WoMan-warn): Respect text quoting style in doc string or diagnostic. * lisp/replace.el (replace-character-fold): * src/syntax.c (Fmodify_syntax_entry): Escape an apostrophe in a docstring. * lisp/tempo.el (tempo-define-template): Remove confusing apostrophe from docstring. * lisp/whitespace.el (whitespace-mark-x): Use directed quotes in docstring. diff --git a/lisp/apropos.el b/lisp/apropos.el index 73f86df..ec21296 100644 --- a/lisp/apropos.el +++ b/lisp/apropos.el @@ -1205,7 +1205,7 @@ If non-nil, TEXT is a string that will be printed as a heading." (set-buffer standard-output) (princ "Symbol ") (prin1 symbol) - (princ "'s plist is\n (") + (princ (substitute-command-keys "'s plist is\n (")) (put-text-property (+ (point-min) 7) (- (point) 14) 'face 'apropos-symbol) (insert (apropos-format-plist symbol "\n ")) diff --git a/lisp/cus-theme.el b/lisp/cus-theme.el index bc221e1..7693c70 100644 --- a/lisp/cus-theme.el +++ b/lisp/cus-theme.el @@ -587,7 +587,7 @@ Theme files are named *-theme.el in `")) :follow-link 'mouse-face :action (lambda (_widget &rest _ignore) (describe-variable 'custom-theme-load-path))) - (widget-insert "'.\n\n") + (widget-insert (substitute-command-keys "'.\n\n")) ;; If the user has made customizations, display a warning and ;; provide buttons to disable or convert them. diff --git a/lisp/dired.el b/lisp/dired.el index f47c066..206de37 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -3567,7 +3567,7 @@ Thus, use \\[backward-page] to find the beginning of a group of errors." (unless (bolp) (insert "\n")) (insert (current-time-string) - "\tBuffer `" (buffer-name obuf) "'\n") + (format-message "\tBuffer ‘%s’\n" (buffer-name obuf))) (goto-char (point-max)) (insert "\f\n"))))))) diff --git a/lisp/help-fns.el b/lisp/help-fns.el index 5f0dc87..a1d121c 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el @@ -746,7 +746,7 @@ it is displayed along with the global value." (princ "Its "))) (if valvoid (princ " is void as a variable.") - (princ "'s ")))) + (princ (substitute-command-keys "’s "))))) (unless valvoid (with-current-buffer standard-output (setq val-start-pos (point)) @@ -859,11 +859,14 @@ it is displayed along with the global value." ((not permanent-local)) ((bufferp locus) (setq extra-line t) - (princ " This variable's buffer-local value is permanent.\n")) + (princ + (substitute-command-keys + " This variable's buffer-local value is permanent.\n"))) (t (setq extra-line t) - (princ " This variable's value is permanent \ -if it is given a local binding.\n"))) + (princ (substitute-command-keys + " This variable's value is permanent \ +if it is given a local binding.\n")))) ;; Mention if it's an alias. (unless (eq alias variable) @@ -896,7 +899,8 @@ if it is given a local binding.\n"))) (dir-locals-find-file (buffer-file-name buffer)))) (dir-file t)) - (princ " This variable's value is directory-local") + (princ (substitute-command-keys + " This variable's value is directory-local")) (if (null file) (princ ".\n") (princ ", set ") @@ -918,7 +922,8 @@ if it is given a local binding.\n"))) file 'type 'help-dir-local-var-def 'help-args (list variable file))) (princ (substitute-command-keys "’.\n")))) - (princ " This variable's value is file-local.\n"))) + (princ (substitute-command-keys + " This variable's value is file-local.\n")))) (when (memq variable ignored-local-variables) (setq extra-line t) diff --git a/lisp/hexl.el b/lisp/hexl.el index 3e0ea41..4aa76d2 100644 --- a/lisp/hexl.el +++ b/lisp/hexl.el @@ -935,7 +935,7 @@ and their encoded form is inserted byte by byte." (mapconcat (function (lambda (c) (format "%x" c))) internal " ")) (if (yes-or-no-p - (format + (format-message "Insert char 0x%x's internal representation \"%s\"? " ch internal-hex)) (setq encoded internal) diff --git a/lisp/info.el b/lisp/info.el index 21dbca9..2c92df4 100644 --- a/lisp/info.el +++ b/lisp/info.el @@ -3763,7 +3763,7 @@ Build a menu of the possible matches." ;; I think nxml is the only exception - maybe it should be just be renamed. (let ((str (ignore-errors (lm-commentary (find-library-name nodename))))) (if (null str) - (insert "Can't find package description.\n\n") + (insert "Can’t find package description.\n\n") (insert (with-temp-buffer (insert str) diff --git a/lisp/json.el b/lisp/json.el index eaf8596..5392a13 100644 --- a/lisp/json.el +++ b/lisp/json.el @@ -286,7 +286,7 @@ representation will be parsed correctly." (defun json-read-string () "Read the JSON string at point." (unless (char-equal (json-peek) ?\") - (signal 'json-string-format (list "doesn't start with '\"'!"))) + (signal 'json-string-format (list "doesn’t start with ‘\"’!"))) ;; Skip over the '"' (json-advance) (let ((characters '()) diff --git a/lisp/novice.el b/lisp/novice.el index ce6e16f..18ffa5d 100644 --- a/lisp/novice.el +++ b/lisp/novice.el @@ -65,7 +65,8 @@ If nil, the feature is disabled, i.e., all commands work normally.") (if (stringp (get cmd 'disabled)) (princ (get cmd 'disabled)) (princ "It is disabled because new users often find it confusing.\n") - (princ "Here's the first part of its description:\n\n") + (princ (substitute-command-keys + "Here's the first part of its description:\n\n")) ;; Keep only the first paragraph of the documentation. (with-current-buffer "*Disabled Command*" ;; standard-output (goto-char (point-max)) @@ -80,11 +81,11 @@ If nil, the feature is disabled, i.e., all commands work normally.") (goto-char (point-max)) (indent-rigidly start (point) 3)))) (princ "\n\nDo you want to use this command anyway?\n\n") - (princ "You can now type + (princ (substitute-command-keys "You can now type y to try it and enable it (no questions if you use it again). n to cancel--don't try the command, and it remains disabled. SPC to try the command just this once, but leave it disabled. -! to try it, and enable all disabled commands for this session only.") +! to try it, and enable all disabled commands for this session only.")) ;; Redundant since with-output-to-temp-buffer will do it anyway. ;; (with-current-buffer standard-output ;; (help-mode)) diff --git a/lisp/replace.el b/lisp/replace.el index 26870a3..be73cab 100644 --- a/lisp/replace.el +++ b/lisp/replace.el @@ -35,7 +35,7 @@ (defcustom replace-character-fold nil "Non-nil means `query-replace' should do character folding in matches. -This means, for instance, that ' will match a large variety of +This means, for instance, that \\=' will match a large variety of unicode quotes." :type 'boolean :group 'matching diff --git a/lisp/startup.el b/lisp/startup.el index 1cb3bb6..8c63ed2 100644 --- a/lisp/startup.el +++ b/lisp/startup.el @@ -1935,7 +1935,8 @@ To quit a partially entered command, type Control-g.\n") (insert-button "Visit New File" 'action (lambda (_button) (call-interactively 'find-file)) 'follow-link t) - (insert "\t\tSpecify a new file's name, to edit the file\n") + (insert (substitute-command-keys + "\t\tSpecify a new file's name, to edit the file\n")) (insert-button "Open Home Directory" 'action (lambda (_button) (dired "~")) 'follow-link t) diff --git a/lisp/tempo.el b/lisp/tempo.el index 92e1ea7..6e2f978 100644 --- a/lisp/tempo.el +++ b/lisp/tempo.el @@ -270,7 +270,7 @@ The elements in ELEMENTS can be of several types: - nil: It is ignored. - Anything else: It is evaluated and the result is treated as an element to be inserted. One additional tag is useful for these - cases. If an expression returns a list '(l foo bar), the elements + cases. If an expression returns a list (l foo bar), the elements after `l' will be inserted according to the usual rules. This makes it possible to return several elements from one expression." (let* ((template-name (intern (concat "tempo-template-" diff --git a/lisp/whitespace.el b/lisp/whitespace.el index ddc37f1..3191496 100644 --- a/lisp/whitespace.el +++ b/lisp/whitespace.el @@ -1931,13 +1931,13 @@ cleaning up these problems." (defun whitespace-mark-x (nchars condition) - "Insert the mark ('X' or ' ') after NCHARS depending on CONDITION." + "Insert the mark (‘X’ or ‘ ’) after NCHARS depending on CONDITION." (forward-char nchars) (insert (if condition "X" " "))) (defun whitespace-insert-option-mark (the-list the-value) - "Insert the option mark ('X' or ' ') in toggle options buffer." + "Insert the option mark (‘X’ or ‘ ’) in toggle options buffer." (goto-char (point-min)) (forward-line 2) (dolist (sym the-list) diff --git a/lisp/woman.el b/lisp/woman.el index e903caa..de2cbc1 100644 --- a/lisp/woman.el +++ b/lisp/woman.el @@ -4548,11 +4548,11 @@ Format paragraphs upto TO." (defun WoMan-log (format &rest args) "Log a message out of FORMAT control string and optional ARGS." - (WoMan-log-1 (apply 'format format args))) + (WoMan-log-1 (apply #'format-message format args))) (defun WoMan-warn (format &rest args) "Log a warning message out of FORMAT control string and optional ARGS." - (setq format (apply 'format format args)) + (setq format (apply #'format-message format args)) (WoMan-log-1 (concat "** " format))) ;; request is not used dynamically by any callees. diff --git a/src/syntax.c b/src/syntax.c index 30560af..dc82210 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -1129,7 +1129,7 @@ The first character of NEWENTRY should be one of the following: _ symbol constituent. . punctuation. ( open-parenthesis. ) close-parenthesis. " string quote. \\ escape. - $ paired delimiter. ' expression quote or prefix operator. + $ paired delimiter. \\=' expression quote or prefix operator. < comment starter. > comment ender. / character-quote. @ inherit from parent table. | generic string fence. ! generic comment fence. commit c6af816affb36d512f806725518e6e5f2353b197 Author: Simen Heggestøyl Date: Fri Aug 28 19:36:10 2015 +0200 Fix indentation rule in css-mode * lisp/textmodes/css-mode.el (css-smie-rules): Fix indentation of brackets in presence of pseudo-selectors. (Bug#21328) diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el index d73780c..639456d 100644 --- a/lisp/textmodes/css-mode.el +++ b/lisp/textmodes/css-mode.el @@ -344,7 +344,7 @@ (`(:elem . arg) 0) (`(:list-intro . ,(or `";" `"")) t) ;"" stands for BOB (bug#15467). (`(:before . "{") - (when (smie-rule-hanging-p) + (when (or (smie-rule-hanging-p) (smie-rule-bolp)) (smie-backward-sexp ";") (smie-indent-virtual))) (`(:before . ,(or "{" "(")) diff --git a/test/indent/css-mode.css b/test/indent/css-mode.css index 67a6b1e..2f04e96 100644 --- a/test/indent/css-mode.css +++ b/test/indent/css-mode.css @@ -36,3 +36,8 @@ a.b:c,d.e:f,g[h]:i,j[k]:l,.m.n:o,.p.q:r,.s[t]:u,.v[w]:x { /* bug:20282 */ div.x3 { } + +article:hover +{ + color: black; +} commit fdd095d2fd79f73ec96b9d318248e6ad70931b4a Author: Eli Zaretskii Date: Fri Aug 28 16:25:25 2015 +0300 Fix a bug in recording a macro while flyspell-mode is active * lisp/subr.el (sit-for): Don't call read-event when recording a macro. (Bug#21329) diff --git a/lisp/subr.el b/lisp/subr.el index 53dea3e..61b8706 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -2277,7 +2277,18 @@ floating point support." t) ((input-pending-p t) nil) - ((<= seconds 0) + ((or (<= seconds 0) + ;; We are going to call read-event below, which will record + ;; the the next key as part of the macro, even if that key + ;; invokes kmacro-end-macro, so if we are recording a macro, + ;; the macro will recursively call itself. In addition, when + ;; that key is removed from unread-command-events, it will be + ;; recorded the second time, so the macro will have each key + ;; doubled. This used to happen if a macro was defined with + ;; Flyspell mode active (because Flyspell calls sit-for in its + ;; post-command-hook, see bug #21329.) To avoid all that, we + ;; simply disable the wait when we are recording a macro. + defining-kbd-macro) (or nodisp (redisplay))) (t (or nodisp (redisplay))