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

668Re: [jasspa] tabs

Expand Messages
  • Jon Green
    Sep 16, 2002
      Could create own buffer extensions to cope with the tab width
      setting i.e. mysql.emf. Then in the .sql file you can introduce
      the header:-

      /* -!- sql tabsize:3; -!- */

      ... SQL file ....

      This sets the tab size in the header and it is adopted for
      that buffer only. The problem with setting $tabsize is that
      it affects all buffers which is not generally desirable.
      You probably want to leave $tabwidth alone as this causes
      mis formatting errors in other editors.

      If you use the tab key then may be easier to perform
      a buffer bind of <tab> and <S-Tab> in the fhook to
      map these onto inserting 3 spaces. If you need some
      help with this then shout.

      Looking at the SQL hook file then it is very basic -
      if you are doing a lot of work in SQL then it will
      be work adding indentation and comment rules.
      (Look at hkemf.emf) for an example.

      Regards
      Jon.

      File mysql.emf
      --------------

      ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
      ;
      ; Author : $Author$
      ; Created By : Jon Green
      ; Created : Mon Sep 16 15:35:26 2002
      ; Last Modified : <020916.1539>
      ;
      ; Description
      ;
      ; Notes
      ;
      ; History
      ;
      ; Copyright (c) 2002 Jon Green.
      ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

      define-macro my-fhook-sql
      set-variable :tabsize $tabsize
      set-variable :tabwidth $tabwidth
      ; Search for additional modes in a -!- sql -!-
      ;
      ; -!- tex; fill-column: <digit> -!-
      ;
      ;
      beginning-of-buffer
      !force -20 regex-forward &spr "-[*!]-"
      !if $status
      ; Search for tabsize: <var>;
      !force -1 regex-forward "tabsize[ \t]*:[ \t]*\\([0-9]+\\)[ \t]*[-;]"
      !if $status
      set-variable :tabsize @s1
      beginning-of-line
      !endif
      ; Search for tabwidth: <var>;
      !force -1 regex-forward "tabwidth[ \t]*:[ \t]*\\([0-9]+\\)[ \t]*[-;]"
      !if $status
      set-variable :tabwidth @s1
      beginning-of-line
      !endif
      ; Add any others in here.

      ; Back to the start of the buffer
      beginning-of-buffer
      !endif
      !emacro

      ;
      ; Buffer hook. Modify the fill mode to left only. This ensures that we
      ; always fill the line correctly irrespective of the mode of the caller.
      ; The likes of centre and justified are not warrented in a TeX buffer.
      ;
      0 define-macro my-bhook-sql
      ; Save the other context. Restore local context
      set-variable :otabwidth $tabwidth
      set-variable $tabwidth :tabwidth
      set-variable :otabsize $tabsize
      set-variable $tabsize :tabsize
      !emacro
      ;
      0 define-macro my-ehook-sql
      ; Restore existing context
      set-variable :tabwidth $tabwidth
      set-variable $tabwidth :otabwidth
      set-variable :tabsize $tabsize
      set-variable $tabsize :otabsize
      !emacro



      Rick Owen wrote:
      >
      > I found some more info in the FAQ on $tabwidth, but even after I set it to 3 it
      > gets reset to 4 when I edit a .sql file. Is there a global place where indent
      > mode is modified based on the file type?
      >
      > Thanks,
      > Rick.
      >
      > --- Rick Owen <rickowen@...> wrote:
      > > Greetings,
      > >
      > > I am using me on an hpux. I use it to edit .SQL files and everything
      > > is working great except when I press the tab key I get 4 spaces
      > > inserted and I only want three, but I can't determine where that is
      > > set. What I need is some help understanding the variables $tabsize
      > > and $tabwidth and where I should set them. I use the same tab width
      > > for all the types of files that I edit and I always want spaces
      > > inserted, so I would like to know where to make the change so that it
      > > is global for all file types.
      > >
      > > Thanks,
      > > Rick.
      > >
      > >
      >
      > =====
      > "Lawyers, I suppose, were children once." (Charles Lamb)
      >
      > __________________________________________________
      > Do you Yahoo!?
      > Yahoo! News - Today's headlines
      > http://news.yahoo.com
      >
      >
      > __________________________________________________________________________
      >
      > This is an unmoderated list. JASSPA is not responsible for the content of
      > any material posted to this list.
      >
      > To unsubscribe, send a mail message to
      >
      > mailto:jasspa-unsubscribe@yahoogroups.com
      >
      > or visit http://groups.yahoo.com/group/jasspa and
      > modify your account settings manually.
      >
      >
      >
      > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/

      --
      ______________________________________________________________________

      Jon Green J.D.Naughton-Green
      Project Manager

      SAMSUNG Electronics (UK) Ltd
      Samsung Electronics Research Institute (Audio / Visual Labs)
      The Communication Centre
      South Street
      Staines Tel(direct): +44 (0)1784 428614
      MIDDLESEX Tel(s/w board): +44 (0)1784 428600 ext 614
      TW18 4QE Fax: +44 (0)1784 428620
      England Email (work): jon@...
      Email (home): jon@...
      _______________________________________________________________________
    • Show all 4 messages in this topic