Comments (14)
Thanks for the report. This certainly looks like a problem. @bertogg: this was your patch; can you please take a look? I'll try to get to it within the next week or two otherwise.
from xcscope.el.
Can you provide the complete source file?
Also, what command do you use to find that string? M-x cscope-find-this-text-string
?
from xcscope.el.
Here's the source file (renamed file extension as .txt) and I use cscope-find-egrep-pattern SYMBOL
where SYMBOL="kkk"
from xcscope.el.
This is what I get with your example after searching kkk
with M-x cscope-find-egrep-pattern
:
*** wt_data.cpp:
<unknown>[282] // kkk
<unknown>[283] #define ConvertFpN(...) // kkk
Reverting the commit that you mention does not seem to make any difference here.
This seems like the correct behavior to me. I guess your problem is in cscope itself, I'm using version 15.9-1, from Debian.
from xcscope.el.
@bertogg: thanks for looking at it. I just looked on my end, and I see the same thing: it works ok with and without the patch with the latest cscope in Debian. I also see that I completely forgot to update the Debian package after your patch. Sorry about that. I'll push a new version when the freeze is done.
@kiani45: we need more information to reproduce your problem. If you can run more experiments, that'd be nice.
from xcscope.el.
Oh, it would actually be nice to have this fixed for bullseye, but I guess it's a bit late for that? Thanks anyway
from xcscope.el.
from xcscope.el.
It's kind of weird.
I guess my cscope should be fine:
But I still has same problem with xcscope.el even when switch to cscope as backend (I used global-cscope before):
My emacs version is 26.3
Is there any further information you need?
from xcscope.el.
I have simplify the reproduce environment:
simple .emacs:
(package-initialize)
(require 'xcscope)
My xscope.el (from Elpa):
.emacs.d/elpa/xcscope-20201025.2002/xcscope.el
(I have tried replacing with the latest xcsope.el but still have same issue)
I have attached my cscope.out & wt_data.cc
out.gz
from xcscope.el.
Hi. Thanks for providing that tarball. First, let's make sure that cscope itself is doing what it should. I'd be surprised if it isn't, but let's check just in case. I'm seeing this:
dima@shorty:/tmp/xxx$ cscope -f cscope.out -L -6 kkk
wt_data.cc <unknown> 282 // kkk" before void WtRaw::Convert()
wt_data.cc <unknown> 283 #define ConvertFpN(...) 0 // kkk
dima@shorty:/tmp/xxx$ cscope -f cscope.out -L -6 kkk | md5sum
908026e542c573bd7cf463a440d6d056 -
This is with the two files in your archive. Can you confirm that this is what you get, including the md5 sum? If so, I'm going to have another question for you, but let me look at the code first
from xcscope.el.
OK, never mind. I see the problem. And I think I just fixed it.
@kiani45: can you please try the commit I just pushed? It should fix the problem. And thanks for reporting the bug.
@bertogg: you changed the regex parsing the cscope output to be able to accept whitespace in filenames. This is ambiguously-defined, however, so in @kiani45's case, the filename is extracted incorrectly: whitespace in non-filename text is interpreted as being a part of the filename. I just reverted the regex change in your patch to fix THIS bug (since I bet this actually breaks many usages). But that revert crippled your feature. Can you think of a more reliable way to parse out the filenames? I'd love to merge something that solves your problem without adverse effects. A bit of elisp that demonstrates the issue:
(let ((lines '("wt_data.cc <unknown> 282 // kkk\" before void WtRaw::Convert()\n"
"wt_data.cc <unknown> 283 #define ConvertFpN(...) 0 // kkk\n")))
(mapcar (lambda (line)
(and (string-match
"^\\([^\t]+\\)[ \t]+\\([^ \t]+\\)[ \t]+\\([0-9]+\\)[ \t]+\\(.*\\)\n"
line)
(substring line (match-beginning 1) (match-end 1))))
lines))
This applies the regex (including your modification) to the lines of data @kiani45 was producing. It returns the filename, as extracted by the regex. If you evaluate that form, you'll see that it's extracting the filename correctly for the first cscope result, but not so for the second result. Thanks!
The reason my earlier testing didn't suggest that anything was wrong is that I was running the old code by accident in both cases.
from xcscope.el.
The reason the input here caused an issue is because of the extra numerical token in the input: the "0". We can adjust the regex to match the filename minimally, which would fix the problem for this input, but then you won't be able to have filenames "AAA BBB NUMBER CCC". I'm thinking that's the best we can do here. Thoughts?
from xcscope.el.
@dkogan
Just tried the latest one and it has fixed the issue.
Thanks a lot!
from xcscope.el.
The reason the input here caused an issue is because of the extra numerical token in the input: the "0". We can adjust the regex to match the filename minimally, which would fix the problem for this input, but then you won't be able to have filenames "AAA BBB NUMBER CCC". I'm thinking that's the best we can do here. Thoughts?
What would happen if the filename contains numbers but not spaces? If that works then I'm fine with the solution.
I think filenames with numbers are way more common than filenames with spaces, so in doubt I would support the former.
from xcscope.el.
Related Issues (20)
- xcscope.el and user-reserved keybindings collision HOT 3
- "display-buffer" fallbacks to "display-buffer-fallback-action" HOT 1
- cscope-index-files doesn't work with paths using whitespaces HOT 5
- MacOS: xcscope.el can't be run within emacs 22.1.1 HOT 2
- "Cscope" does not show in the menu bar of Emacs 26.1 or Emacs 25.3.1 HOT 3
- How to change the default bindings of xcscope HOT 2
- multiple "cscope: cannot find file ..." in *cscope* buffer HOT 1
- "<file> is not readable or exists" when using xcscope over TRAMP HOT 6
- Completion for input tag HOT 3
- Tramp support HOT 2
- Support for inline functions HOT 1
- How to change the behavior of quitting cscope display buffer HOT 5
- xcscope don't work with sub-directories HOT 7
- Add multiple databases to search list. HOT 2
- xcscope have problem on emacs-w32, on windows, compiled by MinGW. HOT 6
- Getting nonsense results HOT 11
- GNU Global support requires version 5.9 HOT 4
- does xcscope support symbolic link file ? HOT 1
- search bug in *cscope* buffer with multiple cscope databases HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xcscope.el.