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

2638Smart Home Macro

Expand Messages
  • cp200205
    May 5, 2011
      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


      !force forward-char
      !if $status
      !if ¬ &sin @wc " \t"
      set-variable #l0 1
      set-variable #l0 1
      !until #l0

      !if &equal $window-acol #l1
      global-bind-key smart-home "home"
      ======== END ========

      Jeremy Cowgar
    • Show all 5 messages in this topic