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

Re: [jasspa] Getting Buffer Information

Expand Messages
  • Jon Green
    ... Guess you are looking for: esc-x help - Variable Glossary esc-x list-variables The existing macros are also a good source of information. Jon.
    Message 1 of 8 , Sep 9, 2005
      Gadrin wrote:
      > how do I find variables like
      >
      > the number of lines in the current buffer ?
      > the current line in the current buffer ?
      >
      > I thought $mode-line might help, but I wasn't able to use ml-write to
      > display any of them.
      >
      > I'd like to build some macros to edit a buffer and want to know where
      > I am at various points in the process.
      >
      > Thanks, Gadrin

      Guess you are looking for:

      esc-x help -> Variable Glossary
      esc-x list-variables

      The existing macros are also a good source of information.

      Jon.
    • Thomas Hundt
      Don t use ml-write. Use describe-variable (on mine, bound to C-h d ) to display one variable. Use C-h v to display all of them at once. You can click on
      Message 2 of 8 , Sep 9, 2005
        Don't use ml-write. Use describe-variable (on mine, bound to "C-h d")
        to display one variable.

        Use "C-h v" to display all of them at once. You can click on them to
        drill down to the help for each.

        You'll want to look at the variables like $window-xxx.

        Notice that $window-line is the line where point (the cursor) is in the
        *buffer* and not where it is in the *window*. To get the latter, you
        must compute $window-line minus $window-y-scroll.

        Have fun,

        -Th



        Jon Green wrote:
        > Gadrin wrote:
        >
        >>how do I find variables like
        >>
        >>the number of lines in the current buffer ?
        >>the current line in the current buffer ?
        >>
        >>I thought $mode-line might help, but I wasn't able to use ml-write to
        >>display any of them.
        >>
        >>I'd like to build some macros to edit a buffer and want to know where
        >>I am at various points in the process.
        >>
        >>Thanks, Gadrin
        >
        >
        > Guess you are looking for:
        >
        > esc-x help -> Variable Glossary
        > esc-x list-variables
        >
        > The existing macros are also a good source of information.
        >
        > Jon.
        >
        >
      • Gadrin
        ... in the ... you ... yes, I found it about an hour later, buried in one of the on-line samples. I wrote a complete script to grab an FTP folder listing and
        Message 3 of 8 , Sep 9, 2005
          --- In jasspa@yahoogroups.com, Thomas Hundt <thundt@s...> wrote:

          > You'll want to look at the variables like $window-xxx.
          >
          > Notice that $window-line is the line where point (the cursor) is
          in the
          > *buffer* and not where it is in the *window*. To get the latter,
          you
          > must compute $window-line minus $window-y-scroll.
          >
          > Have fun,
          >
          > -Th

          yes, I found it about an hour later, buried in one of the on-line
          samples.

          I wrote a complete script to grab an FTP folder listing and turn all
          the dates in the file to YYYY:MM:DD:HH:MM format (adding 12 to the
          times with AM in them).

          A minor challenge to write the buffer and display the message at the
          end (shell-ed out to delete the existing file first). But it works
          like a charm and very quickly.

          the other issue is concatenating a bunch of variables together which
          either is done in one confusingly long line or many, many set-
          variable statements.

          perhaps I can write a function to concatenate a "list" of vars or
          something. I'll have to see.

          Sorry for the bother, and thanks for your help Thom and Jon.

          PS -- no samples in the FILES section of this site ?
        • Thomas Hundt
          You mean like set-variable #l9 &cat #l1 &cat #l2 &cat #l3 &cat #l4 #l5 or ml-write &cat range is &cat #l7 &cat to &cat #l8 &cat len #l6 Yes, it gets
          Message 4 of 8 , Sep 9, 2005
            You mean like

            set-variable #l9 &cat #l1 &cat #l2 &cat #l3 &cat #l4 #l5

            or

            ml-write &cat "range is " &cat #l7 &cat " to " &cat #l8 &cat " len
            " #l6

            Yes, it gets a little hard to read vs. other languages that use, say, a
            '+', but it's not THAT hard...?

            -Th

            > the other issue is concatenating a bunch of variables together which
            > either is done in one confusingly long line or many, many set-
            > variable statements.
            >
            > perhaps I can write a function to concatenate a "list" of vars or
            > something. I'll have to see.
          • Gadrin
            I code alot in Winbatch which uses x = World ile = I like EMACs. strcat( Hello , x, ile) but I did come across sprintf, which is almost as good. I
            Message 5 of 8 , Sep 9, 2005
              I code alot in Winbatch which uses

              x = "World "
              ile = "I like EMACs."
              strcat("Hello ", x, ile)

              but I did come across sprintf, which is almost as good.

              I suppose I could build my own Strcat @1 @2 @3 ... @n

              boy, I'm very happy with the JASSPA incarnation.

              the find-file/file browser alone is a great feature.


              --- In jasspa@yahoogroups.com, Thomas Hundt <thundt@s...> wrote:
              > You mean like
              >
              > set-variable #l9 &cat #l1 &cat #l2 &cat #l3 &cat #l4 #l5
              >
              > or
              >
              > ml-write &cat "range is " &cat #l7 &cat " to " &cat #l8
              &cat " len
              > " #l6
              >
              > Yes, it gets a little hard to read vs. other languages that use,
              say, a
              > '+', but it's not THAT hard...?
              >
              > -Th
              >
              > > the other issue is concatenating a bunch of variables together
              which
              > > either is done in one confusingly long line or many, many set-
              > > variable statements.
              > >
              > > perhaps I can write a function to concatenate a "list" of vars
              or
              > > something. I'll have to see.
            • Jon Green
              ... Problem with your suggestion is that you need to know when the argument list ends, this would mean that you need a terminator of some description or an
              Message 6 of 8 , Sep 10, 2005
                Gadrin wrote:
                > I code alot in Winbatch which uses
                >
                > x = "World "
                > ile = "I like EMACs."
                > strcat("Hello ", x, ile)
                >
                > but I did come across sprintf, which is almost as good.
                >
                > I suppose I could build my own Strcat @1 @2 @3 ... @n
                >

                Problem with your suggestion is that you need to know when the argument list ends, this
                would mean that you need a terminator of some description or an argument count. &spr like
                you suggest is probably best.

                Jon.
              Your message has been successfully submitted and would be delivered to recipients shortly.