confusion about py-string-to-syntax def

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

confusion about py-string-to-syntax def

Skip Montanaro-3
I'm trying to get the latest python-mode.el to compile cleanly.  I have this
definition:

    ;; Skip's XE workaround
    (if (fboundp 'string-to-syntax)
        (defalias 'py-string-to-syntax string-to-syntax)
      (defun py-string-to-syntax (s)
        (cond
         ((equal s "|") '(15))
         ((equal s "_") '(3))
         (t (error "Unhandled string: %s" s))))
      )

and get this output from byte-compile-file:

    Compiling file /Users/skip/src/python-mode/python-mode.el at Thu Jan 13 14:03:29 2011
      ** attempt to inline py-string-to-syntax before it was defined
      ** attempt to inline py-string-to-syntax before it was defined
      ** attempt to inline py-string-to-syntax before it was defined
      ** attempt to inline py-string-to-syntax before it was defined
      ** attempt to inline py-string-to-syntax before it was defined
    While compiling toplevel forms:
      ** attempt to inline py-string-to-syntax before it was defined

Why?  Is that an error?  I do get a .elc file so I sort of assume it's just
a warning.

Skip
_______________________________________________
Python-mode mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/python-mode
Reply | Threaded
Open this post in threaded view
|

Re: confusion about py-string-to-syntax def

Andreas Röhler-2
Am 13.01.2011 21:05, schrieb [hidden email]:

> I'm trying to get the latest python-mode.el to compile cleanly.  I have this
> definition:
>
>      ;; Skip's XE workaround
>      (if (fboundp 'string-to-syntax)
>          (defalias 'py-string-to-syntax string-to-syntax)
>        (defun py-string-to-syntax (s)
>          (cond
>           ((equal s "|") '(15))
>           ((equal s "_") '(3))
>           (t (error "Unhandled string: %s" s))))
>        )
>

Thanks,

though my taste is still the other way around:

as soon as XEmacs merges up to GNU code, would should drop our stuff,
considered a possible a bug-source than.

With the use of a aliased function I'm afraid, we have the complexity
and bug source just now.

I'll be patient and look, should someone want to write that in.
Just rather not me :-)

Let's go on

Andreas

_______________________________________________
Python-mode mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/python-mode
Reply | Threaded
Open this post in threaded view
|

Re: confusion about py-string-to-syntax def

Barry Warsaw
On Jan 13, 2011, at 10:09 PM, Andreas Röhler wrote:

>Am 13.01.2011 21:05, schrieb [hidden email]:
>> I'm trying to get the latest python-mode.el to compile cleanly.  I have this
>> definition:
>>
>>      ;; Skip's XE workaround
>>      (if (fboundp 'string-to-syntax)
>>          (defalias 'py-string-to-syntax string-to-syntax)
>>        (defun py-string-to-syntax (s)
>>          (cond
>>           ((equal s "|") '(15))
>>           ((equal s "_") '(3))
>>           (t (error "Unhandled string: %s" s))))
>>        )
>>
>
>though my taste is still the other way around:
>
>as soon as XEmacs merges up to GNU code, would should drop our stuff, considered a possible a bug-source than.
>
>With the use of a aliased function I'm afraid, we have the complexity and bug source just now.
>
>I'll be patient and look, should someone want to write that in.
>Just rather not me :-)
>
>Let's go on
As I said, you're doing the work, and this is internal stuff, so it's your
call. :)

_______________________________________________
Python-mode mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/python-mode

signature.asc (853 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: confusion about py-string-to-syntax def

Andreas Röhler-2
Am 13.01.2011 22:16, schrieb [hidden email]:
>      >>>  I'm trying to get the latest python-mode.el to compile cleanly.
>
> Neither of you answered this question.  :-)  How do I get those warnings to
> go away?
>
> Skip
>

Hi Skip,

seems you introduced a bug. Why not use the trunk?

BTW all the "py-"-prefix and defalias considerations here are missing
the point IMHO in such, as if in further futures XEmacs should provide
this symbol, the compiler will tell..."defined a second time".

Until then, please let us stay as much as possible with the existing
code, as tqs-syntax-setting is known to work elsewhere.

If extra stuff is introduced in this context, debugging syntax will be
harder.

What about removing remaining compiler warnings, which are not
functional AFAIS? For example introducing some defvars to silence the
compiler in these cases.

Thanks BTW having brought the compiling question to attention here.

Andreas


_______________________________________________
Python-mode mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/python-mode
Reply | Threaded
Open this post in threaded view
|

Re: confusion about py-string-to-syntax def

Skip Montanaro-3

    Andreas> seems you introduced a bug. Why not use the trunk?

I would if I could.  I have been merging trunk to my branch.  How do I swap
my (mostly dead) branch for trunk?

Guys, I generally find DVCS very difficult to use.  They don't fit my brain
at all.  (I fear for the day when the Python source tree switches to
Mercurial.  I don't think I will be able to function at all.)  That said, I
do like branching and use it all the time with Subversion and CVS.  Help me
figure out how to use bzr, git, hg, etc in a CVS/Subversion-like way and
you'll have a friend for life.

    Andreas> BTW all the "py-"-prefix and defalias considerations here are
    Andreas> missing the point IMHO in such, as if in further futures XEmacs
    Andreas> should provide this symbol, the compiler will tell..."defined a
    Andreas> second time".

I thought Barry's note about not polluting the global namespace was
correct.  My crippled string-to-syntax will only work for the cases needed
by python-mode.  I think you need to create py-string-to-syntax and refer to
it.  Otherwise you run the risk of making some other package blow up.

    Andreas> Until then, please let us stay as much as possible with the
    Andreas> existing code, as tqs-syntax-setting is known to work
    Andreas> elsewhere.

What is tqs-syntax-setting?

    Andreas> What about removing remaining compiler warnings, which are not
    Andreas> functional AFAIS? For example introducing some defvars to
    Andreas> silence the compiler in these cases.

I have no idea how to do that.

Skip
_______________________________________________
Python-mode mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/python-mode
Reply | Threaded
Open this post in threaded view
|

Re: confusion about py-string-to-syntax def

Barry Warsaw
On Jan 14, 2011, at 08:07 AM, [hidden email] wrote:

>I would if I could.  I have been merging trunk to my branch.  How do I swap
>my (mostly dead) branch for trunk?
>
>Guys, I generally find DVCS very difficult to use.  They don't fit my brain
>at all.  (I fear for the day when the Python source tree switches to
>Mercurial.  I don't think I will be able to function at all.)  That said, I
>do like branching and use it all the time with Subversion and CVS.  Help me
>figure out how to use bzr, git, hg, etc in a CVS/Subversion-like way and
>you'll have a friend for life.

Skip, you can use Bazaar essential the same way you use Subversion but doing
what's called a "lightweight checkout".  Just do:

    $ bzr co lp:python-mode

Then, 'bzr commit' in the python-mode directory will do exactly like 'svn
commit' in that it will immediately change the state of the branch on the
server, so you need to be on the net, and your local working directory needs
to be up-to-date.

More details available here: http://wiki.bazaar.canonical.com/CheckoutTutorial

-Barry

_______________________________________________
Python-mode mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/python-mode

signature.asc (853 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: confusion about py-string-to-syntax def

Andreas Röhler-2
In reply to this post by Skip Montanaro-3
[ ... ]
> What is tqs-syntax-setting?

Meant: Defining the syntax for the triple-quoted-string.


_______________________________________________
Python-mode mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/python-mode