Filename expansion issue using GNU Global
<[email protected]> Tue, 26 Apr 2016 13:46:03 +0000 (UTC)
| Newsgroups | gmane.emacs.semantic |
|---|---|
| Message-ID | <[email protected]> |
--===============8822239012543980479== Content-Type: multipart/alternative; boundary="----=_Part_2491301_708729293.1461678363424" Content-Length: 4903 ------=_Part_2491301_708729293.1461678363424 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi, cedet-global.el has a function called 'cedet-gnu-global-expand-filename' wh= ich uses the '-P' flag to GNU Global tool to locate header files. The '-P' = flag only looks for a partial match, and not an exact match. This results i= n situations when, say looking up "b.h" can cause 'global' to list both 'a_= b.h' & 'b.h' in the following directory structure: test/=C2=A0 + b.ch/=C2=A0 + b.h=C2=A0 + a_b.h test/b.c:#include "b.h" /* Jumping to this file can cause CEDET to open 'a_= b.h' */#include "a_b.h" I put in the following fix using a better reg-ex for filename matching, and= it seems to work for my test cases. If you would like to roll this fix int= o CEDET, I do not have any objection.=C2=A0 (defun cedet-gnu-global-expand-filename (filename)=C2=A0 "Expand the FILENA= ME with GNU Global.Return a fully qualified filename."=C2=A0 (interactive "= sFile: ")=C2=A0 ;; FIXED the following line=C2=A0 ;;(let ((ans (with-curren= t-buffer (cedet-gnu-global-call (list "-Pa" filename))=C2=A0 (let ((ans (wi= th-current-buffer (cedet-gnu-global-call =C2=A0 (list "-Pa" (concat "(.*/|= ^)" filename))) Thanks,Balaji ------=_Part_2491301_708729293.1461678363424 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <html><head></head><body><div style=3D"color:#000; background-color:#fff; f= ont-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, = sans-serif;font-size:16px"><div id=3D"yui_3_16_0_ym19_1_1461677662656_5744"= >Hi,</div><div id=3D"yui_3_16_0_ym19_1_1461677662656_5744"><br></div><div i= d=3D"yui_3_16_0_ym19_1_1461677662656_5744" dir=3D"ltr">cedet-global.el has = a function called 'cedet-gnu-global-expand-filename' which uses the '-P' fl= ag to GNU Global tool to locate header files. The '-P' flag only looks for = a partial match, and not an exact match. This results in situations when, s= ay looking up "b.h" can cause 'global' to list both 'a_b.h' & 'b.h' in = the following directory structure:</div><div id=3D"yui_3_16_0_ym19_1_146167= 7662656_5744"><br></div><div id=3D"yui_3_16_0_ym19_1_1461677662656_5744" di= r=3D"ltr">test/</div><div id=3D"yui_3_16_0_ym19_1_1461677662656_5744" dir= =3D"ltr"> + b.c</div><div id=3D"yui_3_16_0_ym19_1_1461677662656_5744"= dir=3D"ltr">h/</div><div id=3D"yui_3_16_0_ym19_1_1461677662656_5744" dir= =3D"ltr"> + b.h</div><div id=3D"yui_3_16_0_ym19_1_1461677662656_5744"= dir=3D"ltr"> + a_b.h</div><div id=3D"yui_3_16_0_ym19_1_1461677662656= _5744" dir=3D"ltr"><br></div><div id=3D"yui_3_16_0_ym19_1_1461677662656_574= 4" dir=3D"ltr">test/b.c:</div><div id=3D"yui_3_16_0_ym19_1_1461677662656_57= 44" dir=3D"ltr">#include "b.h" /* Jumping to this file can cause CEDET to o= pen 'a_b.h' */</div><div id=3D"yui_3_16_0_ym19_1_1461677662656_5744" dir=3D= "ltr">#include "a_b.h"<br></div><div id=3D"yui_3_16_0_ym19_1_1461677662656_= 5744" dir=3D"ltr"><br></div><div id=3D"yui_3_16_0_ym19_1_1461677662656_5744= " dir=3D"ltr">I put in the following fix using a better reg-ex for filename= matching, and it seems to work for my test cases. If you would like to rol= l this fix into CEDET, I do not have any objection. </div><div id=3D"y= ui_3_16_0_ym19_1_1461677662656_5744" dir=3D"ltr"><br></div><div dir=3D"ltr"= id=3D"yui_3_16_0_ym19_1_1461677662656_6008">(defun cedet-gnu-global-expand= -filename (filename)</div><div dir=3D"ltr" id=3D"yui_3_16_0_ym19_1_14616776= 62656_6009"> "Expand the FILENAME with GNU Global.</div><div dir=3D"l= tr" id=3D"yui_3_16_0_ym19_1_1461677662656_6010">Return a fully qualified fi= lename."</div><div dir=3D"ltr" id=3D"yui_3_16_0_ym19_1_1461677662656_6011">= (interactive "sFile: ")</div><div dir=3D"ltr" id=3D"yui_3_16_0_ym19_= 1_1461677662656_6011"> ;; FIXED the following line</div><div dir=3D"l= tr" id=3D"yui_3_16_0_ym19_1_1461677662656_6012"> ;;(let ((ans (with-c= urrent-buffer (cedet-gnu-global-call (list "-Pa" filename))</div><div dir= =3D"ltr" id=3D"yui_3_16_0_ym19_1_1461677662656_6013"> (let ((ans (wit= h-current-buffer (cedet-gnu-global-call</div><div dir=3D"ltr" id=3D"yui_3_1= 6_0_ym19_1_1461677662656_6014"><span style=3D"white-space:pre-wrap;" id=3D"= yui_3_16_0_ym19_1_1461677662656_6015">=09=09=09=09</span> (list "-Pa= " (concat "(.*/|^)" filename)))</div><div dir=3D"ltr" id=3D"yui_3_16_0_ym19= _1_1461677662656_6016"><br id=3D"yui_3_16_0_ym19_1_1461677662656_6017"></di= v><div id=3D"yui_3_16_0_ym19_1_1461677662656_5744" dir=3D"ltr">Thanks,</div= ><div id=3D"yui_3_16_0_ym19_1_1461677662656_5744" dir=3D"ltr">Balaji</div><= div id=3D"yui_3_16_0_ym19_1_1461677662656_5744" dir=3D"ltr"><br></div><div = id=3D"yui_3_16_0_ym19_1_1461677662656_5744" dir=3D"ltr"><br></div></div></b= ody></html> ------=_Part_2491301_708729293.1461678363424-- --===============8822239012543980479== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------------ Find and fix application performance issues faster with Applications Manager Applications Manager provides deep performance insights into multiple tiers of your business applications. It resolves application problems quickly and reduces your MTTR. Get your free trial! https://ad.doubleclick.net/ddm/clk/302982198;130105516;z --===============8822239012543980479== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ cedet-semantic mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/cedet-semantic --===============8822239012543980479==--