; -!- emf -!- ; JASSPA MicroEmacs - www.jasspa.com ; me.emf - Startup file for JASSPA MicroEmacs Distribution ; ; Copyright (C) 1988-2009 JASSPA (www.jasspa.com) ; ; This program is free software; you can redistribute it and/or modify it ; under the terms of the GNU General Public License as published by the Free ; Software Foundation; either version 2 of the License, or (at your option) ; any later version. ; ; This program is distributed in the hope that it will be useful, but WITHOUT ; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for ; more details. ; ; You should have received a copy of the GNU General Public License along ; with this program; if not, write to the Free Software Foundation, Inc., ; 675 Mass Ave, Cambridge, MA 02139, USA. ; ; Authors: Steven Phillips & Jon Green ; ; Is this macro release compatible with the binary? !if &les $version "20081110" 5000 ml-write "[Warning: The MicroEmacs executable is not compatible with this macro release]" !endif ; If <$user-name>.erf registry file isn't found then this is a new user !if &seq &find $user-name ".erf" "ERROR" !force read-registry "/history" "newuser" "cb" 0 define-macro-file newuser define-macro start-up !if &seq $buffer-bname "*scratch*" ; Startup for a new user. newuser !endif !emacro !else !force read-registry "/history" $user-name "cb" ml-write &cat "Setting up for user " $user-name !endif ; ; Define extern file macros first 0 define-macro-file langutl spell-rules-init 0 define-macro-file filetool file-tool-run file-tool-exec file-tool-exec-default 0 define-macro-file buffinit buffer-init buffer-init-fhook buffer-bind-create fhook-default 0 define-macro-file osd osd-main osd-find-buffer osd-dialog osd-xdialog osd-entry osd-close 0 define-macro-file utils frame-handle ascii-time var-str-sub str-to-regex filemask-to-regex copy-registry create-file-path define-macro-file format clean sort-lines-ignore-case normal-tab tabs-to-spaces paragraph-to-line delete-indentation restyle-region restyle-buffer ifill-paragraph indent-increase indent-decrease define-macro-file clearcs cc-state cc-update cc-checkout cc-checkin cc-add cc-diff cc-uncheckout cc-annotate cc-describe cc-delete cc-move cc-merge cc-vtree cc-explorer cc-add-view cc-setup define-macro-file cvs cvs cvs-setup cvs-add cvs-annotate cvs-checkout cvs-commit cvs-diff cvs-gdiff cvs-log cvs-remove cvs-resolve-conflicts cvs-state cvs-status cvs-tag cvs-update define-macro-file osdmisc insert-symbol buffer-setup alarm browse alias-path-setup file-type-setup file-tool-setup file-tool-menu shell-tool-setup find-setup define-macro-file tools compile which diff rdiff xdiff diff-changes execute-tool uniq find-bfile find-cfile reread-file reread-all save-kbd-macro define-macro-file misc save-all encase open-line check-line-length number-items time compare-windows-exact display-whitespaces write-region define-macro-file abbrev expand-abbrev-handle expand-iso-accents expand-look-back expand-word iso-accents-mode define-macro-file comment comment-line uncomment-line comment-to-end-of-line comment-start comment-restyle define-macro-file rect string-rectangle space-rectangle copy-rectangle yank-rectangle-overwrite define-macro-file majormod buffer-major-mode major-mode-setup major-mode-help major-mode-tool define-macro-file find find grep replace-string-in-files query-replace-string-in-files define-macro-file hkdirlst file-browser file-browser-close file-browser-swap-buffers define-macro-file charsutl charset-change charset-iso-to-user charset-user-to-iso define-macro-file toolbar toolbar toolbar-close toolbar-open toolbar-mode-line define-macro-file games cross-word Metris Patience Triangle Mahjongg Match-It define-macro-file spell spell-word spell-buffer spell-edit-word find-word define-macro-file narrow narrow-search-forward narrow-search-backward define-macro-file notes notes notes-file notes-instant notes-context define-macro-file password password-to-phonic insert-password define-macro-file itemlist item-list item-list-close occur define-macro-file mail mail mail-check stop-mail-check define-macro-file fileopen osd-file-open osd-get-file define-macro-file spellaut auto-spell auto-spell-menu define-macro-file hkinfo info info-on info-goto-link define-macro-file pagefile page-file page-bfile define-macro-file zfile find-zfile zfile-setup define-macro-file gentags generate-tags-file define-macro-file dmf display-matching-fence define-macro-file etfinsrt insert-template define-macro-file xfind xfind xgrep rgrep define-macro-file schemosd scheme-editor define-macro-file mouseosd context-menu define-macro-file printstp print-setup define-macro-file abbrlist abbrev-list define-macro-file fattrib file-attrib define-macro-file organize organizer define-macro-file userstp user-setup define-macro-file word describe-word define-macro-file vm vm mail-setup define-macro-file watch define-macro-file gdiff define-macro-file calc define-macro-file draw define-macro-file ftp ; More useful than execute-file - helps in fixing problems. 0 define-macro exec-file set-variable .first 1 !force @# execute-file @1 !if $status !return !endif !if .first !if &seq &set #l0 &find @1 ".emf" "ERROR" ml-write &spr "[Failed to find Macro file %s.emf]" @1 !else find-file #l0 !force execute-buffer $buffer-bname ml-write &spr "[Error found in Macro file %s, line %d]" #l0 $window-line !endif set-variable .first 0 !endif !abort !emacro ; set-variable %platform &cat $platform &cond &band $system 0x01 "c" "" set-variable $system &bor &band $system &bnot 0x30f000 &band 0x30f000 ® "/history/system" 0x007000 set-variable $system &bor &band $system &bnot 0x0e0414 &band 0x0e0414 ® &spr "/history/%s/system" %platform 0x040010 set-variable $mouse ® &spr "/history/%s/mouse" %platform $mouse set-variable $scroll ® &spr "/history/%s/scroll" %platform $scroll set-variable $show-modes ® "/history/show-modes" $show-modes set-variable $cursor-blink ® &spr "/history/%s/blink" %platform $cursor-blink ; setup the display scheme, char set, keyboard and language !force exec-file "scheme" !force exec-file "charset" !force exec-file "keyboard" !force exec-file "language" ; setup the displaying of fences set-variable #l0 ® &spr "/history/%s/fence" %platform "1" &cond &equ #l0 1 1 -1 global-mode "fence" !if &gre #l0 1 set-variable .display-matching-fence.dmf &lget "|0|37|45|61|" #l0 0 global-bind-key display-matching-fence "idle-pick" !endif ; key bindings 0x1 global-bind-key spell-word "esc $" global-bind-key frame-handle "C-x 5" global-bind-key find-zfile "C-x 7" 4 global-bind-key prefix "C-c" global-bind-key set-position "C-c C-a" global-bind-key goto-position "C-c a" global-bind-key grep "C-c g" global-bind-key describe-word "C-h w" global-bind-key open-line "C-o" ml-bind-key insert-newline "C-o" global-bind-key narrow-search-forward "C-c s" global-bind-key narrow-search-backward "C-c r" global-bind-key replace-string-in-files "A-C-r" global-bind-key query-replace-string-in-files "esc A-C-r" global-bind-key restyle-buffer "esc C-\\" 4 global-bind-key find-tag "esc C-t" global-bind-key major-mode-help "esc h" global-bind-key ifill-paragraph "esc q" global-bind-key delete-indentation "esc ^" 0xa0000 global-bind-key osd "esc =" global-bind-key context-menu "esc +" 0xa0000 global-bind-key osd "f1" global-bind-key context-menu "S-f1" global-bind-key browse "f3" global-bind-key diff-changes "f4" global-bind-key reread-file "f5" global-bind-key item-list "f6" 2 global-bind-key occur "S-f6" global-bind-key item-list-close "esc f6" global-bind-key spell-buffer "f7" 0 global-bind-key auto-spell "S-f7" global-bind-key auto-spell-menu "C-f7" global-bind-key notes "f8" global-bind-key notes-instant "S-f8" global-bind-key notes-context "C-f8" global-bind-key file-browser "f10" global-bind-key ftp "S-f10" 3 global-bind-key file-browser "C-f10" global-bind-key display-whitespaces "f11" global-bind-key toolbar "S-f11" global-bind-key expand-abbrev-handle "esc esc" ml-bind-key tab "esc esc" !if ® "/history/clearcase/rep-rcs" "0" 0 define-macro-file clearcs cc-coci global-bind-key cc-coci "C-x C-q" !endif ; if using MS friendly key bindings create them now !if ® "/history/mskeys" "0" global-bind-key beginning-of-line "home" global-bind-key beginning-of-buffer "C-home" global-bind-key end-of-line "end" global-bind-key end-of-buffer "C-end" !endif ; execute msshift if using MS Shift style region definition !if ® "/history/msshift" "0" !force exec-file "msshift" !endif ; ; Setup modes &cond ® "/history/backup" "1" 1 -1 global-mode "backup" &cond ® "/history/exact" "1" 1 -1 global-mode "exact" &cond ® "/history/magic" "1" 1 -1 global-mode "magic" &cond ® "/history/tab" "1" 1 -1 global-mode "tab" &cond ® "/history/undo" "1" 1 -1 global-mode "undo" &cond &gre &set #l0 ® "/history/autosv" "300" "0" 1 -1 global-mode "autosv" !if &gre #l0 "0" set-variable $auto-time #l0 !endif ; Setup variables set-variable $quiet ® "/history/quiet" "1" set-variable $mode-line "%s%r%u%k %b %l - %h:%m %Y/%M/%D (%e) - (%f) " set-variable $kept-versions ® &spr "/history/%s/kept-vers" $platform "0" set-variable $file-ignore ® &spr "/history/%s/file-ignore" $platform "" set-variable $scroll-bar ® &spr "/history/%s/scroll-bar" %platform "0" set-variable %tag-file "tags" set-variable %tag-template "%[^\t]\t%[^\t]\t%[^\n]\n" set-variable .osd.tmp 40 set-variable .osd.next &cond &exi .osd.next .osd.next &add .osd.tmp 1 set-variable .expand-iso-accents.on ® "/history/expaccent" "0" set-variable .expand-look-back.on ® "/history/explookbk" "1" set-variable .expand-word.on ® "/history/expword" "0" ; ; File hooks - reset the file hook list first 0 add-file-hook ; Add file extension hooks. Files loaded in binary mode do not need hook as fixed add-file-hook "*help* *about* .ehf" fhook-ehf add-file-hook "*bindings* *commands* *variables*" fhook-lists add-file-hook "*buffers*" fhook-blist add-file-hook "/ *files*" fhook-dirlst add-file-hook "*directory*" fhook-dirtre add-file-hook "*registry*" fhook-reg add-file-hook "*icommand* *shell*" fhook-ipipe add-file-hook ".emf" fhook-emf add-file-hook ".doc" fhook-doc add-file-hook ".txt" fhook-txt add-file-hook ".jst" fhook-jst add-file-hook ".tex .sty" fhook-latex add-file-hook ".bib" fhook-bibtex add-file-hook ".n .1 .2 .3 .4 .5 .6 .7 .8 .9 .so .tni .sm" fhook-nroff add-file-hook ".sgm .sgml" fhook-sgml add-file-hook ".c .h .def .i" fhook-c add-file-hook ".cc .cpp .hpp .rc" fhook-cpp add-file-hook ".l .y" fhook-yacc add-file-hook "Makefile makefile .mak .mk .gmk" fhook-make add-file-hook "Imakefile imakefile" fhook-imake add-file-hook "smb.conf" fhook-samba add-file-hook "httpd.conf" fhook-apache add-file-hook ".sh .ksh .csh .login .cshrc .profile .tcshrc" fhook-shell add-file-hook ".ini .hpj .reg .rgy" fhook-ini add-file-hook ".htm .html .htp .hts" fhook-html add-file-hook ".lhtm .lhtml" fhook-lhtml add-file-hook ".css" fhook-css add-file-hook ".bas .cls" fhook-vb add-file-hook ".asp" fhook-asp add-file-hook ".java .jav" fhook-java add-file-hook ".jsp" fhook-jsp add-file-hook ".js" fhook-js add-file-hook ".pl .pm" fhook-perl add-file-hook ".php .inc .php3 .php4 .phtml" fhook-php add-file-hook ".phps" fhook-phps add-file-hook ".cmd .bat .btm" fhook-dos add-file-hook ".tcl .tk" fhook-tcl add-file-hook ".rul" fhook-rul add-file-hook ".awk .nawk .gawk" fhook-awk add-file-hook ".ada .adb .ads" fhook-ada add-file-hook ".f .f77 .f90" fhook-f90 add-file-hook ".p .pas" fhook-pascal add-file-hook ".el" fhook-lisp add-file-hook ".vhdl .vhd" fhook-vhdl add-file-hook ".v" fhook-verilg add-file-hook ".fvwm .fvwm2rc" fhook-fvwm add-file-hook ".nsr" fhook-nsr add-file-hook ".erf" fhook-erf add-file-hook ".bnf" fhook-bnf add-file-hook ".sql" fhook-sql add-file-hook ".asn1" fhook-asn1 add-file-hook ".mhg .mhg5" fhook-mhg add-file-hook ".cbl" fhook-cobol add-file-hook ".x86" fhook-asmx86 add-file-hook ".py" fhook-python add-file-hook ".scm .sch" fhook-scheme add-file-hook ".mp .mf" fhook-meta add-file-hook ".m4" fhook-m4 add-file-hook ".texi" fhook-texi add-file-hook ".idl" fhook-idl add-file-hook ".info dir" fhook-info add-file-hook ".diff .dif *diff*" fhook-diff add-file-hook ".xml .xsl .xul" fhook-xml add-file-hook ".ex .exw .exu .e .ew .eu" fhook-euphor add-file-hook ".pls" fhook-pls add-file-hook ".lua" fhook-lua add-file-hook ".psf" fhook-psf add-file-hook ".spec" fhook-spec add-file-hook ".sl" fhook-slang add-file-hook ".au3" fhook-au3 add-file-hook ".mod" fhook-mod2 add-file-hook ".dot" fhook-dot add-file-hook ".rb" fhook-ruby add-file-hook ".r" fhook-r add-file-hook ".cfm .cfml .cfc" fhook-cfm add-file-hook ".iss" fhook-iss ; Add magic hooks 1 add-file-hook "^#![ \t]*/.*sh" fhook-shell ; UNIX shell files 1 add-file-hook "^#![ \t]*/.*perl" fhook-perl ; UNIX perl script 1 add-file-hook "^#![ \t]*/.*wish" fhook-tcl ; tcl, tk & tix files 1 add-file-hook "^#![ \t]*/.*awk" fhook-awk ; awk scripts 1 add-file-hook "^#![ \t]*/.*python" fhook-python ; Python file 1 add-file-hook "^#![ \t]*/.*ruby" fhook-ruby ; Ruby shell script 1 add-file-hook "^#![ \t]*/.*make" fhook-make ; Make script 4 add-file-hook "^[ \t]*exec[ \t]*\\(wish\\|tclsh\\)" fhook-tcl ; TCL shell script 1 add-file-hook "^#VRML" fhook-vrml ; VRML or wrl files 1 add-file-hook "^#Inventor" fhook-vrml ; Use the VRML hook for iv files -2 add-file-hook "This is Info file" fhook-info ; GNU info file -1 add-file-hook "<\\?xml" fhook-xml ; -1 add-file-hook "-[*!]-[ \t]*c.*-[*!]-" fhook-c ; -*- C -*- -1 add-file-hook "-[*!]-[ \t]*c\\+\\+.*-[*!]-" fhook-cpp ; -*- C++ -*- -1 add-file-hook "-[*!]-[ \t]*f.*-[*!]-" fhook-f90 ; -*- f -*- -1 add-file-hook "-[*!]-[ \t]*perl.*-[*!]-" fhook-perl ; -*- perl -*- -1 add-file-hook "-[*!]-[ \t]*texinfo.*-[*!]-" fhook-texi ; -*- texinfo -*- -1 add-file-hook "-[*!]-[ \t]*nroff.*-[*!]-" fhook-nroff ; -*- nroff -*- -1 add-file-hook "-[*!]-[ \t]*cobol.*-[*!]-" fhook-cobol ; -*- cobol -*- -1 add-file-hook "-[*!]-[ \t]*pl/?sq?l?.*-[*!]-" fhook-pls ; -*- pl/sql -*- or -*- pls -*- -1 add-file-hook "-[*!]-[ \t]*makefile.*-[*!]-" fhook-make ; -!- makefile -!- -1 add-file-hook "-[*!]-[ \t]*sh\\(ell\\)?.*-[*!]-" fhook-shell ; -!- shell -!- -1 add-file-hook "-[*!]-[ \t]*mode: wiki.*-[*!]-" fhook-wiki ; -*- mode: wiki -*- -1 add-file-hook "-[*!]-[ \t]*ruby.*-[*!]-" fhook-ruby ; -*- ruby -*- -1 add-file-hook "-!-[ \t]*mhg.*-!-" fhook-mhg ; -!- mhg -!- -1 add-file-hook "-!-[ \t]*msdos.*-!-" fhook-dos ; -!- msdos -!- -1 add-file-hook "-!-[ \t]*imakefile.*-!-" fhook-imake ; -!- imakefile -!- -1 add-file-hook "-!-[ \t]*document.*-!-" fhook-doc ; -!- document -!- -1 add-file-hook "-!-[ \t]*jst.*-!-" fhook-jst ; -!- jst -!- -1 add-file-hook "-[*!]-[ \t]*sgml.*-[*!]-" fhook-sgml ; -!- sgml -!- -1 add-file-hook "DTD DocBook" fhook-sgml -1 add-file-hook "-!-[ \t]*fvwm.*-!-" fhook-fvwm ; -!- fvwm -!- -1 add-file-hook "-!-[ \t]*emf.*-!-" fhook-emf ; -!- emf -!- -1 add-file-hook "-!-[ \t]*erf.*-!-" fhook-erf ; -!- erf -!- -1 add-file-hook "-!-[ \t]*asn\\.1.*-!-" fhook-asn1 ; -!- asn.1... -!- -1 add-file-hook "-!-[ \t]*asmx86.*-!-" fhook-asmx86 ; -!- asmx86 -!- -1 add-file-hook "-!-[ \t]*text.*-!-" fhook-txt ; -!- text -!- -1 add-file-hook "-!-[ \t]*msvb.*-!-" fhook-vb ; -!- msvb -!- -1 add-file-hook "^diff " fhook-diff ; diff -Naur file.c ... ; Initialize the top menu line osd 0 0 "asM" 0 0 -1 0 0 0 osd-main osd 0 10 "Mdfsh" " \HFile " 1 osd 0 20 "Mdfsh" " \HEdit " 2 osd 0 30 "Mdfsh" " \HSearch " 3 osd 0 40 "Mdfsh" " \HView " 4 osd 0 50 "Mdfsh" " Fo\Hrmat " 5 osd 0 60 "Mdfsh" " \HTools " 6 osd 0 70 "Mdfsh" " \HAdvanced " 7 osd 0 80 "Mdfsh" " \HWindow " 8 osd 0 90 "Mdfsr" " \HHelp " 9 !force osd -1 &set .osd.menu ® "/history/main-menu" "1" "1" ; Load in the mouse handling routines if required !if &band $mouse 0x10 !force exec-file "mouse" !endif 0 add-next-line "*grep*" add-next-line "*grep*" "%f:%l:" ; load in the platform specific stuff if found !force exec-file $platform ; execute any emulation file, e.g. Emacs etc !if ¬ &seq &set #l0 ® "/history/emulate" "" "" set-variable %emulate #l0 !force execute-file &cat "me" #l0 !endif ; load ftp/http registry file !if &seq &set #l0 ® "/history/url-file" "" "" !elif ¬ &seq &find #l0 ".erf" "ERROR" !force read-registry "/url" #l0 "y" !endif ; execute company setup !if ¬ &seq &set #l0 ® "/history/company" "" "" !force exec-file #l0 !endif ; excute own setup !if ¬ &seq &set #l0 ® "/history/setup-file" "" "" !force exec-file #l0 !endif !if ¬ &exi session !force exec-file session set-variable #l1 &bor &mul 16 &ban @# 1 &con &exi %session-name &con &seq %session-name "" 42 34 62 !force #l1 read-session !if &band #l1 12 !if &set #l0 ® &spr "/history/%s/frame-width" %platform "0" change-frame-width #l0 !endif !if &set #l0 ® &spr "/history/%s/frame-depth" %platform "0" change-frame-depth #l0 !endif !endif !else !force 0 change-scheme !endif ; setup the toolbar if not already done by the session !if .toolbar.open !elif &equ $frame-id .notes.frame-id !elif ® &spr "/history/%s/toolbar" %platform "0" toolbar-open !endif ; 4 popup-window ; Setup the Client Server !if &band $system 0x20000 define-macro-file meserver server-input find-buffer "*server*" set-variable :last-line 2 set-variable :client-list ":" set-variable $buffer-ipipe server-input beginning-of-buffer goto-alpha-mark "I" -1 find-buffer "*server*" !endif ; chaeck-mail setup - delay the first check by a minute to allow for ; initial setup to complete !if ® &spr "/history/%s/mail-check" $platform "0" 60000 create-callback mail-check !endif