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

2031Re[2]: [jasspa] template

Expand Messages
  • Steven Phillips
    Oct 20, 2006
    • 0 Attachment
      Rick,

      You need to inform the hook that an abbreviation file is available, currently
      the hksql.emf has:

      set-variable .fhook-sql.setup ® "/history/fhook/sql" "ghix"
      set-variable .fhook-sql.setup-mask "aeghikmtux"

      Each of the "aeghikmtux" letters represents a feature supported by the hook,
      see the header in majormod.emf for a complete list of letters and their
      meaning. Missing from this list is 'b' for abbreviation support, so change
      the above to:

      set-variable .fhook-sql.setup ® "/history/fhook/sql" "bghix"
      set-variable .fhook-sql.setup-mask "abeghikmtux"

      And everything should work as expected. However this fix could cause problems
      when you next up-grade because you are editing the main, to reduce the risk I
      recommend you add the following line to your mysql.emf:

      set-variable .fhook-sql.setup-mask &cat .fhook-sql.setup-mask "b"

      restart ME, load an sql file and use major-mode-setup to enable it (you many
      need to restart ME for it to take effect).

      The reason this does not 'just work' is because the buffer hook support was
      never fully designed, its kind of evolved over 10+ years so its not as slick
      as perhaps it should be. This area probably needs an overhaul but time is not
      particularly agreeable to this.

      Steve

      > Subject: [jasspa] template
      > From: Rick Owen <rickowen@...>
      > Date: Friday, October 20, 2006, 12:18:37 PM
      > To: jasspa@yahoogroups.com
      >
      >
      > I tried to to set up an abbreviation file for sql, but I must be missing
      > something.  I created a file "sql.eaf" and placed in my user directory:
      >
      > C:\Documents and Settings\Rick Owen\Application Data\jasspa
      >
      >  
      >
      > I thought I would start simple so sql.eaf just includes the following lines:
      >
      >  
      >
      > if "if \p\rthen\rend if;\P"
      > el "else\r\p\P"
      > ei "if \p\rthen\relsif \p\rthen\rend if;\P"

      > when I try an abbreviation expansion I get the message: [Failed to find an expansion]
      >
      >  
      >
      > so then I tried the following:
      >
      > * copied sql.eaf to mysql.eaf in my user directory
      >
      > * copied sql.eaf to C:\Program Files\JASSPA\MicroEmacs\macros\
      >
      >  
      >
      > Neither of the above actions made any difference.
      >
      >  
      >
      > I am assuming that since .sql is already a major mode there is a hook for
      > loading the abbreviation file, so I didn't do anything in that respect.
      >
      >  
      >
      > Also, is there some place in the help that defines to meta-characters that
      > the abbreviation expansion recognizes?  I looked in several places and found
      > various bits and pieces about abbreviations, but nothing about their syntax.
      >
      >  
      >
      > Any help would be appreciated.
      >
      > Thanks,
      >
      > Rick.

      >
      > ----- Original Message ----
      > From: Bryan Schofield <schofield.bryan@...>
      > To: jasspa@yahoogroups.com
      > Sent: Monday, October 2, 2006 9:55:15 AM
      > Subject: Re: [jasspa] template

      >
      >
      > For simple code snippets I use abbrevs. See help on buffer-abbrev- file,
      > expand-abbrev, abbrev-list. Many languages already support abbrev mode by
      > default. By adding an languange .eaf file to your $user-path, ME should pick
      > it. For example, adding a cpp.eaf with your c++ abbrevs will make them
      > available to you when you're editing c++ files.

      > For complicated code snippets, like generating java getter and setters I
      > write little macros to do it. So that putting the cursor on a line that
      > defines property variable the macros know what the getters and setters
      > should be. For this, I usually record a macro, name it, and insert in a .emf
      > file for later use. See help on start-kbd-macro, end-kbd-macro,
      > name-kbd-macro, insert-macro, execute-named- command.

      > Cheers
      > -- bryan

      >
      > On 10/2/06, Rick Owen <rickowen@yahoo. com> wrote:
      >
      >
      >
      >
      > Is there a way to create code templates so that with a keystroke (or select
      > from a menu or whatever) I can insert a chunk of code.
      >
      >  
      >
      > Thanks,
      >
      > Rick.
      >  
      >

      >


      >

      >
      >
    • Show all 8 messages in this topic