Re: special editor support for indentation needed.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Eric S. Johansson

    #16
    Re: special editor support for indentation needed.

    Jeremiah Dodds wrote:
    Eric, I don't have a good readily available solution to what you're
    trying to do, but it seems to me that it would be worth your time to get
    comfortable with elisp, and how it's used in emacs. The emacs
    documentation is pretty good, even if you don't know lisp, and I think
    it would be one of the easiest languages to integrate well with voice
    recognition. I don't think you would need to touch what is commonly
    referred to as emacs internals to do what you want. There's a good
    chance that you'd be able to greatly improve emacs voice-recognition
    support pretty easily in a month or twos time.
    for reasons too long to go into, trying to modify Emacs extensively is not a
    long-term win. My requests here were trying to make Emacs somewhat better as a
    speech recognition driven editor to get to my final goal, namely building a
    bridge between Windows and Linux for speech recognition. The time or take
    modify Emacs to do what I want would be better spent burning my hands and going
    directly for the end goal because I believe it would take me less time to get to
    where I want. what I have to learn by myself is how to make a Windows edit
    control work from Python, verify speech recognition works with that
    configuration, then create a mirror window on linux so what ever is placed into
    one window via speech recognition, cut and paste, or even typing shows up in the
    other window. Then, I need to layer a grammar on top of that to enable the
    linux side to do application specific cut and paste. this tool would allow us
    to use anything for an editor and not just the one we have just tweaked.

    simple heh. I may just be better off trying to make enough money so I can pay
    somebody to do that.

    As I was writing this, it just occurred to me one way to implement the
    indentation control. it would be something like "moved to beginning of line,
    leave mark, move to end of line, kill region, insert < action specific number of
    spaces>.

    I still think it would be a better solution to determine the indentation of the
    previous item that should art hold the right indentation and reuse that amount
    but, I will settle for with brute force, bloody ignorance

    Yes, that probably will work

    Comment

    • Eric S. Johansson

      #17
      Re: special editor support for indentation needed.

      John Yeung wrote:
      On Nov 15, 8:50 pm, "Eric S. Johansson" <e...@harvee.or gwrote:
      >well, therein lies the rub. I don't know lisp,
      >I don't know Emacs internals let alone python mode.
      >
      Unfortunately, neither do I. Actually, I haven't touched Emacs since
      my college days, and barely remember any of it. I figured from your
      preference for Emacs that you already did some customization for
      yourself.
      Like the vast majority of Emacs users, I cut, paste, and swear.
      >
      Is vr-mode a "major" mode? If so, I suppose it can't be active at the
      same time as python-mode, which is also a major mode. I grabbed a
      copy of the code for python-mode (revision 4.75) and while I frankly
      don't understand it, it looks like it has provisions for things like
      finding the beginning of a class or def, which might be usable in
      building the types of commands you want.
      >
      Perhaps you should try asking for help from the Emacs community. To
      someone versed in Emacs Lisp, what you want might be fairly easy.
      >
      Another possibility, that I mention mainly because I find it
      interesting, and not so much because I expect it to be the best path
      for you, is Pymacs. It purports to let you customize Emacs using
      Python instead of Emacs Lisp.
      >
      Good luck! I'm sorry I can't be of more help.
      no biggie. Maybe the real answer is changing the conversation to look for
      editors that can run on Windows but edit remotely like emacs + tramp.

      Anyway, here's the speech macros I've worked out so far.

      # minimal python and commands

      New class = '{ctrl+a}class
      {ctrl+@}(object ):{ctrl+j}{tab} """{ctrl+j}{tab }"""{enter}{ctr l+x}{ctrl+x}';

      new method = '{ctrl+a} def
      {ctrl+@}(self): {ctrl+j}"""{ctr l+j}"""{ctrl+j} {ctrl+x}{ctrl+x }';

      new constructor = '{ctrl+a} def __init__(self): {ctrl+j}"""{ctr l+j}"""{ctrl+j} ';

      end colon = '{ctrl+e}:';

      between single quotes = "''"{ctrl+b };
      between double quotes = '""'{ctrl+b} ;
      between triple quotes = "''''''"{ctrl+b }{ctrl+b}{ctrl+ b};
      between hex quotes = '""""""'{ctrl+b }{ctrl+b}{ctrl+ b};

      (ad|add) index = '[]{ctrl+b}';
      next index = '{ctrl+s}[{ctrl+f}';
      last index = '{ctrl+r}]{ctrl+b}{ctrl+r }[{ctrl+f}';
      delete index = '{ctrl+r}[{ctrl+f}{ctrl+s }]{ctrl+b}{ctrl+w }';

      go to Line [Number] <digit= {esc}xgoto-line{enter}$1{E nter};
      go to Line [Number] <digit<digit= {esc}xgoto-line{enter}$1$2 {Enter};
      go to Line [Number] <digit<digit<di git= {esc}xgoto-line{enter}$1$2 $3{Enter};
      go to Line [Number] <digit<digit<di git<digit=
      {esc}xgoto-line{enter}$1$2 $3$4{Enter};

      go to (end={ctrl+e} | beginning={ctrl +a} | start={esc}m) of line = $1;


      Comment

      • Andreas Roehler

        #18
        Re: special editor support for indentation needed.

        Eric S. Johansson wrote:
        Jeremiah Dodds wrote:
        >
        >Eric, I don't have a good readily available solution to what you're
        >trying to do, but it seems to me that it would be worth your time to get
        >comfortable with elisp, and how it's used in emacs. The emacs
        >documentatio n is pretty good, even if you don't know lisp, and I think
        >it would be one of the easiest languages to integrate well with voice
        >recognition. I don't think you would need to touch what is commonly
        >referred to as emacs internals to do what you want. There's a good
        >chance that you'd be able to greatly improve emacs voice-recognition
        >support pretty easily in a month or twos time.
        >
        for reasons too long to go into, trying to modify Emacs extensively is not a
        long-term win.
        IMO Jeremiah Dodds is right. With all the time spent on this discussion, you could write the
        needed function in elisp probably. BTW your request seems reasonable. Other python programmers may use it too.

        Whats Emacs? To an important extent, it's that, you want it to be.
        So if you have your code, your functions, why it shouldn't it be a long term win?

        Anyway you should tell, which python-mode and which Emacs you use if any.

        Andreas Röhler

        Comment

        • Eric S. Johansson

          #19
          Re: special editor support for indentation needed.

          Andreas Roehler wrote:
          IMO Jeremiah Dodds is right. With all the time spent on this discussion, you
          could write the needed function in elisp probably. BTW your request seems
          reasonable. Other python programmers may use it too.
          I tried learning lisp about 15 years ago. even bought a copy of the little
          lisper. after a few days, I gave up because there was just too much learning
          curve for the reward. I know that sounds a touch arrogant but in truth, I'd
          prefer to put my energy into building a better bridge between NaturallySpeaki ng
          and linux apps. bigger pay off helping more people. with reguard to emacs
          changes I hope for and would appreciate it if someone would partner up with me
          and help build these (and other) changes into python mode. I will also point
          out that if another IDE is better suited, I'm open to that too.
          Anyway you should tell, which python-mode and which Emacs you use if any.

          This is GNU Emacs 23.0.60.1 (i386-mingw-nt5.1.2600)
          of 2008-09-08 on LENNART-69DE564 (patched)

          and I'm using the python mode that came with emacs. no version number but...

          ;;; python.el --- silly walks for Python -*- coding: iso-8859-1 -*-

          ;; Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.

          ;; Author: Dave Love <fx@gnu.org>
          ;; Maintainer: FSF
          ;; Created: Nov 2003
          ;; Keywords: languages
          >
          Andreas Röhler

          Comment

          • Andreas Roehler

            #20
            Re: special editor support for indentation needed.

            Eric S. Johansson wrote:
            Andreas Roehler wrote:
            >
            >IMO Jeremiah Dodds is right. With all the time spent on this discussion, you
            >could write the needed function in elisp probably. BTW your request seems
            >reasonable. Other python programmers may use it too.
            >
            I tried learning lisp about 15 years ago. even bought a copy of the little
            lisper. after a few days, I gave up because there was just too much learning
            curve for the reward. I know that sounds a touch arrogant but in truth, I'd
            prefer to put my energy into building a better bridge between NaturallySpeaki ng
            and linux apps. bigger pay off helping more people. with reguard to emacs
            changes I hope for and would appreciate it if someone would partner up with me
            and help build these (and other) changes into python mode. I will also point
            out that if another IDE is better suited, I'm open to that too.
            I like Emacs, that's true. However I'm not married with.
            If a better tools exists for my purposes, I'll use it.

            Until than lets write the code you need in Emacs Lisp, which should not be that difficult.

            I use

            GNU Emacs 22.1.1 (i586-suse-linux-gnu, GTK+ Version 2.12.0) of 2007-11-24 on dede

            with python-mode.el from

            Download python-mode.el for Emacs and XEmacs for free. python-mode is an Emacs and XEmacs major mode for editing Python source code. Please note that ALL DEVELOPMENT HAS MOVED TO LAUNCHPAD: http://launchpad.net/python-mode


            AFAIK its the most advanced mode for all Emacsen.

            You could give it a try.

            Meanwhile I'll reflect a draft addressing your needs.

            BTW, what about this stuff?:



            >
            >Anyway you should tell, which python-mode and which Emacs you use if any.
            >
            >
            This is GNU Emacs 23.0.60.1 (i386-mingw-nt5.1.2600)
            of 2008-09-08 on LENNART-69DE564 (patched)
            >
            and I'm using the python mode that came with emacs. no version number but...
            >
            ;;; python.el --- silly walks for Python -*- coding: iso-8859-1 -*-
            >
            ;; Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
            >
            ;; Author: Dave Love <fx@gnu.org>
            ;; Maintainer: FSF
            ;; Created: Nov 2003
            ;; Keywords: languages
            >
            >Andreas Röhler
            >
            >

            Comment

            Working...