IDE

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Paul Rubin

    #46
    Re: elisp -> Python (was Re: [OT] Emacs, Eclipse, Leo (was Re: IDE

    sjdevnull@yahoo .com (G. S. Hayes) writes:[color=blue][color=green]
    > > How about just reusing the elisp interpreter in its C form[/color]
    >
    > Given the Deep Magic emacs does during the build process, I'm not sure
    > how easy that would be. If I recall correctly, it builds a minimal
    > Lisp interpreter, uses that to run a bunch of Lisp code, and then
    > coredumps the running image into a new executable.[/color]

    That step is optional and with current computers, it's not really
    necessary. It was intended to avoid making Emacs spend time loading
    the Lisp files for the standard editing functions every time you
    started Emacs. On the old Vaxes, that could take over a minute,
    especially when other users were sharing the cpu. But on a reasonable
    workstation these days, it takes less than a second, so you don't
    really need the unexec any more.
    [color=blue]
    > Even if you could sort that out, you still have the problem of
    > figuring out how to wrap all the Lisp objects with appropriate
    > Python objects.[/color]

    I think writing some Lisp/Python hybrid interpreter is possible but
    doing a direct translation of Emacs Lisp to Python isn't really feasible.

    Comment

    • Paul Rubin

      #47
      Re: elisp -> Python (was Re: [OT] Emacs, Eclipse, Leo (was Re: IDE

      François Pinard <pinard@iro.umo ntreal.ca> writes:[color=blue]
      > Pymacs is not Emacs Lisp, and Python in Vim is not Vimscript either,
      > tweaks are needed in both cases for accessing some of the underlying
      > scripting facilities. Pymacs is rather elegant, Python in Vim is rather
      > clean.[/color]

      What are these editors? Are they written in Python? How do they
      implement the editing buffer? How do they implement searching
      backwards for a regexp in the buffer?

      Comment

      • François Pinard

        #48
        Re: elisp -&gt; Python (was Re: [OT] Emacs, Eclipse, Leo (was Re: IDE

        [Paul Rubin]
        [color=blue]
        > [François Pinard][/color]
        [color=blue][color=green]
        > > Pymacs is not Emacs Lisp, and Python in Vim is not Vimscript either,
        > > tweaks are needed in both cases for accessing some of the underlying
        > > scripting facilities. Pymacs is rather elegant, Python in Vim is
        > > rather clean.[/color][/color]
        [color=blue]
        > What are these editors? Are they written in Python? How do they
        > implement the editing buffer? How do they implement searching
        > backwards for a regexp in the buffer?[/color]

        Pymacs is just a add-on over Emacs, it is not an editor in itself, like
        Emacs is. Pymacs is written half in Python, half in Emacs Lisp. Pymacs
        allows Emacs to externally start a collaborating Python interpreter, and
        be extended with Python instead of Emacs Lisp. The Python extension,
        executed by the Python interpreter, handles editing by "asking" Emacs to
        do the work. For example, it could call `lisp.buffer-substring()' to
        get a copy of part of a buffer, massage that string in Python, and then
        use both `lisp.delete()' and `lisp.insert()' to replace the original
        text by the modified one. One normally writes `from Pymacs import lisp'
        first, and the `lisp' object contains a lot of magic, including all
        about the communication protocol.

        Python in Vim is just a add-on over Vim, it is not an editor in itself,
        like Vim is. Python in Vim is the full Python interpreter, written in
        C, and linked right into Vim. Python in Vim allows Vim to be extended
        with Python instead of Vimscript. The Python extension handles editing
        by "directly" acting on `vim.current.bu ffer', which is a Python list
        of buffer lines. One normally write `import vim' first, and the `vim'
        module offers a lot of magic, provided by the Vim-Python integration.

        Searching backwards for a regexp in the buffer? In both Pymacs and
        Python in Vim, I would likely get Python to ask either Emacs, likely
        through something like `lisp.regexp_se arch_backwards( "REGEXP")', or Vim,
        likely through something like `vim.command("n ormal ?REGEXP?")'.

        --
        François Pinard http://www.iro.umontreal.ca/~pinard

        Comment

        • G. S. Hayes

          #49
          Re: elisp -&gt; Python (was Re: [OT] Emacs, Eclipse, Leo (was Re: IDE

          Paul Rubin <http://phr.cx@NOSPAM.i nvalid> wrote in message news:<7xn01sfqh s.fsf@ruckus.br ouhaha.com>...[color=blue]
          > François Pinard <pinard@iro.umo ntreal.ca> writes:[color=green]
          > > Pymacs is not Emacs Lisp, and Python in Vim is not Vimscript either,
          > > tweaks are needed in both cases for accessing some of the underlying
          > > scripting facilities. Pymacs is rather elegant, Python in Vim is rather
          > > clean.[/color]
          >
          > What are these editors?[/color]

          Emacs and vi are the two most common editors for serious programmers
          in the Unix/Linux world; vim is the standard vi implementation used on
          most Linux distributions (and is widely available on other platforms,
          including other Unixes as well as Windows, Macintosh, Amiga, Vax,
          etc). GNU Emacs is the standard emacs implementation used on most
          Unix platforms that have any emacs implementation (and is widely
          available on other platforms, probably all those listed above but
          certainly Windows, Macintosh, and other Unixes). Other common vi
          implementations include nvi (used by BSD) and vile, other common emacs
          implementations include XEmacs (formerly Lucid Emacs) and jed.
          [color=blue]
          > Are they written in Python? How do they implement the editing buffer?[/color]

          Vim is implemented in C, and supports at least 4 scripting languages
          for extensions (vim, python, perl, and tcl); most larger extensions
          are written in Perl or Python, though some are in vim's built-in
          script.

          Emacs is a hybrid C/elisp implementation (elisp being Emacs' dialect
          of LISP) and normally extensions are written in elisp. Pymacs allows
          writing extensions in python.
          [color=blue]
          > How do they implement searching backwards for a regexp in the buffer?[/color]

          At what level? In vim, at the user or vimscript level:
          ?some_regex
          At the python level, you can use:

          import vim
          current_buffer= vim.current.buf fer

          And then use the standard Python re to search current_buffer (a list
          of lines) or otherwise edit current_buffer. And you can treat
          current_buffer basically as you would expect:

          current_buffer[0]="New" # Change first line to "New"
          current_buffer[0:0]="New" # insert new first line "New"
          del current_buffer[9] # delete 10th line of buffer
          current_buffer. append("Last") # Append line "Last" to buffer

          Inside of vim, ":help python" has more info on the Python interface.

          Alternatively, you could execute a Vim command from the Python
          interface:

          import vim
          vim.command("?s ome_regex\n") #The search-backward command a user
          would run

          Comment

          • G. S. Hayes

            #50
            Re: elisp -&gt; Python (was Re: [OT] Emacs, Eclipse, Leo (was Re: IDE

            Ville Vainio <ville@spammers .com> wrote in message news:<du71xj6q0 4b.fsf_-_@amadeus.cc.tu t.fi>...[color=blue]
            > You switched from emacs to vim? That borders on blasphemy ;-).
            >[/color]

            I did that too, after 4-5 years of Emacs. Modal editing works well
            with my brain. :-)
            [color=blue]
            > Seriously, is Vim as customizable/programmable in python as emacs is
            > in elisp? If that is the case, I'm switching too...[/color]

            No, it isn't. Emacs has many more output options; vim basically only
            supports text (and some file selectors and menus). So you couldn't
            do, for instance, a web browser with inline image support in vim.

            But you can access all vim commands, define new user functions and
            keymappings, edit the text, set marks, etc.

            So basically, it's a fully customizable text environment, and people
            have done mail readers and so on in vim/Python. Getting debuggers
            running in subshells and such is possible too, but basically only for
            line-oriented tasks (no full terminal emulation).

            But the general consensus in the Vim community is that Vim should
            remain an editor, not an environment, and it should obey the Do One
            Thing Well philosophy. The Emacs community often views Emacs as their
            OS, doing everything from reading news/mail to playing games to
            surfing the web from Emacs (and oh, yeah, editing text too). So don't
            expect to find anything as polished as GNUS out of the box for
            Vim--but do expect a lot of people who know how to make vim and slrn
            work together very well.

            Getting anything graphical interacting with Vim in a meaningful way
            would be right out, at least until someone convinces Braam to add a
            few things (like adding an input fd with callback), and polling
            periodically can't happen either (so e.g. mail readers can only check
            for new mail when the user hits a key, not every 5 minutes) until that
            happens.

            Comment

            Working...