Skip to content

Commit

Permalink
Fix tagging of DEFUN by etags
Browse files Browse the repository at this point in the history
* lib-src/etags.c (C_entries): Tag DEFUN twice: once with its C
name, and then again with its Lisp name.  This restores the
ability to find Lisp primitives by their C name, which was lost
when the etags back-end was switched to a more strict search
criteria.

* test/etags/ETAGS.good_1:
* test/etags/ETAGS.good_2:
* test/etags/ETAGS.good_3:
* test/etags/ETAGS.good_4:
* test/etags/ETAGS.good_5:
* test/etags/ETAGS.good_6:
* test/etags/CTAGS.good: Adapt to the changes in etags.c wrt
tagging DEFUN.
  • Loading branch information
Eli-Zaretskii committed Sep 21, 2016
1 parent ea1960b commit 73c67dd
Show file tree
Hide file tree
Showing 8 changed files with 349 additions and 20 deletions.
18 changes: 16 additions & 2 deletions lib-src/etags.c
Expand Up @@ -3436,13 +3436,27 @@ C_entries (int c_ext, FILE *inf)
int off = tokoff;
int len = toklen;

/* Rewrite the tag so that emacs lisp DEFUNs
can be found by their elisp name */
if (defun)
{
off += 1;
len -= 1;

/* First, tag it as its C name */
linebuffer_setlen (&token_name, toklen);
memcpy (token_name.buffer,
newlb.buffer + tokoff, toklen);
token_name.buffer[toklen] = '\0';
token.named = true;
token.lineno = lineno;
token.offset = tokoff;
token.length = toklen;
token.line = newlb.buffer;
token.linepos = newlinepos;
token.valid = true;
make_C_tag (funorvar);
}
/* Rewrite the tag so that emacs lisp DEFUNs
can be found also by their elisp name */
linebuffer_setlen (&token_name, len);
memcpy (token_name.buffer,
newlb.buffer + off, len);
Expand Down
45 changes: 45 additions & 0 deletions test/etags/CTAGS.good
Expand Up @@ -602,22 +602,67 @@ FUNCTION_KEY_OFFSET c-src/emacs/src/keyboard.c 4766
FUNCTION_KEY_OFFSET c-src/emacs/src/keyboard.c 5061
F_getit c-src/etags.c /^F_getit (FILE *inf)$/
F_takeprec c-src/etags.c /^F_takeprec (void)$/
Fabbrev_expansion c-src/abbrev.c /^DEFUN ("abbrev-expansion", Fabbrev_expansion, Sabb/
Fabbrev_symbol c-src/abbrev.c /^DEFUN ("abbrev-symbol", Fabbrev_symbol, Sabbrev_sy/
Fabort_recursive_edit c-src/emacs/src/keyboard.c /^DEFUN ("abort-recursive-edit", Fabort_recursive_ed/
Fails_t c-src/h.h 5
Fclear_abbrev_table c-src/abbrev.c /^DEFUN ("clear-abbrev-table", Fclear_abbrev_table, /
Fclear_this_command_keys c-src/emacs/src/keyboard.c /^DEFUN ("clear-this-command-keys", Fclear_this_comm/
Fcommand_error_default_function c-src/emacs/src/keyboard.c /^DEFUN ("command-error-default-function", Fcommand_/
Fcurrent_idle_time c-src/emacs/src/keyboard.c /^DEFUN ("current-idle-time", Fcurrent_idle_time, Sc/
Fcurrent_input_mode c-src/emacs/src/keyboard.c /^DEFUN ("current-input-mode", Fcurrent_input_mode, /
Fdefine_abbrev c-src/abbrev.c /^DEFUN ("define-abbrev", Fdefine_abbrev, Sdefine_ab/
Fdefine_abbrev_table c-src/abbrev.c /^DEFUN ("define-abbrev-table", Fdefine_abbrev_table/
Fdefine_global_abbrev c-src/abbrev.c /^DEFUN ("define-global-abbrev", Fdefine_global_abbr/
Fdefine_mode_abbrev c-src/abbrev.c /^DEFUN ("define-mode-abbrev", Fdefine_mode_abbrev, /
Fdiscard_input c-src/emacs/src/keyboard.c /^DEFUN ("discard-input", Fdiscard_input, Sdiscard_i/
Fevent_convert_list c-src/emacs/src/keyboard.c /^DEFUN ("event-convert-list", Fevent_convert_list, /
Fevent_symbol_parse_modifiers c-src/emacs/src/keyboard.c /^DEFUN ("internal-event-symbol-parse-modifiers", Fe/
Fexit_recursive_edit c-src/emacs/src/keyboard.c /^DEFUN ("exit-recursive-edit", Fexit_recursive_edit/
Fexpand_abbrev c-src/abbrev.c /^DEFUN ("expand-abbrev", Fexpand_abbrev, Sexpand_ab/
Finalize_Cond/p ada-src/2ataspri.adb /^ procedure Finalize_Cond (Cond : in out Conditio/
Finalize_Cond/p ada-src/2ataspri.ads /^ procedure Finalize_Cond (Cond : in out Conditio/
Finalize_Lock/p ada-src/2ataspri.adb /^ procedure Finalize_Lock (L : in out Lock) is$/
Finalize_Lock/p ada-src/2ataspri.ads /^ procedure Finalize_Lock (L : in out Lock);$/
Finalize_TAS_Cell/p ada-src/2ataspri.adb /^ procedure Finalize_TAS_Cell (Cell : in out TAS_/
Finalize_TAS_Cell/p ada-src/2ataspri.ads /^ procedure Finalize_TAS_Cell (Cell : in out TA/
Finput_pending_p c-src/emacs/src/keyboard.c /^DEFUN ("input-pending-p", Finput_pending_p, Sinput/
Finsert_abbrev_table_description c-src/abbrev.c /^DEFUN ("insert-abbrev-table-description", Finsert_/
First100Chars pas-src/common.pas /^procedure First100Chars; (*($/
Fmake_abbrev_table c-src/abbrev.c /^DEFUN ("make-abbrev-table", Fmake_abbrev_table, Sm/
Foo perl-src/kai-test.pl /^package Foo;$/
Foo::Bar perl-src/kai-test.pl /^package Foo::Bar;$/
Fopen_dribble_file c-src/emacs/src/keyboard.c /^DEFUN ("open-dribble-file", Fopen_dribble_file, So/
Forth_help c-src/etags.c 573
Forth_suffixes c-src/etags.c 571
Forth_words c-src/etags.c /^Forth_words (FILE *inf)$/
Fortran_functions c-src/etags.c /^Fortran_functions (FILE *inf)$/
Fortran_help c-src/etags.c 579
Fortran_suffixes c-src/etags.c 577
Fposn_at_point c-src/emacs/src/keyboard.c /^DEFUN ("posn-at-point", Fposn_at_point, Sposn_at_p/
Fposn_at_x_y c-src/emacs/src/keyboard.c /^DEFUN ("posn-at-x-y", Fposn_at_x_y, Sposn_at_x_y, /
Fread_key_sequence c-src/emacs/src/keyboard.c /^DEFUN ("read-key-sequence", Fread_key_sequence, Sr/
Fread_key_sequence_vector c-src/emacs/src/keyboard.c /^DEFUN ("read-key-sequence-vector", Fread_key_seque/
Frecent_keys c-src/emacs/src/keyboard.c /^DEFUN ("recent-keys", Frecent_keys, Srecent_keys, /
Frecursion_depth c-src/emacs/src/keyboard.c /^DEFUN ("recursion-depth", Frecursion_depth, Srecur/
Frecursive_edit c-src/emacs/src/keyboard.c /^DEFUN ("recursive-edit", Frecursive_edit, Srecursi/
Freset_this_command_lengths c-src/emacs/src/keyboard.c /^DEFUN ("reset-this-command-lengths", Freset_this_c/
Fset_input_interrupt_mode c-src/emacs/src/keyboard.c /^DEFUN ("set-input-interrupt-mode", Fset_input_inte/
Fset_input_meta_mode c-src/emacs/src/keyboard.c /^DEFUN ("set-input-meta-mode", Fset_input_meta_mode/
Fset_input_mode c-src/emacs/src/keyboard.c /^DEFUN ("set-input-mode", Fset_input_mode, Sset_inp/
Fset_output_flow_control c-src/emacs/src/keyboard.c /^DEFUN ("set-output-flow-control", Fset_output_flow/
Fset_quit_char c-src/emacs/src/keyboard.c /^DEFUN ("set-quit-char", Fset_quit_char, Sset_quit_/
Fsuspend_emacs c-src/emacs/src/keyboard.c /^DEFUN ("suspend-emacs", Fsuspend_emacs, Ssuspend_e/
Fthis_command_keys c-src/emacs/src/keyboard.c /^DEFUN ("this-command-keys", Fthis_command_keys, St/
Fthis_command_keys_vector c-src/emacs/src/keyboard.c /^DEFUN ("this-command-keys-vector", Fthis_command_k/
Fthis_single_command_keys c-src/emacs/src/keyboard.c /^DEFUN ("this-single-command-keys", Fthis_single_co/
Fthis_single_command_raw_keys c-src/emacs/src/keyboard.c /^DEFUN ("this-single-command-raw-keys", Fthis_singl/
Ftop_level c-src/emacs/src/keyboard.c /^DEFUN ("top-level", Ftop_level, Stop_level, 0, 0, /
Ftrack_mouse c-src/emacs/src/keyboard.c /^DEFUN ("internal--track-mouse", Ftrack_mouse, Stra/
Funexpand_abbrev c-src/abbrev.c /^DEFUN ("unexpand-abbrev", Funexpand_abbrev, Sunexp/
Fx_get_selection_internal c.c /^DEFUN ("x-get-selection-internal", Fx_get_selectio/
Fx_get_selection_internal c.c /^ Fx_get_selection_internal, Sx_get_selection/
Fy_get_selection_internal c.c /^ Fy_get_selection_internal, Sy_get_selection_/
GCALIGNED c-src/emacs/src/lisp.h 288
GCALIGNED c-src/emacs/src/lisp.h 290
GCALIGNMENT c-src/emacs/src/lisp.h 243
Expand Down
51 changes: 48 additions & 3 deletions test/etags/ETAGS.good_1
Expand Up @@ -175,7 +175,7 @@ package body Truc.Bidule Truc.Bidule/b138,2153
protected body Bidule Bidule/b139,2181
protected body Machin_T Machin_T/b146,2281

c-src/abbrev.c,1432
c-src/abbrev.c,2072
Lisp_Object Vabbrev_table_name_list;43,1424
Lisp_Object Vglobal_abbrev_table;48,1569
Lisp_Object Vfundamental_mode_abbrev_table;52,1680
Expand All @@ -188,18 +188,29 @@ Lisp_Object Vlast_abbrev_text;75,2319
int last_abbrev_point;79,2409
Lisp_Object Vpre_abbrev_expand_hook,83,2482
Lisp_Object Vpre_abbrev_expand_hook, Qpre_abbrev_expand_hook;83,2482
DEFUN ("make-abbrev-table", Fmake_abbrev_table,85,2546
DEFUN ("make-abbrev-table", Fmake_abbrev_table,make-abbrev-table85,2546
DEFUN ("clear-abbrev-table", Fclear_abbrev_table,92,2738
DEFUN ("clear-abbrev-table", Fclear_abbrev_table,clear-abbrev-table92,2738
DEFUN ("define-abbrev", Fdefine_abbrev,107,3119
DEFUN ("define-abbrev", Fdefine_abbrev,define-abbrev107,3119
DEFUN ("define-global-abbrev", Fdefine_global_abbrev,149,4438
DEFUN ("define-global-abbrev", Fdefine_global_abbrev,define-global-abbrev149,4438
DEFUN ("define-mode-abbrev", Fdefine_mode_abbrev,160,4809
DEFUN ("define-mode-abbrev", Fdefine_mode_abbrev,define-mode-abbrev160,4809
DEFUN ("abbrev-symbol", Fabbrev_symbol,174,5277
DEFUN ("abbrev-symbol", Fabbrev_symbol,abbrev-symbol174,5277
DEFUN ("abbrev-expansion", Fabbrev_expansion,202,6241
DEFUN ("abbrev-expansion", Fabbrev_expansion,abbrev-expansion202,6241
DEFUN ("expand-abbrev", Fexpand_abbrev,218,6756
DEFUN ("expand-abbrev", Fexpand_abbrev,expand-abbrev218,6756
DEFUN ("unexpand-abbrev", Funexpand_abbrev,389,11677
DEFUN ("unexpand-abbrev", Funexpand_abbrev,unexpand-abbrev389,11677
write_abbrev 426,12884
describe_abbrev 445,13319
DEFUN ("insert-abbrev-table-description", Finsert_abbrev_table_description,466,13834
DEFUN ("insert-abbrev-table-description", Finsert_abbrev_table_description,insert-abbrev-table-description466,13834
DEFUN ("define-abbrev-table", Fdefine_abbrev_table,506,14990
DEFUN ("define-abbrev-table", Fdefine_abbrev_table,define-abbrev-table506,14990
syms_of_abbrev 540,16067

Expand Down Expand Up @@ -828,7 +839,7 @@ typedef enum { RECC_ERROR 609,22953
} re_wctype_t;618,23260
typedef int re_wchar_t;623,23387

c-src/emacs/src/keyboard.c,13565
c-src/emacs/src/keyboard.c,15539
volatile int interrupt_input_blocked;76,1808
volatile bool pending_signals;80,1944
#define KBD_BUFFER_SIZE 82,1976
Expand Down Expand Up @@ -904,6 +915,7 @@ add_command_key 672,21582
recursive_edit_1 697,22406
record_auto_save 742,23848
force_auto_save_soon 751,24016
DEFUN ("recursive-edit", Frecursive_edit,759,24137
DEFUN ("recursive-edit", Frecursive_edit,recursive-edit759,24137
recursive_edit_unwind 804,25747
any_kboard_state 817,26013
Expand All @@ -918,16 +930,21 @@ record_single_kboard_state 943,29437
restore_kboard_configuration 952,29621
cmd_error 970,30077
cmd_error_internal 1024,31510
DEFUN ("command-error-default-function", Fcommand_error_default_function,1043,32030
DEFUN ("command-error-default-function", Fcommand_error_default_function,command-error-default-function1043,32030
command_loop 1094,33916
command_loop_2 1134,35135
top_level_2 1146,35339
top_level_1 1152,35417
DEFUN ("top-level", Ftop_level,1164,35787
DEFUN ("top-level", Ftop_level,top-level1164,35787
user_error 1183,36288
DEFUN ("exit-recursive-edit", Fexit_recursive_edit,1189,36429
DEFUN ("exit-recursive-edit", Fexit_recursive_edit,exit-recursive-edit1189,36429
DEFUN ("abort-recursive-edit", Fabort_recursive_edit,1201,36819
DEFUN ("abort-recursive-edit", Fabort_recursive_edit,abort-recursive-edit1201,36819
tracking_off 1216,37281
DEFUN ("internal--track-mouse", Ftrack_mouse,1234,37816
DEFUN ("internal--track-mouse", Ftrack_mouse,track-mouse1234,37816
bool ignore_mouse_drag_p;1256,38392
some_mouse_moved 1259,38441
Expand Down Expand Up @@ -991,6 +1008,7 @@ Lisp_Object pending_funcalls;4377,131172
decode_timer 4381,131293
timer_check_2 4414,132246
timer_check 4572,136817
DEFUN ("current-idle-time", Fcurrent_idle_time,4607,137662
DEFUN ("current-idle-time", Fcurrent_idle_time,current-idle-time4607,137662
static Lisp_Object accent_key_syms;4625,138239
static Lisp_Object func_key_syms;4626,138275
Expand Down Expand Up @@ -1037,10 +1055,12 @@ static Lisp_Object modifier_symbols;6327,189449
lispy_modifier_list 6331,189586
#define KEY_TO_CHAR(6353,190252
parse_modifiers 6356,190328
DEFUN ("internal-event-symbol-parse-modifiers", Fevent_symbol_parse_modifiers,6399,191517
DEFUN ("internal-event-symbol-parse-modifiers", Fevent_symbol_parse_modifiers,event-symbol-parse-modifiers6399,191517
apply_modifiers 6422,192391
reorder_modifiers 6491,194720
modify_event_symbol 6536,196528
DEFUN ("event-convert-list", Fevent_convert_list,6628,199244
DEFUN ("event-convert-list", Fevent_convert_list,event-convert-list6628,199244
parse_solitary_modifier 6695,201135
#define SINGLE_LETTER_MOD(6701,201258
Expand Down Expand Up @@ -1101,24 +1121,38 @@ keyremap_step 8811,261450
test_undefined 8867,262934
read_key_sequence 8916,264861
read_key_sequence_vs 9826,295821
DEFUN ("read-key-sequence", Fread_key_sequence,9885,297294
DEFUN ("read-key-sequence", Fread_key_sequence,read-key-sequence9885,297294
DEFUN ("read-key-sequence-vector", Fread_key_sequence_vector,9938,299982
DEFUN ("read-key-sequence-vector", Fread_key_sequence_vector,read-key-sequence-vector9938,299982
detect_input_pending 9950,300488
detect_input_pending_ignore_squeezables 9959,300654
detect_input_pending_run_timers 9967,300870
clear_input_pending 9985,301362
requeued_events_pending_p 9997,301732
DEFUN ("input-pending-p", Finput_pending_p,10002,301813
DEFUN ("input-pending-p", Finput_pending_p,input-pending-p10002,301813
DEFUN ("recent-keys", Frecent_keys,10024,302596
DEFUN ("recent-keys", Frecent_keys,recent-keys10024,302596
DEFUN ("this-command-keys", Fthis_command_keys,10055,303517
DEFUN ("this-command-keys", Fthis_command_keys,this-command-keys10055,303517
DEFUN ("this-command-keys-vector", Fthis_command_keys_vector,10068,303958
DEFUN ("this-command-keys-vector", Fthis_command_keys_vector,this-command-keys-vector10068,303958
DEFUN ("this-single-command-keys", Fthis_single_command_keys,10080,304380
DEFUN ("this-single-command-keys", Fthis_single_command_keys,this-single-command-keys10080,304380
DEFUN ("this-single-command-raw-keys", Fthis_single_command_raw_keys,10096,304955
DEFUN ("this-single-command-raw-keys", Fthis_single_command_raw_keys,this-single-command-raw-keys10096,304955
DEFUN ("reset-this-command-lengths", Freset_this_command_lengths,10109,305495
DEFUN ("reset-this-command-lengths", Freset_this_command_lengths,reset-this-command-lengths10109,305495
DEFUN ("clear-this-command-keys", Fclear_this_command_keys,10136,306510
DEFUN ("clear-this-command-keys", Fclear_this_command_keys,clear-this-command-keys10136,306510
DEFUN ("recursion-depth", Frecursion_depth,10158,307069
DEFUN ("recursion-depth", Frecursion_depth,recursion-depth10158,307069
DEFUN ("open-dribble-file", Fopen_dribble_file,10169,307406
DEFUN ("open-dribble-file", Fopen_dribble_file,open-dribble-file10169,307406
DEFUN ("discard-input", Fdiscard_input,10203,308447
DEFUN ("discard-input", Fdiscard_input,discard-input10203,308447
DEFUN ("suspend-emacs", Fsuspend_emacs,10225,308949
DEFUN ("suspend-emacs", Fsuspend_emacs,suspend-emacs10225,308949
stuff_buffered_input 10285,311045
set_waiting_for_input 10323,312016
Expand All @@ -1128,13 +1162,21 @@ deliver_interrupt_signal 10378,313642
static int volatile force_quit_count;10387,313932
handle_interrupt 10401,314414
quit_throw_to_read_char 10541,318711
DEFUN ("set-input-interrupt-mode", Fset_input_interrupt_mode,10562,319288
DEFUN ("set-input-interrupt-mode", Fset_input_interrupt_mode,set-input-interrupt-mode10562,319288
DEFUN ("set-output-flow-control", Fset_output_flow_control,10609,320516
DEFUN ("set-output-flow-control", Fset_output_flow_control,set-output-flow-control10609,320516
DEFUN ("set-input-meta-mode", Fset_input_meta_mode,10643,321432
DEFUN ("set-input-meta-mode", Fset_input_meta_mode,set-input-meta-mode10643,321432
DEFUN ("set-quit-char", Fset_quit_char,10694,322706
DEFUN ("set-quit-char", Fset_quit_char,set-quit-char10694,322706
DEFUN ("set-input-mode", Fset_input_mode,10729,323570
DEFUN ("set-input-mode", Fset_input_mode,set-input-mode10729,323570
DEFUN ("current-input-mode", Fcurrent_input_mode,10750,324459
DEFUN ("current-input-mode", Fcurrent_input_mode,current-input-mode10750,324459
DEFUN ("posn-at-x-y", Fposn_at_x_y,10787,325837
DEFUN ("posn-at-x-y", Fposn_at_x_y,posn-at-x-y10787,325837
DEFUN ("posn-at-point", Fposn_at_point,10824,327060
DEFUN ("posn-at-point", Fposn_at_point,posn-at-point10824,327060
init_kboard 10861,328214
allocate_kboard 10893,329284
Expand Down Expand Up @@ -3832,7 +3874,7 @@ void bar(5,69
int foobar(6,94
interface_locate(9,131

c.c,1663
c.c,1807
my_printf 135,
void fatala 138,
max 141,
Expand Down Expand Up @@ -3862,8 +3904,11 @@ short array[array190,
int f193,
DEAFUN 196,
XDEFUN 203,
DEFUN ("x-get-selection-internal", Fx_get_selection_internal,206,
DEFUN ("x-get-selection-internal", Fx_get_selection_internal,x-get-selection-internal206,
Fx_get_selection_internal,212,
Fx_get_selection_internal,x-get-selection-internal212,
Fy_get_selection_internal,216,
Fy_get_selection_internal,y-get-selection-internal216,
defun_func1(218,
DEFUN_func2(220,
Expand Down

0 comments on commit 73c67dd

Please sign in to comment.