Loading ...
Sorry, an error occurred while loading the content.
 

Re: Smart Home Macro

Expand Messages
  • vae_ik
    Hi There is a macro with such functionality in MicroEmacs distribution already. Look for contrib/bol_eol.emf Regards Ilija
    Message 1 of 5 , May 9 12:18 AM
      Hi

      There is a macro with such functionality in MicroEmacs distribution already. Look for contrib/bol_eol.emf

      Regards
      Ilija



      --- In jasspa@yahoogroups.com, "cp200205" <jeremy@...> wrote:
      >
      > I just wrote a smart home macro. When executing it will move the cursor to the first non-blank location in the current line. If the cursor was already there, however, it then moves the cursor to the first column. An example, assuming . is leading space and ^ is the cursor:
      >
      > ....John^Doe : execute smart-home and it will become:
      > ....^John Doe : execute smart-home again and it becomes:
      > ^....John Doe : execute again and it becomes:
      > ....^John Doe : each hit cycles between the two locations.
      >
      > The source is included here and also available from my dotmicroemacs github repo (as well as other macros and my configs): https://github.com/jcowgar/dotmicroemacs
      >
      > ======== BEGIN ========
      > ; Go to the first non-blank character on the current line. If already there,
      > ; go to column 1
      > define-macro smart-home
      > set-variable #l1 $window-acol
      >
      > beginning-of-line
      >
      > !repeat
      > !force forward-char
      > !if $status
      > !if ¬ &sin @wc " \t"
      > set-variable #l0 1
      > !endif
      > !else
      > set-variable #l0 1
      > !endif
      > !until #l0
      >
      > !if &equal $window-acol #l1
      > beginning-of-line
      > !end
      > !emacro
      > global-bind-key smart-home "home"
      > ======== END ========
      >
      > Jeremy Cowgar
      > http://jeremy.cowgar.com
      >
    • cp200205
      Opps :-/ Didn t intentionally reinvent the wheel. Jeremy
      Message 2 of 5 , May 12 7:33 AM
        Opps :-/ Didn't intentionally reinvent the wheel.

        Jeremy

        --- In jasspa@yahoogroups.com, "vae_ik" <ilijak@...> wrote:
        >
        >
        > Hi
        >
        > There is a macro with such functionality in MicroEmacs distribution already. Look for contrib/bol_eol.emf
        >
      • vae_ik
        ... Better two than nill. And even simple, it a good exercise. As for reinventing, I have reinvented it twice: 1st in C, then as a macro. cheers Ilija
        Message 3 of 5 , May 12 8:49 AM
          --- In jasspa@yahoogroups.com, "cp200205" <jeremy@...> wrote:
          >
          > Opps :-/ Didn't intentionally reinvent the wheel.

          Better two than nill. And even simple, it'a good exercise.
          As for reinventing, I have reinvented it twice: 1st in C, then as a macro.

          cheers
          Ilija


          >
          > Jeremy
          >
          > --- In jasspa@yahoogroups.com, "vae_ik" <ilijak@> wrote:
          > >
          > >
          > > Hi
          > >
          > > There is a macro with such functionality in MicroEmacs distribution already. Look for contrib/bol_eol.emf
          > >
          >
        Your message has been successfully submitted and would be delivered to recipients shortly.