Dale Sedivec | 4 Aug 2012 21:42

[PATCH] Fix Python parsing for triple-quoted strings

Greetings,

	Below is a patch to correct Semantic's parsing of Python's 
triple-quoted strings, such as '''foo''' and """foo""".  I write Python 
for my day job and I've been using this patch for over a year with 
success.

	I actually tried to submit this last year, but I needed to get my 
copyright assignment filed with the FSF.  I've now got that filed.

	These changes were originally necessary because python.el in Emacs <= 
23 used font-lock-syntactic-keywords to parse triple-quoted strings, 
which Semantic switches off during parsing.  I figured Emacs 24 and 
syntax-propertize-function would have made these changes unnecessary, 
since Semantic _presumably_ lets syntax-propertize-function run. 
However, if I just run my cedet-utests.el changes in Emacs 24 with CEDET 
HEAD, I still get a test failure, so I guess these changes are still 
necessary.

	Patch below against what is probably CEDET HEAD (taken from 
https://github.com/emacsmirror/cedet).

Thanks,
Dale

commit c9e7a2c7ca9f3a24efb7dc5d22806ac0e8e9933f
Date:   Fri Mar 18 16:12:00 2011 -0500

     wisent-python-forward-line and -string work despite hairy strings.

(Continue reading)

Eric M. Ludlam | 7 Aug 2012 04:13
Picon
Gravatar

Re: [PATCH] Fix Python parsing for triple-quoted strings

Hi Dale, thanks for patch for python support.

I'm not a python user, so I don't have comments on the patch.

Have you signed papers to assign copyright of changes you make to Emacs 
to the FSF?

   In order for me to include your patch in CEDET proper, you will need 
to assign copyright.  I've attached the form you fill out, and mail to 
fsf-records <at> gnu.org when you are done.

   I can generally accept small patches without an assignment, but your 
patch is significant enough to need an assignment.

Thanks!
Eric

On 08/04/2012 03:42 PM, Dale Sedivec wrote:
> Greetings,
>
> 	Below is a patch to correct Semantic's parsing of Python's
> triple-quoted strings, such as '''foo''' and """foo""".  I write Python
> for my day job and I've been using this patch for over a year with
> success.
>
> 	I actually tried to submit this last year, but I needed to get my
> copyright assignment filed with the FSF.  I've now got that filed.
>
> 	These changes were originally necessary because python.el in Emacs<=
> 23 used font-lock-syntactic-keywords to parse triple-quoted strings,
(Continue reading)

Diez Roggisch | 14 Aug 2012 11:39
Picon
Gravatar

Re: ede-simple-project - how to? and some other questions

Hi,




EDE is setup for automatic detection and generic projects can get in the way so you need to enable them explicitly.  You probably don't need all the simple ones provided.  You would put:

(require 'exe-generic)

Into your .emacs and follow that with a command similar to those at the end of ede-generic.el, but with your build config file and build/debug commands.

I don't have access to my dev machine this week so I can't draft examples at the moment.  Sorry.


I had a look and it seemed to me as if the generic project pretty much relies on a single File that exists, e.g. A Makefile. We don't have such a thing, instead our project layout is like this:


Root/
   A/
   B/
   C/


Where all these are directories, and the A/B/C also are essentially build-targets.

Can I make this work with ede-generic?

Regards,

Diez




Hi,


The ede-simple project type was deprecated.  It shouldn't be in any of the distributions anymore either.  Perhaps there are other references around we still need to get rid of?  The replacement would be the generic project type.  The examples are at the end of the ede generic.el file.  It will let you persist some changes to build and debug commands..

If your large codebase has others who will be sharing your work you will be better off building your own project type.   That allows you every configuration option.  If the generic project type doesnt work an example like the emacs or linux project type would be the place to start.

First of all a disclaimer: I'm a Emacs/Lisp-noob.

The generic project type looks like a good starting point. However, when I go e.g. Into ielm, I find that with the exception of ede-generic-load none of the definitions of ede-generic.el is found. I use CEDE1.1 release version, and after re-reading the INSTALL file again installed it like this in my .emacs:

(custom-set-variables ….)
(global-font-lock-mode t)
;; CEDET
(load-file "/Users/dir/.emacs.d/lib/cedet-1.1/common/cedet.el")
(global-ede-mode 1)


Any suggestions? Should I switch to the latest VCS version?

Also, again a question regarding building: as mentioned, my goal is to build for various targets/architectures. I guess this means that I update the project's build-command when the parametrization changes, and that's persisted somehow?

Thanks for you support,

Diez


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
cedet-semantic mailing list
cedet-semantic <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cedet-semantic
Andrei Stebakov | 23 Aug 2012 16:47
Picon

Problems with folding mode

Hi

I am using Emacs GNU Emacs 23.1.50.1 (i386-mingw-nt6.1.7600) of 2009-11-03 on LENNART-69DE564 (patched) with the latest cedet 1.0.1

I have problems with the folding mode using C/C++ language. I can only fold the most upper level blocks at function definition level but I can't fold/unfold inner nested {} blocks like for(){} if(){} etc. 
I wonder if it's the intended behavior or something goes wrong in my environment.

I got following settings in my .emacs file:

(load-file "D:/GNU/cl-systems/cedet-1.0.1/common/cedet.el")
(global-ede-mode nil)
(semantic-load-enable-excessive-code-helpers)
(global-semantic-tag-folding-mode 1)
(require 'semantic-ia)          ; names completion and display of tags
(require 'semantic-gcc)         ; auto locate system include files
(require 'semanticdb)
(global-semanticdb-minor-mode 1)


;; if you want to enable support for gnu global
(require 'semanticdb-global)
(semanticdb-enable-gnu-global-databases 'c-mode)
(semanticdb-enable-gnu-global-databases 'c++-mode)

Thank you,
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
cedet-semantic mailing list
cedet-semantic <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cedet-semantic
Eric M. Ludlam | 29 Aug 2012 02:51
Picon
Gravatar

Re: ede-simple-project - how to? and some other questions

On 08/14/2012 05:39 AM, Diez Roggisch wrote:
> I had a look and it seemed to me as if the generic project pretty much
> relies on a single File that exists, e.g. A Makefile. We don't have such
> a thing, instead our project layout is like this:
>
>
> Root/
>     A/
>     B/
>     C/
>
>
> Where all these are directories, and the A/B/C also are essentially
> build-targets.
>
> Can I make this work with ede-generic?

Hi Diez,

   Sorry for the late reply.

   I suspect that you just need to use ede-cpp-root project type.  It is 
described in the manual.  In that case you would just add something to 
your .emacs file that says exactly where your projects are.

   If you still need to have an autodetect scheme, think about your 
project.  Does it always have a home grown build file, like 
MyBuildFile.py or something?  If so, you can create your own generic 
project type.  In ede/generic.el look at the end for how scons or cmake 
is defined.  Copy one of those, and you'll be ready to go.   Each 
definition is perhaps 12 lines of code, most of it is just declarative 
stuff.

   Generic projects can run into problems if not every directory has a 
build file.  In that case, you probably need the cpp-root project, and 
perhaps some home-grown setup.

Eric

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
Eric M. Ludlam | 30 Aug 2012 03:06
Picon
Gravatar

Re: [PATCH] Fix Python parsing for triple-quoted strings

On 08/04/2012 03:42 PM, Dale Sedivec wrote:
> Greetings,
>
> 	Below is a patch to correct Semantic's parsing of Python's
> triple-quoted strings, such as '''foo''' and """foo""".  I write Python
> for my day job and I've been using this patch for over a year with
> success.

Hi Dale,

Sorry for the slow response.

I had a little trouble getting the patch merged in, but I was able to 
get it working, and your tests passed nicely.  Thanks for updating both 
the code and tests!

Eric

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

Gmane