summaryrefslogtreecommitdiff
path: root/src/syntax.c
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix minor text quoting problems in lisp top levelPaul Eggert2015-08-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | * 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.
* Fix minor glitches from ‘format’ reversionPaul Eggert2015-08-231-3/+5
| | | | | | | | | * doc/lispref/strings.texi (Formatting Strings): After reversion, ‘text-quoting-style’ is documented in ‘Keys in Documentation’, not below. * src/syntax.c (Finternal_describe_syntax_value): Prefer AUTO_STRING to build_string where either will do, as AUTO_STRING is a bit faster.
* Revert "Prefer ‘format’ to ‘substitute-command-keys’"Andreas Schwab2015-08-231-5/+3
| | | | This reverts commit 6af5aad26411ffe21c3fe4bc5438347110910111.
* Use new q ‘format’ flag when fixing quotes in CPaul Eggert2015-08-181-4/+5
| | | | | | | | | | | | | | | | | | | | | * src/image.c (image_size_error): New function. All uses of image_error with "Invalid image size ..." changed to use it. * src/image.c (image_size_error, xbm_load_image, xbm_load) (xpm_load, xpm_load_image, xpm_load, pbm_load, png_load_body) (jpeg_load_body, tiff_load, gif_load, imagemagick_load_image) (imagemagick_load, svg_load, svg_load_image, gs_load) (x_kill_gs_process): * src/lread.c (load_warn_old_style_backquotes): * src/xfaces.c (load_pixmap): * src/xselect.c (x_clipboard_manager_error_1): Use %qs, not uLSQM and uRSQM. * src/syntax.c (Finternal_describe_syntax_value): Prefer Fsubstitute_command_keys to Fformat, as this lets us use AUTO_STRING. * src/xdisp.c (vadd_to_log): Use AUTO_STRING on the format argument, as it's now guaranteed to be ASCII. * src/xselect.c (x_clipboard_manager_error_2): Avoid grave accent in low-level stderr diagnostic.
* Prefer ‘format’ to ‘substitute-command-keys’Paul Eggert2015-08-141-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | * src/character.h (uLSQM, uRSQM): Move here ... * src/doc.c (uLSQM, uRSQM): ... from here. * src/doc.c (Fsubstitute_command_keys): * src/syntax.c (Finternal_describe_syntax_value): * lisp/cedet/mode-local.el (mode-local-print-binding) (mode-local-describe-bindings-2): * lisp/cedet/srecode/srt-mode.el (srecode-macro-help): * lisp/cus-theme.el (describe-theme-1): * lisp/descr-text.el (describe-text-properties-1, describe-char): * lisp/emacs-lisp/cl-extra.el (cl--describe-class): * lisp/emacs-lisp/cl-generic.el (cl--generic-describe): * lisp/emacs-lisp/eieio-opt.el (eieio-help-constructor): * lisp/emacs-lisp/package.el (describe-package-1): * lisp/faces.el (describe-face): * lisp/help-fns.el (help-fns--key-bindings) (help-fns--compiler-macro, help-fns--parent-mode) (help-fns--obsolete, help-fns--interactive-only) (describe-function-1, describe-variable): * lisp/help.el (describe-mode): Prefer ‘format’ to ‘substitute-command-keys’ when either will do to implement quoting style. This generally makes the code simpler.
* Fix some minor quoting issues with grave accentPaul Eggert2015-08-091-1/+3
| | | | | | | | | | | | * src/dispnew.c (add_window_display_history) [GLYPH_DEBUG]: Remove redundant quotes. * src/doc.c (uLSQM, uRSQM): New macros. * src/doc.c (Fsubstitute_command_keys): * src/syntax.c (Finternal_describe_syntax_value): Follow the user preference for quotes rather than hardcoding the ‘grave’ style. * src/regex.c (PUSH_FAILURE_POINT, POP_FAILURE_POINT) (re_match_2_internal) [DEBUG]: In debugging output, quote C strings with "...", not `...'.
* * src/syntax.c (Fbackward_prefix_chars): Reword docstringNicolas Richard2015-06-111-1/+2
|
* Remove the deprecated INTERNAL_FIELD macro by expanding itOleh Krehel2015-04-291-1/+1
| | | | | | | | | * src/lisp.h (INTERNAL_FIELD): Remove. (DEFVAR_KBOARD): Modify accordingly. * alloc.c, buffer.c, buffer.h, category.c, keyboard.c, keyboard.h: * syntax.c: Adjust users. * src/buffer.c (compact_buffer): Use BVAR.
* Compute C decls for DEFSYMs automaticallyPaul Eggert2015-01-051-8/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes Bug#15880. This patch also makes Q constants (e.g., Qnil) constant addresses from the C point of view. * make-docfile.c: Revamp to generate table of symbols, too. Include <stdbool.h>. (xstrdup): New function. (main): Don't process the same file twice. (SYMBOL): New constant in enum global_type. (struct symbol): Turn 'value' member into a union, either v.value for int or v.svalue for string. All uses changed. (add_global): New arg svalue, which overrides value, so that globals can have a string value. (close_emacs_global): New arg num_symbols; all uses changed. Output lispsym decl. (write_globals): Output symbol globals too. Output more ATTRIBUTE_CONST, now that Qnil etc. are C constants. Output defsym_name table. (scan_c_file): Move most of guts into ... (scan_c_stream): ... new function. Scan for DEFSYMs and record symbols found. Don't read past EOF if file doesn't end in newline. * alloc.c, bidi.c, buffer.c, bytecode.c, callint.c, casefiddle: * casetab.c, category.c, ccl.c, charset.c, chartab.c, cmds.c, coding.c: * composite.c, data.c, dbusbind.c, decompress.c, dired.c, dispnew.c: * doc.c, editfns.c, emacs.c, eval.c, fileio.c, fns.c, font.c, fontset.c: * frame.c, fringe.c, ftfont.c, ftxfont.c, gfilenotify.c, gnutls.c: * image.c, inotify.c, insdel.c, keyboard.c, keymap.c, lread.c: * macfont.m, macros.c, minibuf.c, nsfns.m, nsfont.m, nsimage.m: * nsmenu.m, nsselect.m, nsterm.m, print.c, process.c, profiler.c: * search.c, sound.c, syntax.c, term.c, terminal.c, textprop.c, undo.c: * window.c, xdisp.c, xfaces.c, xfns.c, xftfont.c, xmenu.c, xml.c: * xselect.c, xsettings.c, xterm.c: Remove Q vars that represent symbols (e.g., Qnil, Qt, Qemacs). These names are now defined automatically by make-docfile. * alloc.c (init_symbol): New function. (Fmake_symbol): Use it. (c_symbol_p): New function. (valid_lisp_object_p, purecopy): Use it. * alloc.c (marked_pinned_symbols): Use make_lisp_symbol instead of make_lisp_ptr. (garbage_collect_1): Mark lispsym symbols. (CHECK_ALLOCATED_AND_LIVE_SYMBOL): New macro. (mark_object): Use it. (sweep_symbols): Sweep lispsym symbols. (symbol_uses_obj): New function. (which_symbols): Use it. Work for lispsym symbols, too. (init_alloc_once): Initialize Vpurify_flag here; no need to wait, since Qt's address is already known now. (syms_of_alloc): Add lispsym count to symbols_consed. * buffer.c (init_buffer_once): Compare to Qnil, not to make_number (0), when testing whether storage is all bits zero. * dispextern (struct image_type): * font.c (font_property_table): * frame.c (struct frame_parm_table, frame_parms): * keyboard.c (scroll_bar_parts, struct event_head): * xdisp.c (struct props): Use XSYMBOL_INIT (Qfoo) and struct Lisp_Symbol * rather than &Qfoo and Lisp_Object *, since Qfoo is no longer an object whose address can be taken. All uses changed. * eval.c (run_hook): New function. Most uses of Frun_hooks changed to use it, so that they no longer need to take the address of a Lisp sym. (syms_of_eval): Don't use DEFSYM on Vrun_hooks, as it's a variable. * frame.c (syms_of_frame): Add defsyms for the frame_parms table. * keyboard.c (syms_of_keyboard): Don't DEFSYM Qmenu_bar here. DEFSYM Qdeactivate_mark before the corresponding var. * keymap.c (syms_of_keymap): Use DEFSYM for Qmenu_bar and Qmode_line instead of interning their symbols; this avoids duplicates. (LISP_INITIALLY, TAG_PTR) (DEFINE_LISP_SYMBOL_BEGIN, DEFINE_LISP_SYMBOL_END, XSYMBOL_INIT): New macros. (LISP_INITIALLY_ZERO): Use it. (enum symbol_interned, enum symbol_redirect, struct Lisp_Symbol) (EXFUN, DEFUN_ARGS_MANY, DEFUN_ARGS_UNEVALLED, DEFUN_ARGS_*): Move decls up, to avoid forward uses. Include globals.h earlier, too. (make_lisp_symbol): New function. (XSETSYMBOL): Use it. (DEFSYM): Now just a placeholder for make-docfile. * lread.c (DEFINE_SYMBOLS): Define, for globals.h. (intern_sym): New function, with body taken from old intern_driver. (intern_driver): Use it. Last arg is now Lisp integer, not ptrdiff_t. All uses changed. (define_symbol): New function. (init_obarray): Define the C symbols taken from lispsym. Use plain DEFSYM for Qt and Qnil. * syntax.c (init_syntax_once): No need to worry about Qchar_table_extra_slots.
* Update copyright year to 2015Paul Eggert2015-01-011-1/+1
| | | | Run admin/update-copyright.
* Merge from emacs-24; up to 117687Glenn Morris2014-11-081-1/+1
|\
| * * src/syntax.c (back_comment): Fix off-by-one error.Alan Mackenzie2014-11-061-1/+1
| | | | | | | | Fixes: debbugs:18022
| * Fix bug #18339 with segfault when $ is typed into empty LaTeX buffer.Eli Zaretskii2014-08-281-4/+7
| | | | | | | | | | | | Back-ported from trunk revision-id: 2014-08-27T19:40:54Z!eliz@gnu.org src/syntax.c (scan_lists): Don't examine positions before BEGV.
* | Use SAFE_ALLOCA etc. to avoid unbounded stack allocation.Paul Eggert2014-09-071-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This follows up on the recent thread in emacs-devel on alloca; see: http://lists.gnu.org/archive/html/emacs-devel/2014-09/msg00042.html This patch also cleans up alloca-related glitches noted while examining the code looking for unbounded alloca. * alloc.c (listn): * callproc.c (init_callproc): Rewrite to avoid need for alloca. * buffer.c (mouse_face_overlay_overlaps) (report_overlay_modification): * buffer.h (GET_OVERLAYS_AT): * coding.c (make_subsidiaries): * doc.c (Fsnarf_documentation): * editfns.c (Fuser_full_name): * fileio.c (Ffile_name_directory, Fexpand_file_name) (search_embedded_absfilename, Fsubstitute_in_file_name): * fns.c (Fmake_hash_table): * font.c (font_vconcat_entity_vectors, font_update_drivers): * fontset.c (fontset_pattern_regexp, Ffontset_info): * frame.c (Fmake_terminal_frame, x_set_frame_parameters) (xrdb_get_resource, x_get_resource_string): * ftfont.c (ftfont_get_charset, ftfont_check_otf, ftfont_drive_otf): * ftxfont.c (ftxfont_draw): * image.c (xbm_load, xpm_load, jpeg_load_body): * keyboard.c (echo_add_key, menu_bar_items, tool_bar_items): * keymap.c (Fdescribe_buffer_bindings, describe_map): * lread.c (openp): * menu.c (digest_single_submenu, find_and_call_menu_selection) (find_and_return_menu_selection): * print.c (PRINTFINISH): * process.c (Fformat_network_address): * scroll.c (do_scrolling, do_direct_scrolling, scrolling_1): * search.c (search_buffer, Fmatch_data, Fregexp_quote): * sound.c (wav_play, au_play): * syntax.c (skip_chars): * term.c (tty_menu_activate, tty_menu_show): * textprop.c (get_char_property_and_overlay): * window.c (Fset_window_configuration): * xdisp.c (safe__call, next_overlay_change, vmessage) (compute_overhangs_and_x, draw_glyphs, note_mouse_highlight): * xfaces.c (face_at_buffer_position): * xmenu.c (x_menu_show): Use SAFE_ALLOCA etc. instead of plain alloca, since the allocation size isn't bounded. * callint.c (Fcall_interactively): Redo memory_full check so that it can be done at compile-time on some platforms. * coding.c (MAX_LOOKUP_MAX): New constant. (get_translation_table): Use it. * callproc.c (call_process): Use SAFE_NALLOCA instead of SAFE_ALLOCA, to catch integer overflows on size calculation. (exec_failed) [!DOS_NT]: New function. (child_setup) [!DOS_NT]: Use it. * editfns.c (Ftranspose_regions): Hoist USE_SAFE_ALLOC + SAFE_FREE out of 'if'. * editfns.c (check_translation): Allocate larger buffers on the heap. * eval.c (internal_lisp_condition_case): Check for MAX_ALLOCA overflow. * fns.c (sort_vector): Use SAFE_ALLOCA_LISP rather than Fmake_vector. (Fbase64_encode_region, Fbase64_decode_region): Avoid unnecessary calls to SAFE_FREE before 'error'. * buffer.c (mouse_face_overlay_overlaps): * editfns.c (Fget_pos_property, check_translation): * eval.c (Ffuncall): * font.c (font_unparse_xlfd, font_find_for_lface): * ftfont.c (ftfont_drive_otf): * keyboard.c (echo_add_key, read_decoded_event_from_main_queue) (menu_bar_items, tool_bar_items): * sound.c (Fplay_sound_internal): * xdisp.c (load_overlay_strings, dump_glyph_row): Use an ordinary auto buffer rather than alloca, since the allocation size is fixed and small. * ftfont.c: Include <c-strcase.h>. (matching_prefix): New function. (get_adstyle_property): Use it, to avoid need for alloca. * keyboard.c (echo_add_key): * keymap.c (describe_map): Use ptrdiff_t, not int. * keyboard.c (echo_add_key): Prefer sizeof to strlen. * keymap.c (Fdescribe_buffer_bindings): Use SBYTES, not SCHARS, when counting bytes. * lisp.h (xlispstrdupa): Remove, replacing with ... (SAFE_ALLOCA_STRING): ... new macro with different API. This fixes a portability problem, namely, alloca result passed to another function. All uses changed. (SAFE_ALLOCA, SAFE_ALLOCA_LISP): Check for MAX_ALLOCA, not MAX_ALLOCA - 1. * regex.c (REGEX_USE_SAFE_ALLOCA, REGEX_SAFE_FREE) (REGEX_ALLOCATE): New macros. (REGEX_REALLOCATE, REGEX_ALLOCATE_STACK, REGEX_REALLOCATE_STACK) (REGEX_FREE_STACK, FREE_VARIABLES, re_match_2_internal): Use them. * xdisp.c (message3): Use SAFE_ALLOCA_STRING rather than doing it by hand. (decode_mode_spec_coding): Store directly into buf rather than into an alloca temporary and copying the temporary to the buf. Fixes: debbugs:18410
* | Remove stray semicolons.Paul Eggert2014-09-041-1/+1
| |
* | Fix bug #18339 with segfault when $ is typed into empty LaTeX buffer.Eli Zaretskii2014-08-271-4/+7
| | | | | | | | src/syntax.c (scan_lists): Don't examine positions before BEGV.
* | * syntax.c (back_comment): Use more-natural location for label.Paul Eggert2014-07-091-4/+2
|/
* * src/syntax.c (find_defun_start): Try the cache evenStefan Monnier2014-07-041-13/+23
| | | | | | | | if !open_paren_in_column_0_is_defun_start. (back_comment): If find_defun_start was pessimistic, use the scan_sexps_forward result to improve the cache. Fixes: debbugs:16526
* * syntax.c (Fskip_syntax_backward): Doc clarification.Lars Ingebrigtsen2014-02-071-1/+2
| | | | Fixes: debbugs:15115
* Fix bug #16453.Bastien Guerry2014-02-051-1/+1
| | | | | * syntax.c (Fforward_word): Call Fconstrain_to_field with ESCAPE-FROM-EDGE set to `nil' (Bug#16453).
* Update copyright year to 2014 by running admin/update-copyright.Paul Eggert2014-01-011-1/+1
|
* Fix syntax.h bug introduced by recent INLINE change.Paul Eggert2013-09-211-3/+5
| | | | | | | | | | | | | | | | | syntax.h defined an extern inline function SYNTAX_ENTRY that was conditionally compiled one way in some modules, and a different way in others. This doesn't work with extern inline functions, which must have the same definition in all modules, because the defining code might be shared across modules, depending on the implementation. Symptoms reported by Martin Rudalics in: http://lists.gnu.org/archive/html/emacs-devel/2013-09/msg00414.html * regex.c, syntax.c (SYNTAX_ENTRY_VIA_PROPERTY): Remove. (SYNTAX, SYNTAX_ENTRY, SYNTAX_WITH_FLAGS): New macros, overriding the corresponding functions in syntax.h. * syntax.h (syntax_property_entry, syntax_property_with_flags) (syntax_property): New inline functions. (SYNTAX_ENTRY, SYNTAX_WITH_FLAGS, SYNTAX): Rewrite in terms of these new functions.
* A simpler, centralized INLINE.Paul Eggert2013-09-201-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lib-src/profile.c (INLINE): New macro. (SYSTIME_INLINE): Remove. * src/conf_post.h (INLINE): Define only if not already defined. This allows us to use a single INLINE, defined by one file per executable. * src/emacs.c (INLINE): Define it. Also, include category.h, charset.h, composite.h, dispextern.h, syntax.h, systime.h, so that their INLINE definitions are expanded properly for Emacs. * src/blockinput.h, src/keyboard.c (BLOCKINPUT_INLINE): * src/buffer.h, src/buffer.c (BUFFER_INLINE): * src/category.h, src/category.c (CATEGORY_INLINE): * src/character.h, src/character.c (CHARACTER_INLINE): * src/charset.h, src/charset.c (CHARSET_INLINE): * src/composite.h, src/composite.c (COMPOSITE_INLINE): * src/dispextern.h, src/dispnew.c (DISPEXTERN_INLINE): * src/frame.h, src/frame.c (FRAME_INLINE): * src/intervals.h, src/intervals.c (INTERVALS_INLINE): * src/keyboard.h, src/keyboard.c (KEYBOARD_INLINE): * src/lisp.h, src/alloc.c (LISP_INLINE): * src/process.h, src/process.c (PROCESS_INLINE): * src/syntax.h, src/syntax.c (SYNTAX_INLINE): * src/systime.h, src/sysdep.c (SYSTIME_INLINE): * src/termhooks.h, src/terminal.h (TERMHOOKS_INLINE): * src/window.h, src/window.c (WINDOW_INLINE): Remove. All uses replaced with INLINE.
* * syntax.c (init_syntax_once): Adjust comment and do an earlyDmitry Antipov2013-08-261-3/+3
| | | | | | | | | initialization of Qchar_table_extra_slots just once... * casetab.c (init_casetab_once): * category.c (init_category_once): * character.c (syms_of_character): * coding.c (syms_of_coding): * xdisp.c (syms_of_xdisp): ...and omit it here.
* Doc fix for forward-word and backward-word.Xue Fuqiao2013-08-131-0/+1
| | | | | | * doc/lispref/positions.texi (Word Motion): Remove redundant sentence. * lisp/simple.el (backward-word): Mention the optional argument. * src/syntax.c (forward_word): Mention the optional argument.
* Syntax cleanup, mostly replacing macros with functions.Paul Eggert2013-07-101-72/+200
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This removes the need for the syntax_temp hack. * search.c: Include syntax.h after buffer.h, since syntax.h uses BVAR. * syntax.c (SYNTAX_INLINE): New macro. (SYNTAX_FLAGS_COMSTART_FIRST, SYNTAX_FLAGS_COMSTART_SECOND) (SYNTAX_FLAGS_COMEND_FIRST, SYNTAX_FLAGS_COMEND_SECOND) (SYNTAX_FLAGS_PREFIX, SYNTAX_FLAGS_COMMENT_STYLEB) (SYNTAX_FLAGS_COMMENT_STYLEC, SYNTAX_FLAGS_COMMENT_STYLEC2) (SYNTAX_FLAGS_COMMENT_NESTED, SYNTAX_FLAGS_COMMENT_STYLE) (SYNTAX_COMEND_FIRST): Now functions, not macros. (ST_COMMENT_STYLE, ST_STRING_STYLE, INTERVALS_AT_ONCE): Now constants, not macros. (syntax_temp) [!__GNUC__]: Remove. (SYNTAX_PREFIX): Remove; all uses replaced by syntax_prefix_flag_p. (syntax_prefix_flag_p): Move implementation of SYNTAX_PREFIX here. (SET_RAW_SYNTAX_ENTRY, SET_RAW_SYNTAX_ENTRY_RANGE, SYNTAX_MATCH) (SETUP_SYNTAX_TABLE, SETUP_SYNTAX_TABLE_FOR_OBJECT): Move here from syntax.h; now functions, not macros. Except for the last function, these are static since only syntax.c uses them. (syntax_multibyte): Rename from SYNTAX_WITH_MULTIBYTE_CHECK. All uses changed. Now a function, not a macro; use this fact to simplify the code. (scan_lists, scan_sexps_forward): Remove workarounds for ancient compiler bugs; no longer relevant. * syntax.h: Use INLINE_HEADER_BEGIN, INLINE_HEADER_END. (SYNTAX_INLINE): New macro. (struct gl_state_s, gl_state): Move earlier, so that it's in scope for the new functions. Use bool for boolean member. (SYNTAX_ENTRY, SYNTAX, SYNTAX_WITH_FLAGS, SYNTAX_MATCH) (SYNTAX_TABLE_BYTE_TO_CHAR, UPDATE_SYNTAX_TABLE_FORWARD) (UPDATE_SYNTAX_TABLE_BACKWARD, UPDATE_SYNTAX_TABLE) (SETUP_BUFFER_SYNTAX_TABLE): Now extern inline functions, not macros. (CURRENT_SYNTAX_TABLE, SYNTAX_ENTRY_INT): Remove; all uses replaced by implementation. (syntax_temp) [!__GNUC__]: Remove decl. (SETUP_SYNTAX_TABLE_FOR_OBJECT): New decl.
* * syntax.c: Integer cleanups.Paul Eggert2013-06-201-189/+162
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (SYNTAX_FLAGS_COMMENT_STYLEC): Return a boolean, not 0-or-2. All uses that need 0-or-2 changed to: (SYNTAX_FLAGS_COMMENT_STYLEC2): New macro, with the same semantics as the old SYNTAX_FLAGS_COMMENT_STYLEC. (struct lisp_parse_state, syntax_prefix_flag_p, update_syntax_table) (char_quoted, prev_char_comend_first, back_comment) (Finternal_describe_syntax_value, skip_chars, skip_syntaxes) (in_classes, forw_comment, scan_lists, scan_sexps_forward): Use bool for boolean. (update_syntax_table, skip_chars, skip_syntaxes): Prefer int to unsigned when either will do. (back_comment): Return boolean success flag, like forw_comment, instead of positive-or-minus-1 (which might have overflowed int anyway). Don't stuff ptrdiff_t into int. (syntax_spec_code, syntax_code_spec): Now const. (Fmatching_paren, scan_lists, scan_sexps_forward): Use enum syntaxcode for syntax code. (Fmatching_paren): Check that arg is a character, not just an integer. (Fstring_to_syntax): Don't assume 0377 fits in enum syntaxcode. (Finternal_describe_syntax_value): Omit no-longer-needed comparison to 0. (skip_chars): Use char, not unsigned char, when the distinction doesn't matter. (forw_comment, scan_lists): Prefer A |= B to A = A || B when B's cheap. * bytecode.c (exec_byte_code): * syntax.c (syntax_spec_code, Fchar_syntax) (Finternal_describe_syntax_value, skip_chars, skip_syntaxes) (init_syntax_once): * syntax.h (SYNTAX_WITH_FLAGS): Omit unnecessary casts.
* * syntax.c (skip_chars): Don't use uninitialized storagePaul Eggert2013-06-181-24/+21
| | | | | when searching a multibyte buffer for characters that are not in a unibyte string that contains non-ASCII characters.
* * syntax.c (scan_sexps_forward): Fix byte position calculationDmitry Antipov2013-02-101-0/+1
| | | | Bug#13664 (a.k.a Bug#13667) introduced with 2013-02-08 change.
* * search.c (scan_buffer): Calculate end byte position just once.Dmitry Antipov2013-02-081-2/+5
| | | | | | | | | (scan_newline): Do not recalculate start_byte. (search_command): Use eassert. * syntax.c (struct lisp_parse_state): New member location_byte. (scan_sexps_forward): Record from_byte and avoid redundant character to byte position calculation ... (Fparse_partial_sexp): ... here. Break too long line.
* * lisp.h (make_uninit_vector): New function.Dmitry Antipov2013-02-081-2/+2
| | | | | | | | | | | | | | | | | | * alloc.c (Fvector, Fmake_byte_code): * ccl.c (Fregister_ccl_program): * charset.c (Fdefine_charset_internal, define_charset_internal): * coding.c (make_subsidiaries, Fdefine_coding_system_internal): * composite.c (syms_of_composite): * font.c (Fquery_font, Ffont_info, syms_of_font): * fontset.c (FONT_DEF_NEW, Fset_fontset_font): * ftfont.c (ftfont_shape_by_flt): * indent.c (recompute_width_table): * nsselect.m (clean_local_selection_data): * syntax.c (init_syntax_once): * w32unsubscribe.c (uniscribe_shape): * window.c (Fcurrent_window_configuration): * xfaces.c (Fx_family_fonts): * xselect.c (selection_data_to_lisp_data): Use it.
* Update copyright notices for 2013.Paul Eggert2013-01-011-2/+2
|
* Prefer plain 'static' to 'static inline'.Paul Eggert2012-09-301-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With static functions, modern compilers inline pretty well by themselves; advice from programmers often hurts as much as it helps. On my host (x86-64, Fedora 17, GCC 4.7.2, default 'configure'), this change shrinks the text size of the Emacs executable by 1.1% without affecting CPU significantly in my benchmark. * alloc.c (mem_find, live_string_p, live_cons_p, live_symbol_p) (live_float_p, live_misc_p, live_vector_p, live_buffer_p) (mark_maybe_object, mark_maybe_pointer, bounded_number): * buffer.c (bset_abbrev_mode, bset_abbrev_table) (bset_auto_fill_function, bset_auto_save_file_format) (bset_auto_save_file_name, bset_backed_up, bset_begv_marker) (bset_bidi_display_reordering, bset_buffer_file_coding_system) (bset_cache_long_line_scans, bset_case_fold_search) (bset_ctl_arrow, bset_cursor_in_non_selected_windows) (bset_cursor_type, bset_display_table, bset_extra_line_spacing) (bset_file_format, bset_file_truename, bset_fringe_cursor_alist) (bset_fringe_indicator_alist, bset_fringes_outside_margins) (bset_header_line_format, bset_indicate_buffer_boundaries) (bset_indicate_empty_lines, bset_invisibility_spec) (bset_left_fringe_width, bset_major_mode, bset_mark) (bset_minor_modes, bset_mode_line_format, bset_mode_name) (bset_name, bset_overwrite_mode, bset_pt_marker) (bset_right_fringe_width, bset_save_length) (bset_scroll_bar_width, bset_scroll_down_aggressively) (bset_scroll_up_aggressively, bset_selective_display) (bset_selective_display_ellipses, bset_vertical_scroll_bar_type) (bset_word_wrap, bset_zv_marker, set_buffer_overlays_before) (set_buffer_overlays_after): * category.c (bset_category_table): * charset.c (read_hex): * coding.c (produce_composition, produce_charset) (handle_composition_annotation, handle_charset_annotation) (char_encodable_p): * dispnew.c (swap_glyph_pointers, copy_row_except_pointers) (assign_row, set_frame_matrix_frame, make_current) (add_row_entry): * eval.c (set_specpdl_symbol, set_specpdl_old_value): * fns.c (maybe_resize_hash_table): * frame.c (fset_buffer_predicate, fset_minibuffer_window): * gmalloc.c (register_heapinfo): * image.c (lookup_image_type): * intervals.c (set_interval_object, set_interval_left) (set_interval_right, copy_interval_parent, rotate_right) (rotate_left, balance_possible_root_interval): * keyboard.c (kset_echo_string, kset_kbd_queue) (kset_keyboard_translate_table, kset_last_prefix_arg) (kset_last_repeatable_command, kset_local_function_key_map) (kset_overriding_terminal_local_map, kset_real_last_command) (kset_system_key_syms, clear_event, set_prop): * lread.c (digit_to_number): * marker.c (attach_marker, live_buffer, set_marker_internal): * nsterm.m (ns_compute_glyph_string_overhangs): * process.c (pset_buffer, pset_command) (pset_decode_coding_system, pset_decoding_buf) (pset_encode_coding_system, pset_encoding_buf, pset_filter) (pset_log, pset_mark, pset_name, pset_plist, pset_sentinel) (pset_status, pset_tty_name, pset_type, pset_write_queue): * syntax.c (bset_syntax_table, dec_bytepos): * terminal.c (tset_param_alist): * textprop.c (interval_has_some_properties) (interval_has_some_properties_list): * window.c (wset_combination_limit, wset_dedicated) (wset_display_table, wset_hchild, wset_left_fringe_width) (wset_left_margin_cols, wset_new_normal, wset_new_total) (wset_normal_cols, wset_normal_lines, wset_parent, wset_pointm) (wset_right_fringe_width, wset_right_margin_cols) (wset_scroll_bar_width, wset_start, wset_temslot, wset_vchild) (wset_vertical_scroll_bar_type, wset_window_parameters): * xdisp.c (wset_base_line_number, wset_base_line_pos) (wset_column_number_displayed, wset_region_showing) (window_box_edges, run_window_scroll_functions) (append_glyph_string_lists, prepend_glyph_string_lists) (append_glyph_string, set_glyph_string_background_width) (append_glyph, append_composite_glyph) (take_vertical_position_into_account): * xfaces.c (x_create_gc, x_free_gc, merge_face_vectors) (face_attr_equal_p, lface_equal_p, hash_string_case_insensitive) (lface_hash, lface_same_font_attributes_p, lookup_face): * xml.c (libxml2_loaded_p): * xterm.c (x_set_mode_line_face_gc, x_set_glyph_string_gc) (x_set_glyph_string_clipping, x_clear_glyph_string_rect): Now 'static', not 'static inline'. Fixes: debbugs:12541
* Port better to POSIX hosts lacking _setjmp.Paul Eggert2012-09-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | * configure.ac (HAVE__SETJMP, HAVE_SIGSETJMP): New symbols. (_setjmp, _longjmp): Remove. * src/lisp.h: Include <setjmp.h> here, since we use its symbols here. All instances of '#include <setjmp.h>' removed, if the only reason for the instance was because "lisp.h" was included. (sys_jmp_buf, sys_setjmp, sys_longjmp): New symbols. Unless otherwise specified, replace all uses of jmp_buf, _setjmp, and _longjmp with the new symbols. Emacs already uses _setjmp if available, so this change affects only POSIXish hosts that have sigsetjmp but not _setjmp, such as some versions of Solaris and Unixware. (Also, POSIX-2008 marks _setjmp as obsolescent.) * src/image.c (_setjmp, _longjmp) [HAVE_PNG && !HAVE__SETJMP]: New macros. (png_load_body) [HAVE_PNG]: (PNG_LONGJMP) [HAVE_PNG && PNG_LIBPNG_VER < 10500]: (PNG_JMPBUF) [HAVE_PNG && PNG_LIBPNG_VER >= 10500]: Use _setjmp and _longjmp rather than sys_setjmp and sys_longjmp, since PNG requires jmp_buf. This is the only exception to the general rule that we now use sys_setjmp and sys_longjmp. This exception is OK since this code does not change the signal mask or longjmp out of a signal handler. Fixes: debbugs:12446
* Introduce "raw syntax descriptor" terminology, and use it.Chong Yidong2012-09-081-5/+5
| | | | | | | | | | | | * syntax.texi (Syntax Table Internals): Define "raw syntax descriptor" terminology. (Syntax Descriptors): Mention raw syntax descriptors. * lisp/subr.el (syntax-after, syntax-class): Doc fix. * syntax.c (Fstring_to_syntax): Doc fix. Fixes: debbugs:12383
* * buffer.h (BSET): Remove.Paul Eggert2012-08-171-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace all uses with calls to new setter functions. (bset_bidi_paragraph_direction, bset_case_canon_table) (bset_case_eqv_table, bset_directory, bset_display_count) (bset_display_time, bset_downcase_table) (bset_enable_multibyte_characters, bset_filename, bset_keymap) (bset_last_selected_window, bset_local_var_alist) (bset_mark_active, bset_point_before_scroll, bset_read_only) (bset_truncate_lines, bset_undo_list, bset_upcase_table) (bset_width_table): * buffer.c (bset_abbrev_mode, bset_abbrev_table) (bset_auto_fill_function, bset_auto_save_file_format) (bset_auto_save_file_name, bset_backed_up, bset_begv_marker) (bset_bidi_display_reordering, bset_buffer_file_coding_system) (bset_cache_long_line_scans, bset_case_fold_search) (bset_ctl_arrow, bset_cursor_in_non_selected_windows) (bset_cursor_type, bset_display_table, bset_extra_line_spacing) (bset_file_format, bset_file_truename, bset_fringe_cursor_alist) (bset_fringe_indicator_alist, bset_fringes_outside_margins) (bset_header_line_format, bset_indicate_buffer_boundaries) (bset_indicate_empty_lines, bset_invisibility_spec) (bset_left_fringe_width, bset_major_mode, bset_mark) (bset_minor_modes, bset_mode_line_format, bset_mode_name) (bset_name, bset_overwrite_mode, bset_pt_marker) (bset_right_fringe_width, bset_save_length) (bset_scroll_bar_width, bset_scroll_down_aggressively) (bset_scroll_up_aggressively, bset_selective_display) (bset_selective_display_ellipses, bset_vertical_scroll_bar_type) (bset_word_wrap, bset_zv_marker): * category.c (bset_category_table): * syntax.c (bset_syntax_table): New setter functions. Fixes: debbugs:12215
* * lisp.h (CSET): Remove.Paul Eggert2012-08-171-1/+1
| | | | | | | | | | | | (set_char_table_ascii, set_char_table_defalt, set_char_table_parent) (set_char_table_purpose): New functions, replacing CSET. All uses changed. For example, replace "CSET (XCHAR_TABLE (char_table), parent, parent);" with "char_table_set_parent (char_table, parent);". The old version was confusing because it used the same name 'parent' for two different things. Fixes: debbugs:12215
* Use ASCII tests for character types.Paul Eggert2012-08-161-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * admin/merge-gnulib (GNULIB_MODULES): Add c-ctype. * lwlib/lwlib-Xaw.c, lwlib/lwlib.c, lwlib/xlwmenu.c: Don't include <ctype.h>; no longer needed. * lwlib/lwlib-Xaw.c (openFont): * lwlib/xlwmenu.c (openXftFont): Test just for ASCII digits. * src/category.c, src/dispnew.c, src/doprnt.c, src/editfns.c, src/syntax.c * src/term.c, src/xfns.c, src/xterm.c: Don't include <ctype.h>; was not needed. * src/charset.c, src/doc.c, src/fileio.c, src/font.c, src/frame.c: * src/gtkutil.c, src/image.c, src/sysdep.c, src/xfaces.c: Include <c-ctype.h> instead of <ctype.h>. * src/nsterm.m: Include <c-ctype.h>. * src/charset.c (read_hex): * src/doc.c (Fsnarf_documentation): * src/fileio.c (IS_DRIVE) [WINDOWSNT]: (DRIVE_LETTER) [DOS_NT]: (Ffile_name_directory, Fexpand_file_name) (Fsubstitute_in_file_name): * src/font.c (font_parse_xlfd, font_parse_fcname): * src/frame.c (x_set_font_backend): * src/gtkutil.c (xg_get_font): * src/image.c (xbm_scan, xpm_scan, pbm_scan_number): * src/nsimage.m (hexchar): * src/nsterm.m (ns_xlfd_to_fontname): * src/sysdep.c (system_process_attributes): * src/xfaces.c (hash_string_case_insensitive): Use C-locale tests instead of locale-specific tests for character types, since we want the ASCII interpretation here, not the interpretation suitable for whatever happens to be the current locale.
* Simple interface to set Lisp_Object fields of chararcter tables.Dmitry Antipov2012-08-161-1/+1
| | | | | | | | * lisp.h (CSET): New macro. (char_table_set_extras, char_table_set_contents) (sub_char_table_set_contents): New function. * casetab.c, category.c, chartab.c, fns.c, fontset.c, search.c: * syntax.c: Adjust users.
* Use BSET for write access to Lisp_Object members of struct buffer.Dmitry Antipov2012-08-131-1/+1
| | | | | | | | * buffer.h (BSET): New macro. * buffer.c, casetab.c, cmds.c, coding.c, data.c, editfns.c: * fileio.c, frame.c, indent.c, insdel.c, intervals.c, keymap.c: * minibuf.c, print.c, process.c, syntax.c, undo.c, w32fns.c: * window.c, xdisp.c, xfns.c: Adjust users.
* Cleanup intervals.Dmitry Antipov2012-08-081-6/+6
| | | | | | | | | * intervals.h (NULL_INTERVAL, DEFAULT_INTERVAL): Remove. (NULL_INTERVAL_P): Likewise. Adjust users. (FRONT_STICKY_P, END_NONSTICKY_P, FRONT_NONSTICKY_P): Adjust comment. Move under #if 0. * alloc.c, buffer.c, editfns.c, fns.c, insdel.c, intervals.c: * print.c, syntax.c, textprop.c, xdisp.c: Adjust users.
* Doc fixes and improvements for syntax tables.Chong Yidong2012-08-041-1/+1
| | | | | | | | | | | | | | | * src/syntax.c (Fmodify_syntax_entry): Doc fix. * doc/lispref/syntax.texi (Syntax Basics): Rearrange the text for clarity. Fix description of syntax table inheritance. (Syntax Table Functions): Don't refer to internal contents of syntax table, since that is not explained yet. Copyedits. (Standard Syntax Tables): Node deleted. (Syntax Table Internals): Misc clarifications. Improve table formatting. * doc/lispref/keymaps.texi (Inheritance and Keymaps): * doc/lispref/text.texi (Sticky Properties): Tweak index entry.
* * lisp.h (SWITCH_ENUM_CAST): Remove. All uses removed.Paul Eggert2012-07-301-4/+4
| | | | | This no-op macro hasn't been needed for many years. * src/regex.c (SWITCH_ENUM_CAST) [!emacs]: Likewise.
* Fix failure to compile on Windows due to ↵Eli Zaretskii2012-07-271-1/+1
| | | | | | | | | 2012-07-27T06:04:35Z!dmantipov@yandex.ru. src/lisp.h (enum constype): Use CONSTYPE_HEAP and CONSTYPE_PURE for enumeration constants, as PURE and HEAP are too general, and clash with other headers and sources, such as gmalloc.c and the MS-Windows system headers. All users changed.
* Utility function to make a list from specified amount of objects.Dmitry Antipov2012-07-271-1/+1
| | | | | | | | | | | | | | | | | | * lisp.h (enum constype): New datatype. (listn): New prototype. * alloc.c (listn): New function. (Fmemory_use_count, syms_of_alloc): Use it. * buffer.c (syms_of_buffer): Likewise. * callint.c (syms_of_callint): Likewise. * charset.c (define_charset_internal): Likewise. * coding.c (syms_of_coding): Likewise. * keymap.c (syms_of_keymap): Likewise. * search.c (syms_of_search): Likewise. * syntax.c (syms_of_syntax): Likewise. * w32.c (init_environment): Likewise. * w32fns.c (Fw32_battery_status, syms_of_w32fns): Likewise. * xdisp.c (syms_of_xdisp): Likewise. * xfns.c (syms_of_xfns): Likewise.
* Optimize pure C strings initialization.Dmitry Antipov2012-07-101-1/+1
| | | | | | | | | | | | | * lisp.h (make_pure_string): Fix prototype. (build_pure_c_string): New function, defined as static inline. This provides a better opportunity to optimize away calls to strlen when the function is called with compile-time constant argument. * alloc.c (make_pure_c_string): Fix comment. Change to add nchars argument, adjust users accordingly. Use build_pure_c_string where appropriate. * buffer.c, coding.c, data.c, dbusbind.c, fileio.c, fontset.c, frame.c, * keyboard.c, keymap.c, lread.c, search.c, syntax.c, w32fns.c, xdisp.c, * xfaces.c, xfns.c, xterm.c: Use build_pure_c_string where appropriate.
* More xmalloc and related cleanup.Paul Eggert2012-07-051-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | * alloc.c, bidi.c, buffer.c, buffer.h, bytecode.c, callint.c: * callproc.c, charset.c, coding.c, composite.c, data.c, dispnew.c: * doc.c, editfns.c, emacs.c, eval.c, fileio.c, filelock.c, fns.c: * font.c, fontset.c, frame.c, fringe.c, ftfont.c, ftxfont.c, gmalloc.c: * gtkutil.c, image.c, keyboard.c, keymap.c, lread.c, macros.c, menu.c: * nsfns.m, nsfont.m, nsmenu.m, nsterm.m, print.c, process.c, ralloc.c: * regex.c, region-cache.c, scroll.c, search.c, sound.c, syntax.c: * sysdep.c, term.c, termcap.c, unexmacosx.c, window.c, xdisp.c: * xfaces.c, xfns.c, xftfont.c, xgselect.c, xmenu.c, xrdb.c, xselect.c: * xterm.c: Omit needless casts involving void * pointers and allocation. Prefer "P = xmalloc (sizeof *P)" to "P = xmalloc (sizeof (TYPE_OF_P))", as the former is more robust if P's type is changed. Prefer xzalloc to xmalloc + memset 0. Simplify malloc-or-realloc to realloc. Don't worry about xmalloc returning a null pointer. Prefer xstrdup to xmalloc + strcpy. * editfns.c (Fmessage_box): Grow message_text by at least 80 when growing it. * keyboard.c (apply_modifiers_uncached): Prefer local array to alloca of a constant.
* Auto-generate EXFUN using make-docfileTom Tromey2012-07-031-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | src * window.c (Fset_window_margins, Fset_window_fringes) (Fset_window_scroll_bars, Fset_window_vscroll): No longer static. * textprop.c (Fprevious_property_change): No longer static. * syntax.c (Fsyntax_table_p): No longer static. * process.c (Fget_process, Fprocess_datagram_address): No longer static. * keymap.c (Flookup_key, Fcopy_keymap): No longer static. * keyboard.c (Fcommand_execute): No longer static. Remove EXFUN. * insdel.c (Fcombine_after_change_execute): No longer static. * image.c (Finit_image_library): No longer static. * fileio.c (Fmake_symbolic_link): No longer static. * eval.c (Ffetch_bytecode): No longer static. * editfns.c (Fuser_full_name): No longer static. * doc.c: (Fdocumentation_property, Fsnarf_documentation): No longer static. * buffer.c (Fset_buffer_major_mode, Fdelete_overlay): No longer static. * dired.c (Ffile_attributes): No longer static. * composite.c (Fcomposition_get_gstring): No longer static. * callproc.c (Fgetenv_internal): No longer static. * ccl.h: Remove EXFUNs. * buffer.h: Remove EXFUNs. * dispextern.h: Remove EXFUNs. * intervals.h: Remove EXFUNs. * fontset.h: Remove EXFUN. * font.h: Remove EXFUNs. * dosfns.c (system_process_attributes): Remove EXFUN. * keymap.h: Remove EXFUNs. * lisp.h: Remove EXFUNs. * w32term.h: Remove EXFUNs. * window.h: Remove EXFUNs. * xsettings.h: Remove EXFUN. * xterm.h: Remove EXFUN. lib-src * make-docfile.c (enum global_type) <FUNCTION>: New constant. (struct global) <value>: New field. (add_global): Add 'value' argument. (compare_globals): Sort functions at the end. (close_emacs_globals): New function. (write_globals): Handle functions. (scan_c_file): Call add_global for DEFUN.
* * alloc.c, bytecode.c, ccl.c, coding.c, composite.c, data.c, dosfns.c:Dmitry Antipov2012-06-191-10/+9
| | | | | | | * font.c, image.c, keyboard.c, lread.c, menu.c, minibuf.c, msdos.c: * print.c, syntax.c, window.c, xmenu.c, xselect.c: Replace direct access to `contents' member of Lisp_Vector objects with AREF and ASET where appropriate.
* * buffer.h (FETCH_MULTIBYTE_CHAR): Define as inline.Andreas Schwab2012-06-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (BUF_FETCH_MULTIBYTE_CHAR): Likewise. * character.c (_fetch_multibyte_char_p): Remove. * alloc.c: Include "character.h" before "buffer.h". * bidi.c: Likewise. * buffer.c: Likewise. * bytecode.c: Likewise. * callint.c: Likewise. * callproc.c: Likewise. * casefiddle.c: Likewise. * casetab.c: Likewise. * category.c: Likewise. * cmds.c: Likewise. * coding.c: Likewise. * composite.c: Likewise. * dired.c: Likewise. * dispnew.c: Likewise. * doc.c: Likewise. * dosfns.c: Likewise. * editfns.c: Likewise. * emacs.c: Likewise. * fileio.c: Likewise. * filelock.c: Likewise. * font.c: Likewise. * fontset.c: Likewise. * fringe.c: Likewise. * indent.c: Likewise. * insdel.c: Likewise. * intervals.c: Likewise. * keyboard.c: Likewise. * keymap.c: Likewise. * lread.c: Likewise. * macros.c: Likewise. * marker.c: Likewise. * minibuf.c: Likewise. * nsfns.m: Likewise. * nsmenu.m: Likewise. * print.c: Likewise. * process.c: Likewise. * regex.c: Likewise. * region-cache.c: Likewise. * search.c: Likewise. * syntax.c: Likewise. * term.c: Likewise. * textprop.c: Likewise. * undo.c: Likewise. * unexsol.c: Likewise. * w16select.c: Likewise. * w32fns.c: Likewise. * w32menu.c: Likewise. * window.c: Likewise. * xdisp.c: Likewise. * xfns.c: Likewise. * xmenu.c: Likewise. * xml.c: Likewise. * xselect.c: Likewise.