Skip to content

Commit

Permalink
improved handling of abbreviations for R and Py, Esc Esc now should work
Browse files Browse the repository at this point in the history
  • Loading branch information
Detlef Groth committed Nov 18, 2024
1 parent 569ee4a commit 7986894
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion jasspa/macros/hkpython.emf
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ define-macro fhook-python
!emacro

; buffer-init variables
set-variable .fhook-python.setup &reg "/history/fhook/python" "fghiopx"
set-variable .fhook-python.setup &reg "/history/fhook/python" "bfghiopx"
set-variable .fhook-python.setup-mask "aefghikmnoptux"
set-variable .fhook-python.comment "|#||#|# | #|r|"

Expand Down
2 changes: 1 addition & 1 deletion jasspa/macros/hkr.emf
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ define-macro fhook-r

; buffer-init variables
set-variable .fhook-r.name "R/S-Plus"
set-variable .fhook-r.setup &reg "/history/fhook/r" "dfghopx"
set-variable .fhook-r.setup &reg "/history/fhook/r" "bdfghopx"
set-variable .fhook-r.setup-mask "adefghikmoptux"
set-variable .fhook-r.comment "|#||#|# | #|r|"
set-variable .fhook-r.collapse-open "^['a-zA-Z].+ function\\s* (.+"
Expand Down
16 changes: 10 additions & 6 deletions jasspa/macros/python.eaf
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
"" "</FOLD><FOLD+> \ecCControl Flow:\ecA"
def "def :\r\T"\"\"\"this is a docstring for a method\"\"\"\rpass\r\P" " def"
main "#!/usr/bin/env python3\r# -*- coding: ISO-8859-15 -*-\r\"\"\"\pModule docstring\"\"\"\r__author__ = \"first last\"\r__version__ = \"0.1\"\rimport sys, os, re\r\rdef usage(argv):\r\Tprint(f\"Usage: {argv[0]} args\")\r\r\Tprint(__doc__)\r\rdef main(argv):\r\Tif (len(argv)) == 1:\r\Tusage(argv)\r\rif __name__ == \"__main__\":\r\Tmain(sys.argv)\r\r\P" " main"
enc "# -*- coding: ISO-8859-\p -*-\r\P" " enc"
enc15 "# -*- coding: ISO-8859-15 -*-\r" " enc15"
enc1252 "# -*- coding: cp1252 -*-\r" " enc1252"
def "def \p:\r\T\"\"\"\"this is a docstring for a method\"\"\"\rpass\r\P" " def"
class "class \p:\r \"\"\"Docstring for the class\"\"\"\rdef __init__(self):\r\Tpass\r\P" " class"
classi "class \p (BaseClass):\r \"Docstring\"\rdef __init__(self,arg):\r super().__init__(arg)\r\P" " classi"
defm "def \p ():\r\T"\"\"\"this is a docstring for a method\"\"\"\rpass\r\P" " classdef public"
defm "def \p (self):\r\T"\"\"\"this is a docstring for a method\"\"\"\rpass\r\P" " classdef public"
defmp "def __\p__():\P" " classdef private"
doc "\"\"\"this is a docstring for a method\"\"\"
doc "\"\"\"this is a docstring for a method\"\"\" " doc(string)"
if "if \p:\P" " if"
ifelse "if \p:\r\relse:\r\P" " if else"
while "while (\p):\P" " while"
eli "elif \p:\P" " eli(f)"
els "else:\r\T" " els(e)"
whi "while (\p):\r\P" " whi(le)"
for "for \p in range(10):\P" " for"
iffile "if not os.path.isfile(\p):\P" " iffile"
openr "file = open(\p,'r')\rfor line in file:\r print(line)\rfile.close()\r\P" " openr"
openw "out = open(\p,'w')\rout.write('')\rout.close()\r\P" " openw"
tryex "try:\r # try code\r \p\rexcept ...Error:\r # except code\P" " try except"
tryfi "try:\r # try code\r \p\rfinally:\r # finally code\P" " try finally"
main "#!/usr/bin/env python3\r\"\"\"Module docstring\"\"\"\r__author__ = \"first last\"\r__version__ = \"0.1\"\rimport sys, os, re\r\rdef usage():\r\Tprint(\"Usage: app args\")\r\r\Tprint(__doc__)\r\rdef main(argv):\r\Tif (length(argv)) == 0:\r\Tusage()\r\rif __name__ == \"__main__\":\r\Tmain(sys.argv)\r\r" " main"
"" ""
"" "</FOLD><FOLD+> \ecCArgparse:\ecA "
argpn "parser = argparse.ArgumentParser(prog = '\p',\r\Tdescription=__doc__,\rformatter_class=argparse.RawTextHelpFormatter)\rargs=parser.parse_args(sys.argv[1:])\rprint(args)\r\P" " parser"
Expand Down

0 comments on commit 7986894

Please sign in to comment.