From d49d03abdbb1bdb892a322ed6d9e25648edc3b56 Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Thu, 5 Feb 2015 22:50:52 -0200 Subject: [PATCH] hi --- src/buffer.c | 18 ++++++++++++++++++ src/buffer.h | 9 +++++++++ src/casetab.c | 7 +++++++ src/editfns.c | 6 ++++-- src/search.c | 27 +++++++++++++++++---------- 5 files changed, 55 insertions(+), 12 deletions(-) diff --git a/src/buffer.c b/src/buffer.c index 67eda3e..7160850 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -182,6 +182,11 @@ bset_case_fold_search (struct buffer *b, Lisp_Object val) b->INTERNAL_FIELD (case_fold_search) = val; } static void +bset_group_fold_search (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (group_fold_search) = val; +} +static void bset_ctl_arrow (struct buffer *b, Lisp_Object val) { b->INTERNAL_FIELD (ctl_arrow) = val; @@ -975,6 +980,7 @@ reset_buffer_local_variables (struct buffer *b, bool permanent_too) bset_upcase_table (b, XCHAR_TABLE (Vascii_downcase_table)->extras[0]); bset_case_canon_table (b, XCHAR_TABLE (Vascii_downcase_table)->extras[1]); bset_case_eqv_table (b, XCHAR_TABLE (Vascii_downcase_table)->extras[2]); + bset_group_canon_table (b, XCHAR_TABLE (Vascii_downcase_table)->extras[1]); bset_invisibility_spec (b, Qt); /* Reset all (or most) per-buffer variables to their defaults. */ @@ -5053,6 +5059,7 @@ init_buffer_once (void) bset_upcase_table (&buffer_local_flags, make_number (0)); bset_case_canon_table (&buffer_local_flags, make_number (0)); bset_case_eqv_table (&buffer_local_flags, make_number (0)); + bset_group_canon_table (&buffer_local_flags, make_number (0)); bset_minor_modes (&buffer_local_flags, make_number (0)); bset_width_table (&buffer_local_flags, make_number (0)); bset_pt_marker (&buffer_local_flags, make_number (0)); @@ -5065,6 +5072,7 @@ init_buffer_once (void) XSETFASTINT (BVAR (&buffer_local_flags, abbrev_mode), idx); ++idx; XSETFASTINT (BVAR (&buffer_local_flags, overwrite_mode), idx); ++idx; XSETFASTINT (BVAR (&buffer_local_flags, case_fold_search), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, group_fold_search), idx); ++idx; XSETFASTINT (BVAR (&buffer_local_flags, auto_fill_function), idx); ++idx; XSETFASTINT (BVAR (&buffer_local_flags, selective_display), idx); ++idx; XSETFASTINT (BVAR (&buffer_local_flags, selective_display_ellipses), idx); ++idx; @@ -5143,6 +5151,7 @@ init_buffer_once (void) bset_abbrev_mode (&buffer_defaults, Qnil); bset_overwrite_mode (&buffer_defaults, Qnil); bset_case_fold_search (&buffer_defaults, Qt); + bset_group_fold_search (&buffer_defaults, Qnil); bset_auto_fill_function (&buffer_defaults, Qnil); bset_selective_display (&buffer_defaults, Qnil); bset_selective_display_ellipses (&buffer_defaults, Qt); @@ -5486,6 +5495,11 @@ This is the same as (default-value 'tab-width). */); doc: /* Default value of `case-fold-search' for buffers that don't override it. This is the same as (default-value 'case-fold-search). */); + DEFVAR_BUFFER_DEFAULTS ("default-group-fold-search", + group_fold_search, + doc: /* Default value of `group-fold-search' for buffers that don't override it. +This is the same as (default-value 'group-fold-search). */); + DEFVAR_BUFFER_DEFAULTS ("default-left-margin-width", left_margin_cols, doc: /* Default value of `left-margin-width' for buffers that don't override it. @@ -5657,6 +5671,10 @@ Use the command `abbrev-mode' to change this variable. */); Qnil, doc: /* Non-nil if searches and matches should ignore case. */); + DEFVAR_PER_BUFFER ("group-fold-search", &BVAR (current_buffer, group_fold_search), + Qnil, + doc: /* Non-nil if searches and matches should ignore case. */); + DEFVAR_PER_BUFFER ("fill-column", &BVAR (current_buffer, fill_column), Qintegerp, doc: /* Column beyond which automatic line-wrapping should happen. diff --git a/src/buffer.h b/src/buffer.h index 81852ca..ff56a81 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -558,6 +558,7 @@ struct buffer /* tab-width is buffer-local so that redisplay can find it in buffers that are not current. */ Lisp_Object INTERNAL_FIELD (case_fold_search); + Lisp_Object INTERNAL_FIELD (group_fold_search); Lisp_Object INTERNAL_FIELD (tab_width); Lisp_Object INTERNAL_FIELD (fill_column); Lisp_Object INTERNAL_FIELD (left_margin); @@ -578,6 +579,9 @@ struct buffer /* Char-table of equivalences for case-folding search. */ Lisp_Object INTERNAL_FIELD (case_eqv_table); + /* Char-table for conversion for group-folding search. */ + Lisp_Object INTERNAL_FIELD (group_canon_table); + /* Non-nil means do not display continuation lines. */ Lisp_Object INTERNAL_FIELD (truncate_lines); @@ -899,6 +903,11 @@ bset_case_eqv_table (struct buffer *b, Lisp_Object val) b->INTERNAL_FIELD (case_eqv_table) = val; } INLINE void +bset_group_canon_table (struct buffer *b, Lisp_Object val) +{ + b->INTERNAL_FIELD (group_canon_table) = val; +} +INLINE void bset_directory (struct buffer *b, Lisp_Object val) { b->INTERNAL_FIELD (directory) = val; diff --git a/src/casetab.c b/src/casetab.c index b086abc..81a6476 100644 --- a/src/casetab.c +++ b/src/casetab.c @@ -63,6 +63,13 @@ check_case_table (Lisp_Object obj) return (obj); } +DEFUN ("current-group-table", Fcurrent_group_table, Scurrent_group_table, 0, 0, 0, + doc: /* Return the group table of the current buffer. */) + (void) +{ + return BVAR (current_buffer, group_canon_table); +} + DEFUN ("current-case-table", Fcurrent_case_table, Scurrent_case_table, 0, 0, 0, doc: /* Return the case table of the current buffer. */) (void) diff --git a/src/editfns.c b/src/editfns.c index 7026ccc..9fe6bc6 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -2805,8 +2805,10 @@ determines whether case is significant or ignored. */) register EMACS_INT begp1, endp1, begp2, endp2, temp; register struct buffer *bp1, *bp2; register Lisp_Object trt - = (!NILP (BVAR (current_buffer, case_fold_search)) - ? BVAR (current_buffer, case_canon_table) : Qnil); + = (!NILP (BVAR (current_buffer, group_fold_search)) + ? BVAR (current_buffer, group_canon_table) : + (!NILP (BVAR (current_buffer, case_fold_search)) + ? BVAR (current_buffer, case_canon_table) : Qnil)); ptrdiff_t chars = 0; ptrdiff_t i1, i2, i1_byte, i2_byte; diff --git a/src/search.c b/src/search.c index e961798..037f409 100644 --- a/src/search.c +++ b/src/search.c @@ -281,8 +281,10 @@ looking_at_1 (Lisp_Object string, bool posix) bufp = compile_pattern (string, (NILP (Vinhibit_changing_match_data) ? &search_regs : NULL), - (!NILP (BVAR (current_buffer, case_fold_search)) - ? BVAR (current_buffer, case_canon_table) : Qnil), + (!NILP (BVAR (current_buffer, group_fold_search)) + ? BVAR (current_buffer, group_canon_table) : + (!NILP (BVAR (current_buffer, case_fold_search)) + ? BVAR (current_buffer, case_canon_table) : Qnil)), posix, !NILP (BVAR (current_buffer, enable_multibyte_characters))); @@ -396,8 +398,10 @@ string_match_1 (Lisp_Object regexp, Lisp_Object string, Lisp_Object start, bufp = compile_pattern (regexp, (NILP (Vinhibit_changing_match_data) ? &search_regs : NULL), - (!NILP (BVAR (current_buffer, case_fold_search)) - ? BVAR (current_buffer, case_canon_table) : Qnil), + (!NILP (BVAR (current_buffer, group_fold_search)) + ? BVAR (current_buffer, group_canon_table) : + (!NILP (BVAR (current_buffer, case_fold_search)) + ? BVAR (current_buffer, case_canon_table) : Qnil)), posix, STRING_MULTIBYTE (string)); immediate_quit = 1; @@ -1052,12 +1056,15 @@ search_command (Lisp_Object string, Lisp_Object bound, Lisp_Object noerror, BVAR (current_buffer, case_eqv_table)); np = search_buffer (string, PT, PT_BYTE, lim, lim_byte, n, RE, - (!NILP (BVAR (current_buffer, case_fold_search)) - ? BVAR (current_buffer, case_canon_table) - : Qnil), - (!NILP (BVAR (current_buffer, case_fold_search)) - ? BVAR (current_buffer, case_eqv_table) - : Qnil), + (!NILP (BVAR (current_buffer, group_fold_search)) + ? BVAR (current_buffer, group_canon_table) : + (!NILP (BVAR (current_buffer, case_fold_search)) + ? BVAR (current_buffer, case_canon_table) : Qnil)), + (!NILP (BVAR (current_buffer, group_fold_search)) + ? Qnil : + (!NILP (BVAR (current_buffer, case_fold_search)) + ? BVAR (current_buffer, case_eqv_table) + : Qnil)), posix); if (np <= 0) { -- 2.2.2