! Preferences file for NEdit ! (User settings in X "application defaults" format) ! ! This file is overwritten by the "Save Defaults..." command in NEdit ! and serves only the interactively settable options presented in the NEdit ! "Preferences" menu. To modify other options, such as key bindings, use ! the .Xdefaults file in your home directory (or the X resource ! specification method appropriate to your system). The contents of this ! file can be moved into an X resource file, but since resources in this file ! override their corresponding X resources, either this file should be ! deleted or individual resource lines in the file should be deleted for the ! moved lines to take effect. nedit.fileVersion: 5.5 nedit.shellCommands: \ Utilities>Spell::s:ED:\n\ (cat;echo "") | spell -b\n\ Utilities>Word count::w:ED:\n\ csh -fc 'set wc=`wc`; echo $wc[1] "lines," $wc[2] "words," $wc[3] "characters"'\n\ Utilities>Sort::o:EX:\n\ sort\n\ Make>make (plain)::m:W:\n\ make\n\ Make>make (csh -i)::m:W:\n\ csh -i -c 'set cdDirNames = ":"; alias addcd "echo \\$cwd"; if ( -r .cshcd) source .cshcd; if ( ! $?CC ) source `choose_cc`; make; :'\n\ Make>optimise (csh -i)::m:W:\n\ csh -i -c 'set cdDirNames = ":"; alias addcd "echo \\$cwd"; if ( -r .cshcd) source .cshcd; if ( ! $?CC ) source `choose_cc`; setenv CDEBUGFLAGS "-DNDEBUG -O"; setenv LDEBUGFLAGS ""; make; :'\n\ Make>debug (csh -i)::m:W:\n\ csh -i -c 'set cdDirNames = ":"; alias addcd "echo \\$cwd"; if ( -r .cshcd) source .cshcd; if ( ! $?CC ) source `choose_cc`; setenv CDEBUGFLAGS "-gyz"; setenv LDEBUGFLAGS "-gyz"; make; :'\n\ Make>target (csh -i)::m:IW:\n\ csh -i -c 'set cdDirNames = ":"; alias addcd "echo \\$cwd"; if ( -r .cshcd) source .cshcd; if ( ! $?CC ) source `choose_cc`; make `cat` ; :' 2>&1\n\ Make>target optimise (csh -i)::m:IW:\n\ csh -i -c 'set cdDirNames = ":"; alias addcd "echo \\$cwd"; if ( -r .cshcd) source .cshcd; if ( ! $?CC ) source `choose_cc`; setenv CDEBUGFLAGS "-DNDEBUG -O"; setenv LDEBUGFLAGS ""; make `cat` ; :' 2>&1\n\ Make>target debug (csh -i)::m:IW:\n\ csh -i -c 'set cdDirNames = ":"; alias addcd "echo \\$cwd"; if ( -r .cshcd) source .cshcd; if ( ! $?CC ) source `choose_cc`; setenv CDEBUGFLAGS "-gyz"; setenv LDEBUGFLAGS "-gyz"; make `cat` ; :' 2>&1\n\ Tabs>detab:Shift+Ctrl+Alt+I::EX:\n\ detab\n\ Tabs>retab:Shift+Ctrl+I::EX:\n\ retab\n\ C/C++ Prog>Box comment@C:Shift+Ctrl+B::EX:\n\ boxcomment|retab\n\ C/C++ Prog>Strip comment@C:::IX:\n\ sed -e 's./\\\\*. .' -e 's.\\\\*/. .' -e 's.//. .'\n\ File>Find in files>Find all and open@C:Shift+Ctrl+Alt+F::ID:\n\ f="`cat`"; nedits -noask -do "find(\\"$f\\")" `grep -F -l "$f" ./*.[ch]`\n\ File>Find in files>Find all and open@C++:Shift+Ctrl+Alt+F::ID:\n\ f="`cat`"; nedits -noask -do "find(\\"$f\\")" `grep -F -l "$f" ./*.[CHch]*`\n\ File>Find in files>Find all@C:Shift+Alt+F::IW:\n\ grep -F -n -e "`cat`" [a-zA-Z]*.[ch]\n\ File>Find in files>Find all@C++:Shift+Alt+F::IW:\n\ grep -F -n -e "`cat`" [a-zA-Z]*.[chCH]*\n\ File>Find in files>Find all@*:Shift+Alt+F::IW:\n\ grep -F -n -e "`cat`" *\n\ File>Find in files>Open found:::ID:\n\ f="`(cat; echo "")|cut -f1,2 -d:`"; fl=`echo "$f"|cut -f1 -d:`; li=`echo "$f"|cut -f2 -d:`; nedits -noask -line $li $fl\n\ File>chmod u+w:::DL:\n\ chmod u+w %\n\ File>chmod u-w:::DL:\n\ chmod u-w %\n\ File>save & chmod u-w:::DSL:\n\ chmod u-w %\n\ Windows Explorer::w::\n\ (echo start explorer . | cmd) < /dev/null > /dev/null 2>&1 &\n nedit.macroCommands: \ Files>List files:::: {\n\ NEDIT_require_macro_file("extensions.nm")\n\ \n\ #define list_all_files\n\ # {\n\ byName = "name"\n\ byPath = "path"\n\ byOpen = "open order (last first)"\n\ \n\ file = ""\n\ nsort = byName\n\ \n\ # count files\n\ nFile = 0\n\ for (file = focus_window("last"); file != ""; file = focus_window("next"))\n\ nFile++\n\ \n\ while (file == "")\n\ {\n\ list = ""\n\ sort = nsort\n\ current = $file_path $file_name\n\ \n\ files = $empty_array\n\ \n\ # add files into array with keys in the selected sort order\n\ if (nsort == byName)\n\ {\n\ for (file = focus_window("last"); file != ""; file = focus_window("next"))\n\ files[$file_name " - " $file_path] = file\n\ nsort = byPath\n\ }\n\ else if (nsort == byPath)\n\ {\n\ for (file = focus_window("last"); file != ""; file = focus_window("next"))\n\ files[$file_path $file_name] = file\n\ nsort = byOpen\n\ }\n\ else if (nsort == byOpen)\n\ {\n\ i = 0\n\ for (file = focus_window("last"); file != ""; file = focus_window("next"))\n\ files[rjust(i++ + 1, nFile) ": " file] = file\n\ nsort = byName\n\ }\n\ \n\ for (file in files)\n\ list = list file "\\n"\n\ \n\ focus_window(current)\n\ \n\ file = list_dialog(nFile " files sorted by "sort"\\nRaise which file?", \\\n\ list, "OK", "Sort by "nsort, "Cancel")\n\ button = $list_dialog_button\n\ if (file != "" && button == 1)\n\ break\n\ else if (button != 2)\n\ break\n\ }\n\ if (file != "")\n\ {\n\ open(files[file])\n\ focus_window(files[file])\n\ raise_window(files[file])\n\ }\n\ # }\n\ }\n\ Files>Open multiple files:Shift+Ctrl+O::: {\n\ NEDIT_require_macro_file("extensions.nm")\n\ NEDIT_require_macro_file("array_utils.nm")\n\ NEDIT_require_macro_file("cygwin.nm")\n\ \n\ $OpenMultipleFiles[""] = 0\n\ \n\ Title = "Open multiple files\\n"\n\ T = Title\n\ E = "" # error\n\ \n\ lsmatch = ""\n\ lsopts = ""\n\ if ("lsopts" in $OpenMultipleFiles)\n\ lsopts = $OpenMultipleFiles["lsopts"]\n\ if ("lsmatch" in $OpenMultipleFiles)\n\ lsmatch = $OpenMultipleFiles["lsmatch"]\n\ \n\ openmodes = make_array("New Windows", make_arraylist1("window", "window"), \\\n\ "New Group", make_arraylist1("window", "tab"), \\\n\ "This Group", make_arraylist1("tab", "tab"))\n\ \n\ buttons = make_arraylist1("New Windows", "New Group", "This Group", \\\n\ "Options", "Filter", "Set Path", "Up", "Back")\n\ dbuttons = make_arraylist1("Enter", "Options", "Filter", "Set Path", \\\n\ "Up", "Back")\n\ opt = $empty_array\n\ \n\ ocwd = $empty_array\n\ cwd = $file_path\n\ oldwindow = $file_path $file_name\n\ \n\ if (cwd == "")\n\ {\n\ # remove any trailing / (only at root level?) from pwd result\n\ cwd = chomp(shell_command("pwd", ""), "/?\\n")\n\ if ($shell_cmd_status != 0)\n\ cwd = ""\n\ else # now add a trailing / (again)\n\ cwd = cwd "/"\n\ }\n\ \n\ if (cwd == "")\n\ return dialog(T "Could not determine current directory", "Dismiss")\n\ \n\ find_d = "find . -type d '!' -name . -print -prune | sort"\n\ find_f = "find . -type d '!' -name . -prune -o -type f -print"\n\ \n\ # ==============================================================================\n\ \n\ for (;;) # until happy\n\ {\n\ T = Title "In directory " cwd "\\n"\n\ if (ocwd[])\n\ T = T "(previous directory " ocwd[ocwd[] - 1] ", ["ocwd[]"])\\n\\n"\n\ if (E != "")\n\ E = "\\nERROR: " E "\\n\\n"\n\ \n\ cwds = quote_literal_for_shell_esc(cwd)\n\ aa = " && "\n\ cd_cwd = "cd " cwds aa\n\ echo = aa "echo '///'" aa # the /// will separate output from commands\n\ \n\ dirns = ""\n\ files = ""\n\ ls = ""\n\ # call ls, find dirns and find files\n\ cmd = cd_cwd "ls " lsopts lsmatch\n\ out = shell_command(cmd echo find_d echo find_f, "")\n\ if ($shell_cmd_status != 0)\n\ {\n\ # the ls command failed: execute the command again, picking up only stderr\n\ # (assumes find always works)\n\ EE = "FAILED " cmd "\\n" chomp(shell_command(cmd "> /dev/null", ""), "\\n+")\n\ }\n\ else\n\ {\n\ # save options/match-filters for next time\n\ $OpenMultipleFiles["lsopts"] = lsopts\n\ $OpenMultipleFiles["lsmatch"] = lsmatch\n\ # get the lists of plain files and directories directories\n\ pieces = split(out, "///\\n")\n\ ls = pieces[0]\n\ dirns = "\\n" replace_in_string(pieces[1], "^\\\\./(.*)$", "\\\\1/", "regex")\n\ files = "\\n" replace_in_string(pieces[2], "./", "")\n\ \n\ if ($shell_cmd_status != 0)\n\ {\n\ ls = ""\n\ }\n\ }\n\ \n\ list = ""\n\ n_files = 0\n\ end = 0\n\ for (pos = search_string(ls, "^.+\\n", end, "regex"); \\\n\ pos >= 0; \\\n\ pos = search_string(ls, "^.+\\n", end, "regex"))\n\ {\n\ end = $search_end # keep ending \\n\n\ filename = substring(ls, pos, end)\n\ \n\ if (search_string(files, "\\n" filename, 0, "case") < 0)\n\ continue # skip: not a plain file\n\ else if (substring(filename, 0, 1) == "~" && \\\n\ search_string(lsopts, " ?-A ", 0, "regex") < 0)\n\ continue # skip: this is (probably) a NEdit backup file\n\ # however, show it if we're looking for all files\n\ \n\ list = list filename\n\ ++n_files\n\ }\n\ list = chomp(dirns list)\n\ \n\ # we have our list of files\n\ if (list == "")\n\ {\n\ E = "No files or directories found in directory " cwd "\\n"\n\ F = "[command ' ls " lsopts lsmatch "' found " n_files " files]\\n"\n\ \n\ i = ocwd[] - 1\n\ if (i < 0) # nowhere to go back to\n\ {\n\ if (first_time)\n\ {\n\ res = dialog(T "\\nERROR: " E F, "Dismiss", "Clear filter")\n\ if (res < 2)\n\ return\n\ else\n\ {\n\ lsmatch = ""\n\ $OpenMultipleFiles["lsmatch"] = lsmatch\n\ continue\n\ }\n\ }\n\ else\n\ return dialog(T "\\nERROR: " E F, "Dismiss")\n\ }\n\ newcwd = ocwd[i]\n\ E = E "\\nReturning from directory " cwd\n\ E = E "\\nto directory " newcwd\n\ cwd = newcwd\n\ delete ocwd[i]\n\ continue\n\ }\n\ \n\ # ask for filenames ----------------------------------------------------------\n\ F = "[command ' ls " lsopts lsmatch "' found " n_files " files]\\n"\n\ if (n_files == 0)\n\ {\n\ # ask for a single directory\n\ res = list_dialog(T E F "Select a directory to enter", \\\n\ list, \\\n\ dbuttons[1], dbuttons[2], dbuttons[3], \\\n\ dbuttons[4], dbuttons[5], dbuttons[6], \\\n\ "Cancel")\n\ if (!($list_dialog_button in dbuttons))\n\ return\n\ sbtn = dbuttons[$list_dialog_button]\n\ }\n\ else\n\ {\n\ if (ocwd[] == 0)\n\ res = list_multisel_dialog(T E F "Select files or a single directory", \\\n\ list, \\\n\ buttons[1], buttons[2], buttons[3], \\\n\ buttons[4], buttons[5], buttons[6], \\\n\ buttons[7], "Cancel")\n\ else\n\ res = list_multisel_dialog(T E F "Select files or a single directory", \\\n\ list, \\\n\ buttons[1], buttons[2], buttons[3], \\\n\ buttons[4], buttons[5], buttons[6], \\\n\ buttons[7], buttons[8], "Cancel")\n\ limit = buttons[] - (ocwd[] == 0)\n\ if ($list_dialog_button > limit || !($list_dialog_button in buttons))\n\ return\n\ sbtn = buttons[$list_dialog_button]\n\ }\n\ \n\ # now what?\n\ E = ""\n\ isdir = 0\n\ if (sbtn in openmodes) # -----------------------------------------------------\n\ {\n\ if (res == "")\n\ E = "No files selected"\n\ isdir = (search_string(res, "/", 0) >= 0)\n\ if (isdir && search_string(res, "\\n", 0) > 0)\n\ E = "Cannot include directories in mutiple selections"\n\ if (E != "")\n\ continue\n\ \n\ if (isdir)\n\ {\n\ ocwd[ocwd[]] = cwd\n\ cwd = cwd res\n\ continue\n\ }\n\ \n\ openmode = openmodes[sbtn]\n\ newopt = 1\n\ \n\ filenames = split(res, "\\n")\n\ for (i = 0; i in filenames; ++i)\n\ {\n\ filename = filenames[i]\n\ EE = ""\n\ if (focus_window(cwd filename) != "")\n\ {\n\ EE = "\\n file already opened: " filenames[i]\n\ }\n\ else\n\ {\n\ read_file(cwd filename)\n\ if ($read_status)\n\ {\n\ new(openmode[newopt])\n\ if (newopt < openmode[])\n\ ++newopt\n\ focus_window("last")\n\ open(cwd filename)\n\ }\n\ else\n\ EE = "\\n failed to open " filenames[i]\n\ }\n\ E = E EE\n\ }\n\ focus_window(oldwindow)\n\ raise_window()\n\ }\n\ else if (sbtn == "Enter") # --------------------------------------------------\n\ {\n\ if (res == "")\n\ E = "No directory selected"\n\ else\n\ {\n\ ocwd[ocwd[]] = cwd\n\ cwd = cwd res\n\ }\n\ }\n\ else if (sbtn == "Set Path") # -----------------------------------------------\n\ {\n\ # pick up selection, clipboard etc\n\ clip = clipboard_to_string()\n\ sel = get_selection("any")\n\ \n\ prompt = T "Enter new directory path"\n\ i = 0\n\ \n\ name = "Cancel"\n\ btns[i++] = name\n\ val[name] = ""\n\ \n\ btns[i++] = "OK"\n\ \n\ if (clip != "")\n\ {\n\ prompt = prompt "\\n clipboard: '" clip "'"\n\ name = "Clipboard"\n\ btns[i++] = name\n\ val[name] = clip\n\ }\n\ \n\ if (sel != "")\n\ {\n\ prompt = prompt "\\n selection: '" sel "'"\n\ name = "Selection"\n\ btns[i++] = name\n\ val[name] = sel\n\ }\n\ btns[i++] = btns[0]\n\ \n\ if (i == 3)\n\ str = string_dialog(prompt, btns[1], btns[2])\n\ else if (i == 4)\n\ str = string_dialog(prompt, btns[1], btns[2], btns[3])\n\ else if (i == 5)\n\ str = string_dialog(prompt, btns[1], btns[2], btns[3], btns[4])\n\ \n\ val["OK"] = str\n\ choice = btns[$string_dialog_button]\n\ str = val[choice]\n\ if (str == "")\n\ continue\n\ \n\ newcwd = str\n\ if (Cygwin_isCygwin())\n\ {\n\ if (search_string(str, "/", 0) < 0 || \\\n\ search_string(str, "^\\\\l:[\\\\\\\\/]", 0, "regex") >= 0)\n\ {\n\ # no "/"s or starts with eg "c:\\" - may be a Windows/DOS path\n\ str = Cygwin_convertDOSpath(str)\n\ if (str != "")\n\ newcwd = str\n\ }\n\ }\n\ str = newcwd\n\ newcwd = quote_literal_for_shell_esc(newcwd)\n\ newcwd = chomp(shell_command("cd " newcwd " && pwd", ""), "/?\\n")\n\ if ($shell_cmd_status != 0)\n\ newcwd = ""\n\ else # now add a trailing / (again)\n\ newcwd = newcwd "/"\n\ if (newcwd == "")\n\ E = "Could not move to directory " str\n\ else if (newcwd != cwd)\n\ {\n\ ocwd[ocwd[]] = cwd\n\ cwd = newcwd\n\ }\n\ }\n\ else if (sbtn == "Up") # -----------------------------------------------------\n\ {\n\ newcwd = quote_literal_for_shell_esc(cwd)\n\ newcwd = chomp(shell_command("cd " newcwd ".. && pwd", ""), "/?\\n")\n\ if ($shell_cmd_status != 0)\n\ newcwd = ""\n\ else # now add a trailing / (again)\n\ newcwd = newcwd "/"\n\ if (newcwd == "")\n\ E = "Could not move up to parent directory of " cwd\n\ else if (newcwd != cwd)\n\ {\n\ ocwd[ocwd[]] = cwd\n\ cwd = newcwd\n\ }\n\ }\n\ else if (sbtn == "Back") # ---------------------------------------------------\n\ {\n\ i = ocwd[] - 1\n\ if (i < 0) # nowhere to go back to\n\ return dialog(T "\\nERROR: Invalid Back button: check macro code", \\\n\ "Dismiss")\n\ cwd = ocwd[i]\n\ delete ocwd[i]\n\ }\n\ else if (sbtn == "Options") # ------------------------------------------------\n\ {\n\ if (!opt[])\n\ {\n\ opt["Show hidden files"] = make_array("", "Off", \\\n\ "On", "-A ", \\\n\ "Off", "")\n\ opt["Reverse Sort"] = make_array("", "Off", \\\n\ "On", "-r ", \\\n\ "Off", "")\n\ opt["Sort"] = make_array("", "alphabetically", \\\n\ "alphabetically", "", \\\n\ "by extension", "-X ", \\\n\ "by size", "-S ", \\\n\ "by time (access)", "-u ", \\\n\ "by time (modification)", "-t ")\n\ }\n\ # build the list of allowed options, marking selected ones with >>\n\ optslist = ""\n\ EE = ""\n\ for (anopt in opt)\n\ {\n\ partlist = ""\n\ thename = opt[anopt][""]\n\ thepart = anopt ": " thename\n\ for (aname in opt[anopt])\n\ {\n\ if (aname == "")\n\ continue\n\ apart = anopt ": " aname\n\ partlist = partlist " " apart "\\n"\n\ if (search_string(lsopts, opt[anopt][aname], 0) >= 0)\n\ {\n\ thename = aname\n\ thepart = apart\n\ }\n\ }\n\ partlist = replace_in_string(partlist, " " thepart, \\\n\ ">> " thepart, "case")\n\ optslist = optslist partlist\n\ }\n\ # get new ones\n\ newlist = list_multisel_dialog("Choose file list options,\\n" \\\n\ "no more than one per group", \\\n\ optslist) "\\n"\n\ newopts = ""\n\ for (anopt in opt)\n\ {\n\ re_opt = "^(?!.. " anopt ": ).*\\\\n"\n\ re_old = "^(?!\\\\>\\\\> " anopt ": ).*\\\\n"\n\ grepped = replace_in_string(newlist, re_opt, "", "regex", "copy")\n\ nGrepped = length(replace_in_string(grepped, "[^\\n]*", "", "regex"))\n\ if (nGrepped > 1)\n\ EE = EE "\\n - more than one option selected for " anopt\n\ if (nGrepped != 1) # use previous instance, marked with >>\n\ {\n\ grepped = replace_in_string(optslist, re_old, "", "regex", "copy")\n\ }\n\ # get option value name, at end of the line\n\ grepped = replace_in_string(grepped, "^.*: (.*)\\n", "\\\\1", "regex")\n\ value = opt[anopt][grepped]\n\ newopts = newopts value\n\ }\n\ \n\ if (EE == "")\n\ lsopts = newopts\n\ else\n\ E = "Failed to change list options:" EE\n\ }\n\ else if (sbtn == "Filter") # -------------------------------------------------\n\ {\n\ EE = ""\n\ for (;;)\n\ {\n\ M = T\n\ if (lsmatch != "")\n\ M = T "Current filter: " lsmatch "\\n"\n\ newmatch = string_dialog(M EE "Enter file patterns to match", \\\n\ "OK", "Clear", "Cancel")\n\ btn = $string_dialog_button\n\ if (btn == 1)\n\ {\n\ if (newmatch == "")\n\ break\n\ newmatch = newmatch " "\n\ if (search_string(newmatch, "[;$`'\\"~&|\\x01-\\x1F]", 0, "regex") >= 0)\n\ {\n\ EE = "Requested matches contain invalid characters\\n"\n\ }\n\ else\n\ {\n\ str = shell_command("exec sh", "for i in " newmatch "; do :; done")\n\ if ($shell_cmd_status == 0 && str == "")\n\ {\n\ # looks OK\n\ lsmatch = newmatch\n\ break\n\ }\n\ EE = "Cannot use given patterns\\nShell replies:\\n" str "\\n"\n\ }\n\ }\n\ else if (btn == 2)\n\ {\n\ lsmatch = ""\n\ break\n\ }\n\ else\n\ break\n\ }\n\ }\n\ else # -----------------------------------------------------------------------\n\ {\n\ E = sbtn " not implemented"\n\ }\n\ }\n\ }\n\ Files>Open selected files:::: {\n\ # Open a whitespace separated list of files\n\ res = get_selection("any")\n\ cwd = $file_path\n\ \n\ newgroup = ""\n\ E = ""\n\ oldwindow = $file_path $file_name\n\ \n\ filenames = split(res, "(?n\\\\s)", "regex")\n\ for (i = 0; i in filenames; ++i)\n\ {\n\ filename = filenames[i]\n\ if (filename == "")\n\ continue\n\ if (substring(filename, 0, 1) != "/")\n\ filename = cwd filename\n\ EE = ""\n\ if (focus_window(filename) != "")\n\ {\n\ EE = "\\n file already opened: " filenames[i]\n\ }\n\ else\n\ {\n\ read_file(filename)\n\ if ($read_status)\n\ {\n\ if (newgroup != "")\n\ {\n\ focus_window(newgroup)\n\ new("tab")\n\ }\n\ else\n\ new("window")\n\ focus_window("last")\n\ open(cwd filename)\n\ newgroup = focus_window("last")\n\ }\n\ else\n\ EE = "\\n failed to open " filenames[i]\n\ }\n\ E = E EE\n\ }\n\ focus_window(oldwindow)\n\ raise_window()\n\ \n\ if (E != "")\n\ list_dialog("Errors", E, "Dismiss")\n\ }\n\ Files>Save all files:Shift+Ctrl+S::: {\n\ NEDIT_require_macro_file("SaveAllFiles.nm")\n\ \n\ SaveAllFiles()\n\ }\n\ Files>Save all files as [format]:::: {\n\ NEDIT_require_macro_file("SaveAllFiles.nm")\n\ \n\ fmt = list_dialog("Save all files with which format?", \\\n\ "unix\\ndos\\nmacintosh", \\\n\ "Save and Tidy", "Save", "Cancel")\n\ btn = $list_dialog_button\n\ if (1 <= btn && btn <= 2 && fmt != "")\n\ {\n\ if (btn == 1)\n\ SaveAllFilesAsFormat(fmt, 1)\n\ else # (btn == 2)\n\ SaveAllFilesAsFormat(fmt, 0)\n\ }\n\ }\n\ Files>Close file (no save):Shift+Ctrl+W::: {\n\ close("nosave")\n\ }\n\ Files>!! Delete this file (no save) !!:Shift+Ctrl+W::: {\n\ NEDIT_require_macro_file("extensions.nm")\n\ \n\ f = $file_path $file_name\n\ cmd = "rm " quote_literal_for_shell_esc(f)\n\ res = shell_command(cmd, "")\n\ \n\ ok = dialog("Are you sure you want to remove current file\\n " f, "No", "Yes")\n\ if (ok != 2)\n\ return\n\ \n\ if ($shell_cmd_status != 0)\n\ s = "FAILED:\\n " cmd\n\ else\n\ s = "SUCCEEDED:\\n " cmd\n\ if (res != "")\n\ s = s "\\nreturned:\\n" replace_in_string(res, "^", " ", "regex")\n\ \n\ dialog(s)\n\ }\n\ Files>Write document to a new file:::: {\n\ # macro to write text directly to a file (rather than using save-as)\n\ \n\ # what to save: everything or just the selection (if any)\n\ type = "document text"\n\ if ($selection_start >= 0)\n\ {\n\ extract = get_selection()\n\ btn = dialog("Save the whole document or just the selection?", \\\n\ "All", "Selection")\n\ if (btn == 1)\n\ extract = get_range(0, $text_length)\n\ else if (btn == 2)\n\ type = "selection"\n\ else\n\ return\n\ }\n\ else\n\ extract = get_range(0, $text_length)\n\ \n\ # choose a file name - type it directly or use a file dialog\n\ fname = string_dialog("Save " type " to new file name\\nEnter file name", \\\n\ "OK", "Open Tab", "Open Window", "File dialog", "Cancel")\n\ btn = $string_dialog_button\n\ if (btn == 0 || btn > 4)\n\ return\n\ if (btn == 4)\n\ {\n\ fname = filename_dialog("Save " type " to new file name", \\\n\ "new", $file_path, "*", $file_name)\n\ }\n\ if (fname == "" || fname == $file_name || fname == ($file_path $file_name))\n\ return dialog("No new name entered: nothing written\\n"\\\n\ "Use standard File->Save", "Dismiss")\n\ \n\ # check the file name - does it have a path?\n\ if (search_string(fname, "/", 0) != 0)\n\ fname = $file_path fname\n\ search_string(fname, ".*/", 0, "regex")\n\ if ($search_end >= 1)\n\ fpath = substring(fname, 0, $search_end)\n\ else\n\ fpath = ""\n\ \n\ fname = substring(fname, length(fpath))\n\ fnew = fpath fname\n\ \n\ # does a file with that path already exist?\n\ read_file(fnew)\n\ r_ok = $read_status\n\ if (r_ok)\n\ {\n\ over = dialog("File " fnew " exists\\nDo you wish to overwrite it?", \\\n\ "Yes", "No")\n\ if (over != 1)\n\ return\n\ }\n\ \n\ # can we actually write to that file?\n\ test_wr = "cd '" fpath "' && touch '" fnew "' && cp /dev/null '" fnew "'"\n\ s = shell_command(test_wr, "")\n\ if ($shell_cmd_status != 0)\n\ return dialog("Error: " s)\n\ \n\ # right - write out the file\n\ w_ok = write_file(extract, fnew)\n\ if (!w_ok)\n\ return dialog("Failed to write document to file " fnew, "Dismiss")\n\ \n\ # do we reopen the file just written?\n\ if (btn == 4) # file_dialog used earlier didn't provide all buttons: ask again\n\ {\n\ btn = dialog("Open file " fnew " as a new document?", \\\n\ "No", "Open Tab", "Open Window")\n\ }\n\ if (btn < 2 || 3 < btn)\n\ return\n\ \n\ # open a window with that file\n\ win = focus_window(fnew)\n\ if (win == "")\n\ {\n\ if (btn == 2) # open tab\n\ new("tab")\n\ else # btn == 3\n\ new("window")\n\ nwin = focus_window("last")\n\ open(fnew)\n\ win = focus_window("last")\n\ if (nwin == focus_window(nwin))\n\ {\n\ # file was already open with a different path: close our new window\n\ close("nosave")\n\ focus_window(win)\n\ }\n\ }\n\ }\n\ Files>CYGWIN - DOS to Cygwin path convert:::: {\n\ NEDIT_require_macro_file("cygwin.nm")\n\ \n\ Cygwin_convertDOSpathDialog()\n\ }\n\ Files>CYGWIN - Launch MS Windows Explorer:::: {\n\ NEDIT_require_macro_file("cygwin.nm")\n\ \n\ Cygwin_launchWindowsExplorer()\n\ }\n\ Files>KDE - Launch Konqueror:::: {\n\ shell_command("/dev/null 2>/dev/null konqueror . &", "")\n\ }\n\ Files>Complete File Name:Shift+Alt+D::: {\n\ # Complete file name\n\ NEDIT_require_macro_file("extensions.nm")\n\ NEDIT_require_macro_file("SelectArray.nm")\n\ \n\ # previous search results\n\ $CompleteFileName[""] = 0\n\ old = $CompleteFileName\n\ \n\ sel = makeSelectArray()\n\ beg = sel.beg\n\ if (beg == sel.cursor)\n\ beg = search("(?<=^|\\\\s)\\\\S", sel.beg - 1, "regex", "backward")\n\ \n\ end = sel.cursor\n\ fin = sel.fin\n\ str = get_range(beg, fin)\n\ \n\ if (end < fin && substring(str, -1) == "/")\n\ str = substring(str, 0, -1)\n\ path = replace_in_string(str, "(?n(.*/)).*", "\\\\1", "regex")\n\ file = substring(str, length(path))\n\ pref = substring(str, length(path), end - beg)\n\ \n\ if (!("path" in old) || (old.path != path))\n\ {\n\ qpath = quote_literal_for_shell_esc(path)\n\ res = shell_command("ls -A " qpath, "")\n\ list = split(res, "\\n")\n\ if ($shell_cmd_status != 0)\n\ {\n\ beep()\n\ return\n\ }\n\ res = shell_command("ls -AF " qpath, "")\n\ flist = split(res, "\\n")\n\ \n\ old.path = path\n\ old.list = list\n\ old.flist = flist\n\ old.last = file\n\ old.pref = pref\n\ last = file\n\ }\n\ else\n\ {\n\ list = old.list\n\ flist = old.flist\n\ last = old.last\n\ }\n\ \n\ nlist = list[]\n\ len = length(pref)\n\ p1 = -1\n\ i = -1\n\ if (pref == old.pref) # find the next file in the sequence\n\ {\n\ for (i = 0; i < nlist; i++)\n\ {\n\ if (p1 < 0 && pref == substring(list[i], 0, len))\n\ p1 = i\n\ if (list[i] == last)\n\ {\n\ ++i\n\ break\n\ }\n\ }\n\ }\n\ else # find the first file that matches the prefix\n\ {\n\ for (i = 0; i < nlist; i++)\n\ {\n\ if (pref == substring(list[i], 0, len))\n\ {\n\ p1 = i\n\ break\n\ }\n\ }\n\ }\n\ \n\ if (i < 0)\n\ {\n\ beep()\n\ return\n\ }\n\ \n\ # do we go from last candidate to first?\n\ if (i == nlist || pref != substring(list[i], 0, len))\n\ i = max(p1, 0)\n\ \n\ # do we have a match at all?\n\ if (pref != substring(list[i], 0, len))\n\ {\n\ beep()\n\ return\n\ }\n\ \n\ # OK: looks good - modify the area and select it\n\ nfile = list[i]\n\ if (substring(flist[i], -1) == "/")\n\ nfile = nfile "/"\n\ old.pref = pref\n\ old.last = list[i]\n\ \n\ repl = path nfile\n\ replace_range(beg, fin, repl)\n\ set_cursor_pos(sel.cursor)\n\ select(beg, beg + length(repl))\n\ \n\ $CompleteFileName = old\n\ \n\ return\n\ }\n\ Complete Word@*:Alt+D::: {\n\ # This macro attempts to complete the current word by\n\ # finding another word in the same document that has\n\ # the same prefix; repeated invocations of the macro\n\ # (by repeated typing of its accelerator, say) cycles\n\ # through the alternatives found.\n\ # \n\ # This version avoids the need of initializing the global\n\ # variable in an external macro file\n\ $compWord[""] = ""\n\ \n\ if (!("wordEnd" in $compWord)) {\n\ $compWord["wordEnd"] = 0\n\ $compWord["repeat"] = 0\n\ $compWord["init"] = 0\n\ $compWord["wordStart"] = 0\n\ }\n\ \n\ if ($compWord["wordEnd"] == $cursor) {\n\ $compWord["repeat"] += 1\n\ }\n\ else {\n\ $compWord["repeat"] = 1\n\ $compWord["init"] = $cursor\n\ \n\ # search back to a word boundary to find the word to complete\n\ $compWord["wordStart"] = search("<\\\\w+", $cursor, "backward", \\\n\ "regex", "wrap")\n\ \n\ if ($compWord["wordStart"] == -1)\n\ return\n\ \n\ if ($search_end == $cursor)\n\ $compWord["word"] = get_range($compWord["wordStart"], $cursor)\n\ else\n\ return\n\ }\n\ s = $cursor\n\ for (i=0; i <= $compWord["repeat"]; i++) {\n\ if (!("word" in $compWord))\n\ break\n\ s = search($compWord["word"], s - 1, "backward","regex","wrap")\n\ }\n\ \n\ if (s == $compWord["wordStart"]) {\n\ beep()\n\ $compWord["repeat"] = 0\n\ s = $compWord["wordStart"]\n\ se = $compWord["init"]\n\ }\n\ else\n\ se = search(">", s, "regex")\n\ \n\ replace_range($compWord["wordStart"], $cursor, get_range(s, se))\n\ \n\ $compWord["wordEnd"] = $cursor\n\ }\n\ Complete Word@XML@SGML HTML:Alt+D::: {\n\ # This macro attempts to complete the current word by\n\ # finding another word in the same document that has\n\ # the same prefix; repeated invocations of the macro\n\ # (by repeated typing of its accelerator, say) cycles\n\ # through the alternatives found.\n\ \n\ # The search context is stored on a per file basis\n\ \n\ # fetch the context, if any, or create one\n\ $compWord[""] = ""\n\ file = $file_path $file_name\n\ if (file in $compWord)\n\ ctx = $compWord[file]\n\ else\n\ ctx = $empty_array\n\ \n\ fail = 0\n\ \n\ if (!("wordEnd" in ctx)) {\n\ ctx.wordEnd = 0\n\ ctx.repeat = 0\n\ ctx.init = 0\n\ ctx.wordStart = 0\n\ ctx.wordEndRE = ""\n\ ctx.word = ""\n\ }\n\ \n\ # check whether stored state matches this completion\n\ if (ctx.wordEnd == $cursor && \\\n\ get_range(ctx.wordStart, ctx.init) == ctx.word) {\n\ # it does: we're asking for another completion candidate\n\ ctx.repeat += 1\n\ }\n\ else {\n\ # it doesn't: we are looking at a new prefix to complete\n\ ctx.repeat = 1\n\ ctx.init = $cursor\n\ ctx.wordStart = -1\n\ ctx.wordEndRE = ">"\n\ $compword.wordList = $empty_array\n\ \n\ # search back to a word boundary to find the string to complete\n\ prevtagp = search("[<>&]", $cursor - 1, "regex", "backward")\n\ search_end = $search_end\n\ if (prevtagp >= 0) {\n\ prevtag = get_range(prevtagp, prevtagp + 1)\n\ if (prevtag == "<") {\n\ # in a tag: use tag completion\n\ ctx.wordStart = prevtagp\n\ ctx.wordEndRE = "(?<=\\\\>)"\n\ search_end = $cursor\n\ }\n\ else if (prevtag == "&") {\n\ # possible &entity; ? use entity completion\n\ preventp = search("\\\\&(?:[\\\\l_:][\\\\l\\\\d.-_:\\xb7]*)?", $cursor, \\\n\ "regex", "backward")\n\ if (preventp == prevtagp && $search_end >= $cursor) {\n\ ctx.wordStart = preventp\n\ ctx.wordEndRE = "(?<=;)"\n\ search_end = $cursor\n\ }\n\ } # else leave alone - normal word completion\n\ }\n\ if (ctx.wordStart <= 0)\n\ {\n\ # type of completion not set up: try word completion\n\ ctx.wordStart = search("<\\\\w+", $cursor, "regex", "backward")\n\ search_end = $search_end\n\ }\n\ \n\ if (ctx.wordStart == -1)\n\ fail = 1\n\ else if (search_end == $cursor)\n\ ctx.word = get_range(ctx.wordStart, $cursor)\n\ else\n\ fail = 1 # cursor not at end of word - don't complete\n\ }\n\ \n\ if (fail) {\n\ if (file in $compWord)\n\ delete $compWord[file]\n\ return\n\ }\n\ \n\ # look for a new candidate\n\ cand = ""\n\ pref = quote_literal_as_regex(ctx.word) # prefix to search for\n\ if (pref == ctx.word)\n\ pref = "<" pref\n\ \n\ while () {\n\ # start from where we'll complete the word\n\ candPos = ctx.wordStart\n\ len = ctx.init - candPos\n\ # skip back over previously examined candidates, then one extra\n\ for (i = ctx.repeat; i > 0; --i) {\n\ candPos = search(pref, candPos - 1, "regex","backward","wrap")\n\ }\n\ \n\ # are we back to where we started?\n\ if (candPos == ctx.wordStart) {\n\ # yes: restore initial conditions\n\ beep()\n\ ctx.repeat = 0\n\ $compword.wordList = $empty_array\n\ cand = ctx.word\n\ break\n\ }\n\ else {\n\ # no: a new occurrence of the prefix\n\ # have we seen this completion before? look in $compword.wordList\n\ # we know the prefix is the same - so don't scan that in the search\n\ # (hence the candPos + len)\n\ candEnd = search(ctx.wordEndRE, candPos + len, "regex")\n\ cand = get_range(candPos, candEnd)\n\ if (cand in $compword.wordList) {\n\ ++ctx.repeat\n\ }\n\ else {\n\ # not seen before: quit the loop - cand is the new candidate\n\ $compword.wordList[cand] = 1\n\ break\n\ }\n\ }\n\ }\n\ \n\ # cand holds a new candidate completion or the original text (reset)\n\ # display the completion\n\ replace_range(ctx.wordStart, $cursor, cand)\n\ # and store coursor pos for a possible repeat lookup\n\ set_cursor_pos(ctx.wordStart + length(cand))\n\ ctx.wordEnd = $cursor\n\ $compWord[file] = ctx\n\ }\n\ Complete Word old@XML-SGML HTML:::: {\n\ # This macro attempts to complete the current word by\n\ # finding another word in the same document that has\n\ # the same prefix; repeated invocations of the macro\n\ # (by repeated typing of its accelerator, say) cycles\n\ # through the alternatives found.\n\ # \n\ # This version avoids the need of initializing the global\n\ # variable in an external macro file\n\ $compWord[""] = ""\n\ \n\ if (!("wordEnd" in $compWord)) {\n\ $compWord["wordEnd"] = 0\n\ $compWord["repeat"] = 0\n\ $compWord["init"] = 0\n\ $compWord["wordStart"] = 0\n\ $compWord["wordEndRE"] = ""\n\ $compWord["path"] = $file_path\n\ $compWord["file"] = $file_name\n\ }\n\ \n\ # check whether stored state matches this completion\n\ if ($compWord["wordEnd"] == $cursor && \\\n\ $compWord["path"] == $file_path && \\\n\ $compWord["file"] == $file_name) {\n\ # it does: we're asking for another completion candidate\n\ $compWord["repeat"] += 1\n\ }\n\ else {\n\ # it doesn't: we are looking at a new prefix to complete\n\ $compWord["repeat"] = 1\n\ $compWord["init"] = $cursor\n\ $compWord["wordStart"] = -1\n\ $compWord["wordEndRE"] = ">"\n\ $compword["wordList"] = $empty_array\n\ $compWord["path"] = $file_path\n\ $compWord["file"] = $file_name\n\ \n\ # search back to a word boundary to find the string to complete\n\ prevtagp = search("[<>&]", $cursor - 1, "regex", "backward")\n\ search_end = $search_end\n\ if (prevtagp >= 0) {\n\ prevtag = get_range(prevtagp, prevtagp + 1)\n\ if (prevtag == "<") {\n\ # in a tag: use tag completion\n\ $compWord["wordStart"] = prevtagp\n\ $compWord["wordEndRE"] = "(?<=\\\\>)"\n\ search_end = $cursor\n\ }\n\ else if (prevtag == "&") {\n\ # possible &entity; ? use entity completion\n\ preventp = search("\\\\&[\\\\l_:][\\\\l\\\\d.-_:\\xb7]*", $cursor, "regex", \\\n\ "backward")\n\ if (preventp == prevtagp && $search_end >= $cursor) {\n\ $compWord["wordStart"] = preventp\n\ $compWord["wordEndRE"] = "(?<=;)"\n\ search_end = $cursor\n\ }\n\ } # else leave alone - normal word completion\n\ }\n\ if ($compWord["wordStart"] <= 0)\n\ {\n\ # type of completion not set up: try word completion\n\ $compWord["wordStart"] = search("<\\\\w+", $cursor, "regex", "backward")\n\ search_end = $search_end\n\ }\n\ \n\ if ($compWord["wordStart"] == -1)\n\ return\n\ \n\ if (search_end == $cursor)\n\ $compWord["word"] = get_range($compWord["wordStart"], $cursor)\n\ else\n\ return # cursor not at end of word - don't complete\n\ }\n\ \n\ if (!("word" in $compWord))\n\ return\n\ \n\ # look for a new candidate\n\ cand = ""\n\ while () {\n\ # start from where we'll complete the word\n\ s = $compWord["init"]\n\ # skip back over previously examined candidates\n\ for (i = 0; i <= $compWord["repeat"]; i++) {\n\ re = quote_literal_as_regex($compWord["word"])\n\ if (re == $compWord["word"])\n\ re = "<" re\n\ s = search(re, s - 1, "regex","backward","wrap")\n\ }\n\ \n\ # are we back to where we started?\n\ if (s == $compWord["wordStart"]) {\n\ # yes: restore initial conditions\n\ beep()\n\ $compWord["repeat"] = 0\n\ s = $compWord["wordStart"]\n\ se = $compWord["init"]\n\ $compword["wordList"] = $empty_array\n\ cand = $compWord["word"]\n\ break\n\ }\n\ else {\n\ # no: a new occurrence of the prefix\n\ # have we seen this completion before? look in $compword["wordList"]\n\ se = search($compWord["wordEndRE"], s, "regex")\n\ cand = get_range(s, se)\n\ if (cand in $compword["wordList"]) {\n\ ++$compWord["repeat"]\n\ }\n\ else {\n\ # not seen before: quit the loop - cand is the new candidate\n\ $compword["wordList"][cand] = 1\n\ break\n\ }\n\ }\n\ }\n\ \n\ # cand holds a new candidate completion or the original text (reset)\n\ # display the completion\n\ replace_range($compWord["wordStart"], $cursor, cand)\n\ # and store coursor pos for a possible repeat lookup\n\ $compWord["wordEnd"] = $cursor\n\ }\n\ Remove DOS CRs:::: {\n\ # do replacements one at a time to preserve rangesets, marks etc.\n\ # this does have the unfortunate effect of generating more UNDOs though...\n\ RE = "regex"\n\ PAT = "(\\\\s+\\r?|\\r)$"\n\ for (pos = search(PAT, 0, RE); pos != -1; pos = search(PAT, pos + 1, RE))\n\ replace_range(pos, $search_end, "")\n\ }\n\ Remove DOS CRs (no tidy):::: {\n\ # do replacements one at a time to preserve rangesets, marks etc.\n\ # this does have the unfortunate effect of generating more UNDOs though...\n\ RE = "case"\n\ PAT = "\\r"\n\ for (pos = search(PAT, 0, RE); pos != -1; pos = search(PAT, pos + 1, RE))\n\ replace_range(pos, $search_end, "")\n\ }\n\ Add DOS CRs:::: {\n\ # dialog($file_format)\n\ if ($file_format == "unix")\n\ {\n\ RE = "regex"\n\ PAT = "\\\\s*\\r*$"\n\ for (pos = search(PAT, 0, RE); pos != -1; pos = search(PAT, pos + 2, RE))\n\ replace_range(pos, $search_end, "\\r")\n\ }\n\ }\n\ Language>Choose language:Ctrl+Equal::: {\n\ NEDIT_require_macro_file("ModeString.nm")\n\ NEDIT_require_macro_file("extensions.nm")\n\ \n\ # provide a list of languages\n\ list = "\\n" \\\n\ "C++\\n" \\\n\ "Makefile\\n" \\\n\ "Java\\n" \\\n\ "JavaScript\\n" \\\n\ "grep -n out\\n" \\\n\ "CC output\\n" \\\n\ "Windows VC\\n" \\\n\ "Javac output\\n" \\\n\ "Sh Ksh Bash\\n" \\\n\ "Man page output\\n" \\\n\ "NEdit Macro\\n" \\\n\ "NEdit Macro RE\\n" \\\n\ "Awk\\n" \\\n\ "Perl\\n" \\\n\ "SQL\\n" \\\n\ "Doxygen\\n" \\\n\ "Doxygen strict\\n" \\\n\ "X Resources\\n" \\\n\ "C\\n" \\\n\ "SGML HTML\\n" \\\n\ "XML\\n" \\\n\ ""\n\ mode = $language_mode\n\ oldmode = mode\n\ currmode = mode\n\ msg = "Choose a language mode\\n(Currently " oldmode ")"\n\ \n\ ######### VERSION 1\n\ # # add two spaces in front of all non-empty lines\n\ # list = replace_in_string(list, "^(?=.)", " ", "regex")\n\ # # change those spaces to ">>" on a line equal to the current language mode\n\ # list = replace_in_string(list, "\\n "mode"\\n", "\\n>>"mode"\\n", "case", "copy")\n\ #\n\ # # ask for a new language mode\n\ # mode = list_dialog(msg, list, "OK", "Prompt", "Cancel")\n\ # mode = substring(mode, 2, length(mode))\n\ \n\ ######### VERSION 2\n\ # mark current mode with "<<" if it is in the list\n\ if (search_string(list, "\\n" mode "\\n", 0) >= 0)\n\ {\n\ pads = replace_in_string(longest_line(list), ".", "<", "regex")\n\ currmode = mode " " substring(pads, length(mode)) "<<"\n\ list = replace_in_string(list, "\\n" mode "\\n", "\\n" currmode "\\n", "case")\n\ }\n\ # ask for a new language mode\n\ mode = list_dialog(msg, list, "OK", "Prompt", "Cancel")\n\ \n\ ######### common exit code\n\ changed = $list_dialog_button == 1\n\ if (mode != "" && mode != currmode && $list_dialog_button == 1)\n\ set_language_mode(mode)\n\ else if ($list_dialog_button == 2)\n\ {\n\ mode = string_dialog("Type a language mode name\\n(Currently " oldmode ")", \\\n\ "OK", "Cancel")\n\ if ($string_dialog_button == 1)\n\ {\n\ if (mode != "" && mode != currmode)\n\ {\n\ set_language_mode(mode)\n\ mode = $language_mode\n\ changed = (mode != "" && mode != currmode)\n\ }\n\ }\n\ else\n\ return\n\ }\n\ else\n\ mode = oldmode\n\ \n\ if (changed)\n\ ModeStringInterpret(mode)\n\ }\n\ Language>From editor string:::: {\n\ NEDIT_require_macro_file("ModeString.nm")\n\ \n\ ModeStringInterpret()\n\ }\n\ Language>C++:::: {\n\ NEDIT_require_macro_file("ModeString.nm")\n\ \n\ ModeStringInterpret("C++")\n\ \n\ if ($language_mode != "C++")\n\ set_language_mode("C++")\n\ }\n\ Language>Doxygen:::: {\n\ b = dialog("Which Doxygen style?", "Easy", "Strict")\n\ if (b == 1)\n\ set_language_mode("Doxygen")\n\ else if (b == 2)\n\ set_language_mode("Doxygen strict")\n\ else\n\ return\n\ \n\ set_em_tab_dist(4) # turn on emulated tabs\n\ set_tab_dist(4)\n\ set_use_tabs(0) # do not use tabs in auto padding\n\ }\n\ Language>grep -n out/compiler output@*:Shift+Ctrl+Equal::: {\n\ if (search("^\\\\s*\\\\^$", $cursor, "regex", "wrap", "backward") >= 0)\n\ # contains single carats on otherwise empty lines\n\ set_language_mode("Javac output")\n\ else\n\ if (search("^[^:]+:\\\\d+:", $cursor, "regex", "wrap", "backward") >= 0)\n\ # matches ...:NNN:...\n\ set_language_mode("grep -n out")\n\ else\n\ if (search("^\\"[^\\"]+\\", line \\\\d+(?::|$)", $cursor, \\\n\ "regex", "wrap", "backward") >= 0)\n\ # matches "...", line NNN:\n\ set_language_mode("CC output")\n\ else\n\ {\n\ mode = list_dialog("Choose a language mode", \\\n\ "grep -n out\\n" \\\n\ "Windows VC\\n" \\\n\ "CC output\\n" \\\n\ "Javac output", "OK", "Cancel")\n\ if (mode != "" && $list_dialog_button == 1)\n\ set_language_mode(mode)\n\ }\n\ }\n\ Language>grep -n out/CC output@NEdit Macro:::: {\n\ macro_menu_command("Language>grep -n out/CC output@*")\n\ }\n\ Language>grep -n out/CC output@NEdit Macro RE:::: {\n\ macro_menu_command("Language>grep -n out/CC output@*")\n\ }\n\ Language>NEdit Macro RE@NEdit Macro:Shift+Ctrl+Equal::: {\n\ set_language_mode("NEdit Macro RE")\n\ set_tab_dist(8)\n\ }\n\ Language>NEdit Macro@NEdit Macro RE:Shift+Ctrl+Equal::: {\n\ set_language_mode("NEdit Macro")\n\ set_tab_dist(8)\n\ }\n\ Language>NEdit Macro@*:::: {\n\ set_language_mode("NEdit Macro")\n\ set_tab_dist(8)\n\ }\n\ Language>grep -n out:::: {\n\ set_language_mode("grep -n out")\n\ }\n\ Language>Tabs 4:Ctrl+4:4:: {\n\ set_tab_dist(4)\n\ }\n\ Language>Tabs 8:Ctrl+8:8:: {\n\ set_tab_dist(8)\n\ }\n\ Language>Toggle tabs 4 / 8:::: {\n\ if ($tab_dist == 8)\n\ set_tab_dist(4)\n\ else\n\ set_tab_dist(8)\n\ }\n\ Language>Cycle tabs 2...8:Ctrl+Minus::: {\n\ new_tab_dist = ($tab_dist - 1) % 7 + 2\n\ if (new_tab_dist < 2)\n\ new_tab_dist = 2\n\ set_tab_dist(new_tab_dist)\n\ set_cursor_pos($cursor)\n\ }\n\ Language>Toggle hard tabs:Shift+Ctrl+Minus:h:: {\n\ $tabs_info[""] = ""\n\ \n\ key = $file_path $file_name $sub_sep "old_em_tab_dist"\n\ \n\ if (!(key in $tabs_info))\n\ {\n\ if ($em_tab_dist > 0)\n\ $tabs_info[key] = $em_tab_dist\n\ else\n\ $tabs_info[key] = $tab_dist\n\ }\n\ \n\ dist = $tabs_info[key]\n\ \n\ # remove or restore tab emulation\n\ if ($use_tabs)\n\ {\n\ set_use_tabs(0)\n\ set_em_tab_dist($tabs_info[key])\n\ dialog("Not using hard tabs in padding\\n(emulated tabs = "$em_tab_dist")")\n\ }\n\ else\n\ {\n\ set_use_tabs(1)\n\ set_em_tab_dist(0)\n\ dialog("Using hard tabs in padding\\n" \\\n\ "(emulated tab distance = 0 [old: " dist "])")\n\ }\n\ }\n\ Language>Set hard tab width:Alt+Minus:8:: {\n\ n = string_dialog("Enter the new hard tab width (currently " $tab_dist ")")\n\ if (valid_number(n))\n\ set_tab_dist(n)\n\ else\n\ beep()\n\ }\n\ Language>Set soft tab width:Ctrl+Alt+Minus:8:: {\n\ $tabs_info[""] = ""\n\ \n\ key = $file_path $file_name $sub_sep "old_em_tab_dist"\n\ if (!(key in $tabs_info))\n\ {\n\ if ($em_tab_dist > 0)\n\ $tabs_info[key] = $em_tab_dist\n\ else\n\ $tabs_info[key] = $tab_dist\n\ }\n\ \n\ emtabdist = $em_tab_dist\n\ emtabs = "ON"\n\ if ($em_tab_dist <= 0)\n\ {\n\ emtabdist = $tabs_info[key]\n\ emtabs = "OFF"\n\ }\n\ else\n\ $tabs_info[key] = $em_tab_dist\n\ \n\ if ($use_tabs)\n\ usetabs = "ON"\n\ else\n\ usetabs = "OFF"\n\ \n\ prompt = "Enter the new soft tab width (currently " emtabdist ")" \\\n\ "\\n soft tabbing is " emtabs \\\n\ "\\n use of hard tabs in fills is " usetabs \\\n\ "\\n hard tab width is " $tab_dist\n\ \n\ n = string_dialog(prompt, \\\n\ "OK", "Toggle soft tabs", "Toggle hard tab fill")\n\ btn = $string_dialog_button\n\ \n\ if (valid_number(n) && 0 < btn && btn <= 3)\n\ {\n\ if (0 < n && n <= 20)\n\ {\n\ if ($em_tab_dist > 0)\n\ set_em_tab_dist(n)\n\ emtabdist = n\n\ if (emtabdist <= 0)\n\ emtabdist = $tab_dist\n\ }\n\ else\n\ {\n\ btn = 1\n\ dialog("Ignoring invalid value '" n "' of soft tab width\\n" \\\n\ "(value must be between 1 and 20)", "Dismiss")\n\ }\n\ }\n\ n = emtabdist\n\ $tabs_info[key] = emtabdist\n\ if (btn == 2)\n\ {\n\ set_em_tab_dist(emtabdist * ($em_tab_dist <= 0))\n\ }\n\ if (btn == 3)\n\ {\n\ set_use_tabs(!$use_tabs)\n\ }\n\ }\n\ Language>Highlight productions@Yacc:::: {\n\ NEDIT_require_macro_file("extensions.nm")\n\ NEDIT_require_macro_file("array_utils.nm")\n\ NEDIT_require_macro_file("RSextensions.nm")\n\ NEDIT_require_macro_file("RScolor.nm")\n\ \n\ prodnames = ""\n\ yaccValues = $empty_array\n\ alt = ""\n\ \n\ # find first and last, positions of the two %% markers\n\ first = search("^\\\\s*%%", 0, "regex")\n\ if (first < 0) first = $text_length\n\ last = search("^\\\\s*%%", $search_end, "regex")\n\ \n\ # create the opposite to prs\n\ xrs = "~Yacc productions"\n\ RangeSet_forget(xrs)\n\ RangeSet_add(xrs, 0, $text_length)\n\ RangeSet_remove(xrs, 0, $text_length)\n\ \n\ # create prs - the Yacc productions rangeset\n\ prs = "Yacc productions"\n\ RangeSet_forget(prs)\n\ RangeSet_set_color(prs, "#E0E0E0")\n\ if (last < 0) last = $text_length\n\ # find productions - assumed to be one line per production alternative\n\ # starting either "production_name:" or "|".\n\ end = 0\n\ for (pos = search("^\\\\w*\\\\s*[:|]\\\\s*('\\\\{'|[^\\\\{])*", first, "regex"); \\\n\ pos != -1 && pos < last; \\\n\ pos = search("^\\\\w*\\\\s*[:|]\\\\s*('\\\\{'|[^\\\\{])*", end, "regex"))\n\ {\n\ end = $search_end\n\ RangeSet_add(prs, pos, end)\n\ pn = search("(?n^\\\\w*(?=\\\\s*:))", pos, "regex")\n\ pe = $search_end\n\ if (pn >= 0)\n\ {\n\ name = get_range(pn, pe)\n\ if (!(name in yaccValues))\n\ {\n\ yaccValues[name] = "non-terminal (with production)"\n\ prodnames = prodnames alt "<" name ">"\n\ alt = "|"\n\ }\n\ }\n\ }\n\ \n\ # evaluate xrs\n\ RangeSet_add(xrs, prs)\n\ RangeSet_inverse(xrs)\n\ RangeSet_remove(xrs, 0, first)\n\ RangeSet_remove(xrs, last, $text_length)\n\ # add comments to xrs\n\ end = 0\n\ for (pos = search("(?n/\\\\*(?:(?!\\\\*/).)*\\\\*/)", 0, "regex"); \\\n\ pos != -1; \\\n\ pos = search("(?n/\\\\*(?:(?!\\\\*/).)*\\\\*/)", end, "regex"))\n\ {\n\ end = $search_end\n\ RangeSet_add(xrs, pos, end)\n\ }\n\ \n\ # extract production names from the productions found\n\ nrs = "Yacc production names"\n\ RangeSet_forget(nrs)\n\ RangeSet_set_color(nrs, "#FFFFFF")\n\ if (prodnames != "")\n\ {\n\ end = 0\n\ for (pos = search(prodnames, first, "regex"); \\\n\ pos != -1 && pos < last; \\\n\ pos = search(prodnames, end, "regex"))\n\ {\n\ end = $search_end\n\ RangeSet_add(nrs, pos, end)\n\ }\n\ }\n\ \n\ # pick up tokens and literals\n\ trs = "Yacc tokens"\n\ RangeSet_forget(trs)\n\ RangeSet_set_color(trs, "#F0F0F0")\n\ tokens = ""\n\ alt = ""\n\ # they are defined in token/production definition lines\n\ pcentdirective = "^\\\\s*%(token|type|nonassoc|right|left)\\\\s*(?:\\\\<\\\\w+\\\\>\\\\s*)?"\n\ end = 0\n\ for (pos = search(pcentdirective, 0, "regex"); \\\n\ pos != -1 && pos < first; \\\n\ pos = search(pcentdirective, end, "regex"))\n\ {\n\ end = $search_end\n\ eol = search("\\n", end)\n\ if (eol == -1) eol = $text_length\n\ for (pn = search("(?n\\\\w+|'.'|'\\\\\\\\.')", end, "regex"); \\\n\ pn != -1 && pn < eol; \\\n\ pn = search("(?n\\\\w+|'.'|'\\\\\\\\.')", pe, "regex"))\n\ {\n\ pe = $search_end\n\ tok = get_range(pn, pe)\n\ if (!(tok in yaccValues))\n\ {\n\ if (substring(tok, 0, 1) == "'")\n\ {\n\ yaccValues[tok] = "literal"\n\ tokens = tokens alt quote_literal_as_regex(tok)\n\ }\n\ else\n\ {\n\ yaccValues[tok] = "token"\n\ tokens = tokens alt "<" tok ">"\n\ }\n\ alt = "|"\n\ }\n\ }\n\ }\n\ # extraneous, undeclared literals in productions?\n\ #nprs = RangeSet_get_count(prs)\n\ #dialog(prs " as " nprs " ranges")\n\ for (ind = 0; RangeSet_defined(prs, ind); ind++)\n\ {\n\ #RangeSet_select(prs, ind)\n\ #set_cursor_pos($RangeSet_range_start)\n\ #RangeSet_defined(prs, ind)\n\ #else dialog(prs " range " ind " from " $RangeSet_range_start " to " $RangeSet_range_end)\n\ pos = $RangeSet_range_start\n\ end = $RangeSet_range_end\n\ for (pn = search("(?n'.'|'\\\\\\\\.')", pos, "regex"); \\\n\ pn != -1 && pn < end; \\\n\ pn = search("(?n'.'|'\\\\\\\\.')", pe, "regex"))\n\ {\n\ pe = $search_end\n\ tok = get_range(pn, pe)\n\ if (!(tok in yaccValues))\n\ {\n\ yaccValues[tok] = "literal (in production only)"\n\ tokens = tokens alt quote_literal_as_regex(tok)\n\ alt = "|"\n\ }\n\ }\n\ }\n\ # now find them all\n\ end = 0\n\ for (pos = search(tokens, 0, "regex"); \\\n\ pos != -1; \\\n\ pos = search(tokens, end, "regex"))\n\ {\n\ end = $search_end\n\ RangeSet_add(trs, pos, end)\n\ }\n\ \n\ array_select_entry("Yacc words", yaccValues)\n\ RangeSet_remove(prs, xrs)\n\ RangeSet_remove(nrs, xrs)\n\ RangeSet_remove(trs, xrs)\n\ RangeSet_forget(xrs)\n\ }\n\ Comments>/* Comment */@C@C++@Java@CSS@JavaScript@Lex:::R: {\n\ selStart = $selection_start\n\ selEnd = $selection_end\n\ replace_range(selStart, selEnd, "/* " get_selection() " */")\n\ select(selStart, selEnd + 6)\n\ }\n\ Comments>/* Uncomment */@C@C++@Java@CSS@JavaScript@Lex:::R: {\n\ sel = get_selection()\n\ selStart = $selection_start\n\ selEnd = $selection_end\n\ commentStart = search_string(sel, "/*", 0)\n\ if (substring(sel, commentStart + 2, commentStart + 3) == " ")\n\ keepStart = commentStart + 3\n\ else\n\ keepStart = commentStart + 2\n\ keepEnd = search_string(sel, "*/", length(sel), "backward")\n\ commentEnd = keepEnd + 2\n\ if (substring(sel, keepEnd - 1, keepEnd) == " ")\n\ keepEnd = keepEnd - 1\n\ replace_range(selStart + commentStart, selStart + commentEnd, \\\n\ substring(sel, keepStart, keepEnd))\n\ select(selStart, selEnd - (keepStart-commentStart) - \\\n\ (commentEnd - keepEnd))\n\ }\n\ Comments>// Comment@C@C++@Java@JavaScript:::R: {\n\ replace_in_selection("^.*$", "// &", "regex")\n\ }\n\ Comments>// Uncomment@C@C++@Java@JavaScript:::R: {\n\ replace_in_selection("(^[ \\\\t]*// ?)(.*)$", "\\\\2", "regex")\n\ }\n\ Comments>// --- bar@C++@Java@JavaScript:::: {\n\ bar = "// -------------------------------------" \\\n\ "----------------------------------------"\n\ if ($column == 0)\n\ {\n\ beginning_of_line()\n\ insert_string(bar "\\n")\n\ }\n\ else\n\ {\n\ wrap = $wrap_margin\n\ if (wrap <= 0)\n\ wrap = $display_width / $max_font_width\n\ if (wrap <= 4)\n\ wrap = 8\n\ insert_string(substring(bar, 0, wrap) "\\n")\n\ }\n\ }\n\ Comments>// ==== bar@C++@Java@JavaScript:::: {\n\ bar = "// =====================================" \\\n\ "========================================"\n\ if ($column == 0)\n\ {\n\ beginning_of_line()\n\ insert_string(bar "\\n")\n\ }\n\ else\n\ {\n\ wrap = $wrap_margin\n\ if (wrap <= 0)\n\ wrap = $display_width / $max_font_width\n\ if (wrap <= 4)\n\ wrap = 8\n\ insert_string(substring(bar, 0, wrap) "\\n")\n\ }\n\ }\n\ Comments>/* --- */ bar@C@C++@Java@JavaScript:::: {\n\ beginning_of_line()\n\ insert_string("/* -------------------------------------------------------------------------- */\\n")\n\ }\n\ Comments>/*-*-*/ to //@C@C++@Java@JavaScript:::: {\n\ # replace c-style vbar comments eg\n\ # /* this is a\n\ # * c-style vbar comment\n\ # */\n\ # with lines starting //\n\ \n\ pos = $cursor\n\ begF = search("/*", pos, "case", "forward")\n\ begB = search("/*", pos, "case", "backward")\n\ \n\ if (begF == -1) begF = begB\n\ if (begB == -1) begB = begF\n\ if (begF == -1) return\n\ \n\ deltaF = max(begF - pos, pos - begF)\n\ deltaB = max(begB - pos, pos - begB)\n\ if (deltaF < deltaB)\n\ beg = begF\n\ else\n\ beg = begB\n\ \n\ begsol = search("\\n", beg, "case", "backward") + 1 # fails with 0: great\n\ \n\ fin = search("\\\\*/\\\\s*\\n?", beg, "regex", "forward")\n\ finend = $search_end\n\ \n\ finsol = search("\\n", fin, "case", "backward") + 1\n\ select(begsol, finend)\n\ \n\ re = "(\\\\s*)/\\\\*.*\\n(?:\\\\1\\\\s\\\\*.*\\n)*\\\\1\\\\s\\\\*/\\\\s*\\n?"\n\ if (search(re, begsol, "regex", "forward") == begsol && \\\n\ $search_end == finend)\n\ {\n\ select(begsol, finend)\n\ s = get_range(begsol, finend)\n\ front = get_range(begsol, beg)\n\ t = replace_in_string(s, "^" front "[/ ][*]/?", front "//", "regex")\n\ u = replace_in_string(t, "\\\\s+\\n", "\\n", "regex", "copy")\n\ v = replace_in_string(u, "^" front "//\\n", "", "regex", "copy")\n\ #dialog("vbar c to c++" "\\n" \\\n\ # "s =\\n" replace_in_string(s, "^", " »", "regex", "copy") "«««" "\\n" \\\n\ # "front = \\"" front "\\"" "\\n" \\\n\ # "t =\\n" replace_in_string(t, "^", " »", "regex", "copy") "«««" "\\n" \\\n\ # "u =\\n" replace_in_string(u, "^", " »", "regex", "copy") "«««" "\\n" \\\n\ # "v =\\n" replace_in_string(v, "^", " »", "regex", "copy") "«««")\n\ replace_range(begsol, finend, v)\n\ }\n\ }\n\ Comments># Comment@Perl@Sh Ksh Bash@NEdit Macro@Makefile@Awk@Csh@Python@Tcl@Hash comments:::R: {\n\ replace_in_selection("^.*$", "#&", "regex")\n\ }\n\ Comments># Uncomment@Perl@Sh Ksh Bash@NEdit Macro@Makefile@Awk@Csh@Python@Tcl@Hash comments:::R: {\n\ replace_in_selection("(^[ \\\\t]*#)(.*)$", "\\\\2", "regex")\n\ }\n\ Comments># --- bar@Perl@Sh Ksh Bash@NEdit Macro@Makefile@Awk@Csh@Python@Tcl@Hash comments:::: {\n\ beginning_of_line()\n\ insert_string("# ------------------------------------------------------------------------------\\n")\n\ }\n\ Comments>-- Comment@SQL:::R: {\n\ replace_in_selection("^.*$", "--&", "regex")\n\ }\n\ Comments>-- Uncomment@SQL:::R: {\n\ replace_in_selection("(^[ \\\\t]*--)(.*)$", "\\\\2", "regex")\n\ }\n\ Comments>; Comment@Semi comments@PicoBlaze Assembler:::R: {\n\ # replace_in_selection("^.*$", "; &", "regex")\n\ \n\ NEDIT_require_macro_file("extensions.nm")\n\ \n\ beg = $selection_start\n\ end = $selection_end\n\ \n\ if (beg < 0)\n\ {\n\ beg = $cursor\n\ end = beg\n\ }\n\ \n\ beg = start_of_line_pos(beg)\n\ bad = start_of_line_pos(end)\n\ if (bad != end)\n\ end = end_of_line_pos(end)\n\ \n\ s = get_range(beg, end)\n\ \n\ # replace a leading space (if followed by a second) with a semicolon\n\ s = replace_in_string(s, "^ ( .*)$", ";\\\\1", "regex", "copy")\n\ # prefix with a semicolon anything which doesn't already start with a semicolon\n\ s = replace_in_string(s, "^([^;].*)$", ";\\\\1", "regex", "copy")\n\ \n\ replace_range(beg, end, s)\n\ select(beg, beg + length(s))\n\ }\n\ Comments>; Uncomment@Semi comments@PicoBlaze Assembler:::R: {\n\ # replace_in_selection("(^[ \\\\t]*;)(.*)$", "\\\\2", "regex")\n\ \n\ NEDIT_require_macro_file("extensions.nm")\n\ \n\ beg = $selection_start\n\ end = $selection_end\n\ \n\ if (beg < 0)\n\ {\n\ beg = $cursor\n\ end = beg\n\ }\n\ \n\ beg = start_of_line_pos(beg)\n\ bad = start_of_line_pos(end)\n\ if (bad != end)\n\ end = end_of_line_pos(end)\n\ \n\ s = get_range(beg, end)\n\ \n\ # replace a semicolon with a space if followed by a space sequence\n\ # then a word character or semicolon\n\ s = replace_in_string(s, "^;( +(?:\\\\w|;).*)$", " \\\\1", "regex", "copy")\n\ # remove a leading semicolon if followed by a word character\n\ s = replace_in_string(s, "^;(\\\\w.*)$", "\\\\1", "regex", "copy")\n\ \n\ replace_range(beg, end, s)\n\ select(beg, beg + length(s))\n\ }\n\ Comments>Toggle ; ±debug statement comments@PicoBlaze Assembler:::: {\n\ pos = search("^.*;.*[+-]debug>", 0, "regex")\n\ posend = $search_end\n\ if (pos < 0)\n\ {\n\ return dialog("Toggle ; ±debug statement: no ±debug comment found")\n\ }\n\ tog = get_range(posend - length("debug") - 1, posend - length("debug"))\n\ if (tog == "+")\n\ {\n\ REplusminus = "\\\\+"\n\ REminusplus = "-"\n\ nottog = "-"\n\ }\n\ else\n\ {\n\ REplusminus = "-"\n\ REminusplus = "\\\\+"\n\ nottog = "+"\n\ }\n\ \n\ cmt = search("^ *;", pos, "regex")\n\ if (cmt < 0 || cmt > posend)\n\ {\n\ # first instance of ±debug is active (uncommented) - make it inactive\n\ RE_DoComment = "^\\\\s*(?=[^;])\\\\S.*;.*" REplusminus "debug>.*$"\n\ RE_UnComment = "^\\\\s*;\\\\s*\\\\S.*;.*" REminusplus "debug>.*$"\n\ prompt = " Commenting lines with '; ... "tog"debug\\n" \\\n\ " Uncommenting lines with '; ... "nottog"debug\\n"\n\ }\n\ else\n\ {\n\ # this instance of ±debug is inactive (commented) - make it active\n\ RE_DoComment = "^\\\\s*(?=[^;])\\\\S.*;.*" REminusplus "debug>.*$"\n\ RE_UnComment = "^\\\\s*;\\\\s*\\\\S.*;.*" REplusminus "debug>.*$"\n\ prompt = " Commenting lines with '; ... "nottog"debug\\n" \\\n\ " Uncommenting lines with '; ... "tog"debug\\n"\n\ }\n\ \n\ prompt = "Toggle ; ±debug statement comments\\n" prompt\n\ \n\ show_it = dialog(prompt "Track ±debug comment toggling?", "Yes", "No", "Cancel")\n\ if (show_it < 1 || 2 < show_it)\n\ return\n\ show_it = (show_it == 1)\n\ \n\ oldpos = $cursor\n\ \n\ # loop for uncommenting\n\ for (beg = search(RE_UnComment, 0, "regex"); \\\n\ beg >= 0; \\\n\ beg = search(RE_UnComment, end, "regex"))\n\ {\n\ end = $search_end\n\ s = get_range(beg, end)\n\ if (show_it) set_cursor_pos(beg)\n\ if (show_it) select(beg, end)\n\ \n\ # replace the first semicolon with a space\n\ s = replace_in_string(s, "^(\\\\s*);", "\\\\1 ", "regex", "copy")\n\ # remove a starting space if followed by non-space\n\ s = replace_in_string(s, "^ (?=\\\\S)([^;]*)", "\\\\1 ", "regex", "copy")\n\ \n\ replace_range(beg, end, s)\n\ if (show_it) select(beg, beg + length(s))\n\ }\n\ \n\ # loop for commenting\n\ for (beg = search(RE_DoComment, 0, "regex"); \\\n\ beg >= 0; \\\n\ beg = search(RE_DoComment, end, "regex"))\n\ {\n\ end = $search_end\n\ s = get_range(beg, end)\n\ if (show_it) set_cursor_pos(beg)\n\ if (show_it) select(beg, end)\n\ \n\ s = replace_in_string(s, "^(?=[^;\\\\s])((?:(?! ?;).)*) ?;", ";\\\\1;", \\\n\ "regex", "copy")\n\ s = replace_in_string(s, "^(\\\\s*) (?=[^;\\\\s])", "\\\\1; ", "regex", "copy")\n\ s = replace_in_string(s, "^\\\\s(?=[^;\\\\s])", ";", "regex", "copy")\n\ \n\ replace_range(beg, end, s)\n\ if (show_it) select(beg, beg + length(s))\n\ }\n\ \n\ if (show_it) set_cursor_pos(oldpos)\n\ }\n\ Comments>! Comment@X Resources:::R: {\n\ replace_in_selection("^.*$", "!&", "regex")\n\ }\n\ Comments>! Uncomment@X Resources:::R: {\n\ replace_in_selection("(^[ \\\\t]*!)(.*)$", "\\\\2", "regex")\n\ }\n\ Comments>/* Bar Comment@C@C++:::R: {\n\ if ($selection_left != -1) {\n\ dialog("Selection must not be rectangular")\n\ return\n\ }\n\ start = $selection_start\n\ end = $selection_end-1\n\ origText = get_range($selection_start, $selection_end-1)\n\ newText = "/*\\n" replace_in_string(get_range(start, end), \\\n\ "^", " * ", "regex") "\\n */\\n"\n\ replace_selection(newText)\n\ select(start, start + length(newText))\n\ }\n\ Comments>/* Bar Uncomment@C@C++:::R: {\n\ selStart = $selection_start\n\ selEnd = $selection_end\n\ newText = get_range(selStart+3, selEnd-4)\n\ newText = replace_in_string(newText, "^ \\\\* ", "", "regex")\n\ replace_range(selStart, selEnd, newText)\n\ select(selStart, selStart + length(newText))\n\ }\n\ Comments>/* ==== */ bar@C@C++@Java@JavaScript:::: {\n\ beginning_of_line()\n\ insert_string("/* ========================================================================== */\\n")\n\ }\n\ Make C Prototypes@C@C++:::: {\n\ if ($selection_start == -1) {\n\ start = 0\n\ end = $text_length\n\ } else {\n\ start = $selection_start\n\ end = $selection_end\n\ }\n\ string = get_range(start, end)\n\ \n\ # remove comments\n\ string = replace_in_string(string, "//.*$", "", "regex", "copy") # C++ comments\n\ string = replace_in_string(string, "(?n/\\\\*.*?\\\\*/)", "", "regex", "copy") # C comments\n\ string = replace_in_string(string, "^\\\\s*\\n", "", "regex", "copy") # empty lines\n\ \n\ nDefs = 0\n\ searchPos = 0\n\ prototypes = ""\n\ staticPrototypes = ""\n\ for (;;) {\n\ headerStart = search_string(string, \\\n\ "^[a-zA-Z]([^;#\\"'{}=>"\n\ # and try that\n\ $go_there_lang["@@"] = "" # make sure this exists for next time\n\ \n\ $go_there_lang["C"] = "Go there@C@C++" # use tags on\n\ $go_there_lang["C++"] = "Go there@C@C++" # current word\n\ \n\ $go_there_lang["SGML HTML"] = "Go there@SGML HTML@XML"\n\ $go_there_lang["XML"] = "Go there@SGML HTML@XML"\n\ }\n\ \n\ lang = $language_mode\n\ not_lang = "@" lang\n\ command = "Go there" not_lang\n\ \n\ # if no plain "Go there", try "Go there@*"\n\ if (lang == "")\n\ {\n\ if (not_lang in $go_there_lang)\n\ {\n\ lang = "*"\n\ not_lang = "@" lang\n\ command = "Go there" not_lang\n\ }\n\ else\n\ {\n\ command = "Go there"\n\ }\n\ }\n\ \n\ if (lang in $go_there_lang)\n\ macro_menu_command($go_there_lang[lang])\n\ else if (not_lang in $go_there_lang)\n\ return dialog("No '" command "' macro nor special case in\\n" \\\n\ "'Go there for language@No Language' macro")\n\ else\n\ {\n\ # try winging it... if there's no such macro, it'll break,\n\ # but it will have set up a flag not to do so again\n\ $go_there_lang[not_lang] = ""\n\ macro_menu_command(command)\n\ # it worked!\n\ delete $go_there_lang[not_lang]\n\ $go_there_lang[lang] = command\n\ }\n\ }\n\ Go there@CC output:Shift+Ctrl+C::: {\n\ NEDIT_require_macro_file("GoThereSunCC.nm")\n\ \n\ goThereSunCC()\n\ }\n\ Go there@Windows VC:Shift+Ctrl+C::: {\n\ NEDIT_require_macro_file("GoThereWindowsVC.nm")\n\ \n\ goThereWindowsVC()\n\ }\n\ Go there@Javac output:Shift+Ctrl+C::: {\n\ NEDIT_require_macro_file("GoThereSunJavac.nm")\n\ \n\ goThereSunJavac()\n\ }\n\ Go there@C@C++:Shift+Ctrl+C::: {\n\ macro_menu_command("Move>MultiTag>Find def@C@C++")\n\ }\n\ Go there@grep -n out:Shift+Ctrl+C::: {\n\ NEDIT_require_macro_file("GoThereGrep.nm")\n\ \n\ goThereGrep()\n\ }\n\ Go there@Man page output:Shift+Ctrl+C::: {\n\ NEDIT_require_macro_file("ManHelp.nm")\n\ \n\ ManHelp()\n\ }\n\ Go there@SGML HTML@XML:Shift+Ctrl+C::: {\n\ NEDIT_require_macro_file("XMLMatch.nm")\n\ NEDIT_require_macro_file("RScolor.nm")\n\ \n\ pos = $cursor\n\ \n\ rs = "XMLMatchTag()"\n\ RangeSet_forget(rs)\n\ \n\ res = XMLMatchTag()\n\ \n\ if ("open_start" in res)\n\ {\n\ RangeSet_set_color(rs, "#FF8000")\n\ RangeSet_add(rs, res["open_start"], res["open_end"])\n\ RangeSet_add(rs, res["close_start"], res["close_end"])\n\ \n\ if (res["open_start"] <= pos && pos < res["open_end"])\n\ set_cursor_pos(res["close_start"] + 1)\n\ else if (res["close_start"] <= pos && pos < res["close_end"])\n\ set_cursor_pos(res["open_start"] + 1)\n\ }\n\ }\n\ Go there@PicoBlaze Assembler:Shift+Ctrl+C::: {\n\ pos = $cursor\n\ beg = search("<", pos, "regex", "backward")\n\ end = search(">", beg, "regex")\n\ word = get_range(beg, end)\n\ lbeg = search("^", pos, "regex", "backward")\n\ start = search("^\\\\s*<", lbeg, "regex")\n\ if (start >= 0)\n\ start = $search_end\n\ lend = search("$", lbeg, "regex")\n\ cmdstart = start\n\ labelstart = search("\\\\w+\\\\s*:", start, "regex")\n\ labelend = $search_end\n\ labelname = replace_in_string(get_range(labelstart, labelend), \\\n\ "\\\\s*:", "", "regex")\n\ # dialog("start="start" label="labelstart","labelend" lineend="lend)\n\ if (start <= labelstart && labelstart < lend)\n\ {\n\ # dialog("line starts with label")\n\ cmdstart = search("\\\\w+", labelend, "regex")\n\ }\n\ cmd = get_range(cmdstart, search(">", cmdstart, "regex"))\n\ \n\ cmnt = search(";", lbeg)\n\ \n\ # dialog("word="word"\\ncmd="cmd)\n\ \n\ # if (cmnt < pos && cmnt >= 0)\n\ # {\n\ # beep()\n\ # return dialog("Word " word " found in comment")\n\ # }\n\ \n\ if (search_string(" ADD ADDCY AND CALL COMPARE DISABLE ENABLE FETCH" \\\n\ " INPUT JUMP LOAD OR OUTPUT RETURN RETURNI RL RR" \\\n\ " SL0 SL1 SLA SLX SR0 SR1 SRA SRX STORE SUB SUBCY" \\\n\ " TEXT XOR" \\\n\ " INTERRUPT C NC Z NZ" \\\n\ " S0 S1 S2 S3 S4 S5 S6 S7 S8 S9 SA SB SC SD SE SF" \\\n\ " CONSTANT ADDRESS NAMEREG ", " " toupper(word) " ", 0) >= 0)\n\ {\n\ beep()\n\ return dialog(word " is keyword: no definition")\n\ }\n\ \n\ res = -1\n\ wordtype = "???"\n\ \n\ if (search_string(" CALL JUMP ", " " toupper(cmd) " ", 0) >= 0 || \\\n\ word == labelname)\n\ {\n\ wordtype = "label"\n\ res = search("^\\\\s*"word"\\\\s*:", 0, "regex")\n\ if (res >= 0)\n\ res = $search_end - 1\n\ }\n\ else if (search_string(" FETCH INPUT OUTPUT STORE ", \\\n\ " " toupper(cmd) " ", 0) >= 0 && \\\n\ (search(cmd "\\\\s+" word, start, "regex") == cmdstart || \\\n\ search(cmd "\\\\s+\\\\w+\\\\s*,\\\\s*\\\\(\\\\s*" word "\\\\s*\\\\)", \\\n\ start, "regex") == cmdstart))\n\ {\n\ wordtype = "register"\n\ res = search("^\\\\s*(?iNAMEREG)\\\\s+(?is[0-9A-F])\\\\s*,\\\\s*"word">", 0, "regex")\n\ if (res >= 0)\n\ res = $search_end\n\ }\n\ else if (search_string(" ADD ADDCY AND COMPARE LOAD OR RETURN RETURNI RL RR" \\\n\ " SL0 SL1 SLA SLX SR0 SR1 SRA SRX SUB SUBCY" \\\n\ " TEXT XOR ", " " toupper(cmd) " ", 0) >= 0 && \\\n\ (search(cmd "\\\\s+" word, start, "regex") == cmdstart || \\\n\ search(cmd "\\\\s+\\\\w+\\\\s*,\\\\s*\\\\(\\\\s*" word "\\\\s*\\\\)", \\\n\ start, "regex") == cmdstart))\n\ {\n\ wordtype = "register"\n\ res = search("^\\\\s*(?iNAMEREG)\\\\s+(?is[0-9A-F])\\\\s*,\\\\s*"word">", 0, "regex")\n\ if (res >= 0)\n\ res = $search_end\n\ }\n\ else\n\ {\n\ wordtype = "constant"\n\ res = search("^\\\\s*(?iCONSTANT)\\\\s+"word">", 0, "regex")\n\ if (res >= 0)\n\ res = $search_end\n\ }\n\ \n\ if (res >= 0)\n\ {\n\ set_cursor_pos(res)\n\ select(res - length(word), res)\n\ }\n\ else\n\ {\n\ return dialog("Definition of " wordtype " " word " not found\\n" \\\n\ "(taken from command " cmd ")")\n\ }\n\ }\n\ Open selected@*:Shift+Ctrl+Y::: {\n\ # Try to find a file whose name matches the given string, allowing for\n\ # simple environment variable (as $env or ${env}) substitution.\n\ \n\ # pick up our string - a simple selection if any, or the current word\n\ sel = get_selection("any")\n\ if (search_string(sel, "(?n\\\\s)", 0, "regex") >= 0)\n\ {\n\ # selection contains spaces/newlines: ignore it\n\ sel = ""\n\ }\n\ \n\ if (sel == "")\n\ {\n\ # find current "word" (contiguous non-spaces)\n\ pos = $cursor\n\ if (pos != 0)\n\ {\n\ pos = search("\\\\s", pos - 1, "regex", "backward") + 1\n\ }\n\ end = search("\\\\s|$", pos, "regex")\n\ sel = get_range(pos, end)\n\ }\n\ \n\ if (sel == "")\n\ {\n\ sel = string_dialog("Enter a file name to open", "OK", "Cancel")\n\ if ($string_dialog_button != 1 || sel == "")\n\ return\n\ }\n\ \n\ # now we have our strings, try to resolve simple env-var substitutions\n\ hasDollar = 1\n\ cumul = ""\n\ rest = sel\n\ while (hasDollar)\n\ {\n\ pos = search_string(rest, "(?= 0)\n\ {\n\ end = $search_end\n\ # extract the variable name\n\ var = substring(rest, pos + 1, end)\n\ var = replace_in_string(var, "[{}]", "", "regex", "copy")\n\ \n\ # list_dialog("Substituting:", \\\n\ # "old rest = '" rest "' \\n" \\\n\ # "old cumul = '" cumul "' \\n" \\\n\ # " var = '" var "' \\n" \\\n\ # " value = '" getenv(var) "' \\n" \\\n\ # "new cumul = '" cumul substring(rest, 0, pos) getenv(var) "' \\n" \\\n\ # "new rest = '" substring(rest, end) "' \\n")\n\ \n\ # add the prefix and variable value to cumul\n\ cumul = cumul substring(rest, 0, pos) getenv(var)\n\ # cut off the used part of rest\n\ rest = substring(rest, end)\n\ }\n\ else\n\ {\n\ cumul = cumul rest\n\ hasDollar = 0\n\ }\n\ }\n\ \n\ # now we have all we need in cumul\n\ line = -1\n\ filename = cumul\n\ if (filename != "")\n\ {\n\ file = NEDIT_find_file_in_pathlist(filename, $file_path)\n\ if (file == "" && search_string(filename, ":\\\\d+(?::.*)?$", 0, "regex") > 0)\n\ {\n\ num = replace_in_string(filename, "^.*?:(\\\\d+)(?::.*)?$", "\\\\1", "regex") + 0\n\ filename = replace_in_string(filename, "^(.*?):\\\\d+(?::.*)?$", "\\\\1", "regex")\n\ file = NEDIT_find_file_in_pathlist(filename, $file_path)\n\ line = num\n\ }\n\ }\n\ else\n\ {\n\ filename = sel\n\ file = ""\n\ }\n\ \n\ if (file == "")\n\ return dialog("Could not find file:\\n " filename)\n\ \n\ open(file)\n\ focus_window(file)\n\ raise_window(file, "focus")\n\ if (line >= 1)\n\ goto_line_number(line)\n\ }\n\ Open selected@C@C++:::: {\n\ macro_menu_command("Open selected@*")\n\ }\n\ C/C++ Prog>Open include@C@C++:Shift+Ctrl+Y::: {\n\ NEDIT_require_macro_file("open_incl.nm")\n\ \n\ if ($selection_start >= 0)\n\ {\n\ f = get_selection()\n\ open_include(f)\n\ }\n\ else\n\ open_include()\n\ }\n\ C/C++ Prog>Change path for open include@C@C++:::: {\n\ NEDIT_require_macro_file("open_incl.nm")\n\ \n\ open_include_changePath()\n\ }\n\ C/C++ Prog>C Comments>Cartouche@C@C++:::: {\n\ beginning_of_line()\n\ insert_string("/* -------------------------------------------------------------------------- */")\n\ newline()\n\ beginning_of_line()\n\ insert_string("/* -------------------------------------------------------------------------- */")\n\ newline()\n\ newline()\n\ process_up()\n\ process_up()\n\ beginning_of_line()\n\ insert_string("/* ")\n\ newline()\n\ process_up()\n\ end_of_line()\n\ }\n\ C/C++ Prog>C Comments>Comment Out Sel.@C@C++:::R: {\n\ selStart = $selection_start\n\ selEnd = $selection_end\n\ replace_range(selStart, selEnd, "/* " get_selection() " */")\n\ select(selStart, selEnd + 6)\n\ }\n\ C/C++ Prog>C Comments>C Uncomment Sel.@C@C++:::R: {\n\ sel = get_selection()\n\ selStart = $selection_start\n\ selEnd = $selection_end\n\ commentStart = search_string(sel, "/*", 0)\n\ if (substring(sel, commentStart+2, commentStart+3) == " ")\n\ keepStart = commentStart + 3\n\ else\n\ keepStart = commentStart + 2\n\ keepEnd = search_string(sel, "*/", length(sel), "backward")\n\ commentEnd = keepEnd + 2\n\ if (substring(sel, keepEnd - 1, keepEnd) == " ")\n\ keepEnd = keepEnd - 1\n\ replace_range(selStart + commentStart, selStart + commentEnd, \\\n\ substring(sel, keepStart, keepEnd))\n\ select(selStart, selEnd - (keepStart-commentStart) - \\\n\ (commentEnd - keepEnd))\n\ }\n\ C/C++ Prog>C Comments>+ C++ Comment@C++:::R: {\n\ replace_in_selection("^.*$", "// &", "regex")\n\ }\n\ C/C++ Prog>C Comments>- C++ Comment@C++:::R: {\n\ replace_in_selection("(^[ \\\\t]*// ?)(.*)$", "\\\\2", "regex")\n\ }\n\ C/C++ Prog>C Comments>+ C Bar Comment 1@C:::R: {\n\ if ($selection_left != -1) {\n\ dialog("Selection must not be rectangular")\n\ return\n\ }\n\ start = $selection_start\n\ end = $selection_end-1\n\ origText = get_range($selection_start, $selection_end-1)\n\ newText = "/*\\n" replace_in_string(get_range(start, end), \\\n\ "^", " * ", "regex") "\\n */\\n"\n\ replace_selection(newText)\n\ select(start, start + length(newText))\n\ }\n\ C/C++ Prog>C Comments>- C Bar Comment 1@C:::R: {\n\ selStart = $selection_start\n\ selEnd = $selection_end\n\ newText = get_range(selStart+3, selEnd-4)\n\ newText = replace_in_string(newText, "^ \\\\* ", "", "regex")\n\ replace_range(selStart, selEnd, newText)\n\ select(selStart, selStart + length(newText))\n\ }\n\ C/C++ Prog>C Comments>Comment C++ comments for C@C:::: {\n\ replace("(^|[^*])(//.*)", "\\\\1/\\\\*\\\\2 \\\\*/", "regex")\n\ }\n\ C/C++ Prog>C Comments>Uncomment C++ comments for C@C:::: {\n\ replace("/\\\\*(//.*) \\\\*/$", "\\\\1", "regex")\n\ }\n\ C/C++ Prog>Redo C styles@C@C++:::: {\n\ # remove spaces in the context "word (" or "word ["\n\ while (search("([a-zA-Z0-9_])\\\\s+([[(])", 0, "regex") >= 0)\n\ replace_all("([a-zA-Z0-9_])\\\\s+([[(])", "\\\\1\\\\2", "regex")\n\ # remove spaces in "( ... )" and "[ ... ]"\n\ while (search("(\\\\S)\\\\s+([])])", 0, "regex") >= 0)\n\ replace_all("(\\\\S)\\\\s+([])])", "\\\\1\\\\2", "regex")\n\ while (search("([[(])\\\\s+", 0, "regex") >= 0)\n\ replace_all("([[(])\\\\s+", "\\\\1", "regex")\n\ \n\ # tighten semicolons, commas to preceding text\n\ while (search("(?<=\\\\S)[ \\\\t]+([,;])", 0, "regex") >= 0)\n\ replace_all("(?<=\\\\S)[ \\\\t]+([,;])", "\\\\1", "regex")\n\ \n\ # add a single space after these keywords and following "(" or "["\n\ keyword = "()([\\\\[\\\\(])"\n\ while (search(keyword, 0, "regex") >= 0)\n\ replace_all(keyword, "\\\\1 \\\\2", "regex")\n\ \n\ # move "*" and "&" in casts\n\ while (search("([a-zA-Z0-9_])([*&]+)([ \\\\t]+)", 0, "regex") >= 0)\n\ replace_all("([a-zA-Z0-9_])([*&]+)([ \\\\t]+)", "\\\\1\\\\3\\\\2", "regex")\n\ while (search("([a-zA-Z0-9_])([*&]+)([>)])", 0, "regex") >= 0)\n\ replace_all("([a-zA-Z0-9_])([*&]+)([>)])", "\\\\1 \\\\2\\\\3", "regex")\n\ while (search("\\\\*\\\\)[ \\\\t]+", 0, "regex") >= 0)\n\ replace_all("\\\\*\\\\)[ \\\\t]+", "\\\\*\\\\)", "regex")\n\ }\n\ C/C++ Prog>Make C Prototypes@C@C++:::: {\n\ if ($selection_start == -1) {\n\ start = 0\n\ end = $text_length\n\ } else {\n\ start = $selection_start\n\ end = $selection_end\n\ }\n\ string = get_range(start, end)\n\ nDefs = 0\n\ searchPos = 0\n\ prototypes = ""\n\ staticPrototypes = ""\n\ keywords = "[ \\t]*[ \\t]*\\\\("\n\ C_cmnt = "(/\\\\*([^*]|\\n|\\\\*[^/])*\\\\*/)"\n\ CPP_cmnt = "(//.*\\n)"\n\ get_proto = "^[ \\t]*[a-zA-Z]" \\\n\ "([^;#\\"'{}=>= 0)\n\ continue\n\ if (substring(string, headerStart, headerStart+6) == "static")\n\ staticPrototypes = staticPrototypes prototype\n\ else\n\ prototypes = prototypes prototype\n\ nDefs++\n\ }\n\ if (nDefs == 0) {\n\ dialog("No function declarations found")\n\ return\n\ }\n\ new()\n\ focus_window("last")\n\ replace_range(0, 0, "/* external */\\n" prototypes "\\n/* static */\\n" staticPrototypes)\n\ set_language_mode("C")\n\ }\n\ C/C++ Prog>keyword expand@C@C++:Ctrl+Backslash::: {\n\ NEDIT_require_macro_file("c_expand.nm")\n\ \n\ if ($selection_start != -1)\n\ deselect_all()\n\ \n\ if (!c_expand())\n\ {\n\ beep()\n\ }\n\ \n\ pos = search("@[^@]*@", $cursor, "regex")\n\ if (pos != -1)\n\ {\n\ end = $search_end\n\ s = get_range(pos, $search_end)\n\ r = substring(s, 1, length(s) - 1)\n\ replace_range(pos, end, r)\n\ select(pos, end - 2)\n\ set_cursor_pos(end - 2)\n\ }\n\ }\n\ C/C++ Prog>next expand@C@C++:Shift+Ctrl+Backslash::: {\n\ pos = search("@[^@]*@", $cursor, "regex")\n\ if (pos != -1)\n\ {\n\ end = $search_end\n\ s = get_range(pos, $search_end)\n\ r = substring(s, 1, length(s) - 1)\n\ replace_range(pos, end, r)\n\ select(pos, end - 2)\n\ set_cursor_pos(end - 2)\n\ }\n\ }\n\ C/C++ Prog>extern "C"-ise@C@C++:::: {\n\ if (search("#ifdef __cplusplus", 0, "case") == -1)\n\ {\n\ deselect_all()\n\ end_of_file()\n\ \n\ insert_string("\\n#ifdef __cplusplus\\n}\\n#endif")\n\ find("#include ", "backward", "case")\n\ end_of_line()\n\ insert_string("\\n\\n#ifdef __cplusplus\\nextern \\"C\\" {\\n#endif\\n\\n")\n\ }\n\ else\n\ {\n\ beep()\n\ set_cursor_pos($search_end)\n\ }\n\ }\n\ C/C++ Prog>convert 0x?? to 'char' or "chars":::R: {\n\ NEDIT_require_macro_file("extensions.nm")\n\ \n\ beg = $selection_start\n\ fin = $selection_end\n\ \n\ prompt = "0x?? to 'char' or \\"chars\\": "\n\ if ($selection_left >= 0)\n\ return dialog(prompt "Please use a non-rectangular selection")\n\ s = get_range(beg, fin)\n\ old = s\n\ \n\ byChar = dialog(prompt "Convert to chars or string?", \\\n\ "Chars", "String", "Cancel")\n\ if (byChar < 1 || byChar > 2)\n\ return\n\ byChar = !(byChar - 1)\n\ \n\ ch0xRE = "(?i<0x[0-9a-f][0-9a-f]>)"\n\ seq0xRE = "(?n(?i<0x[0-9a-f][0-9a-f]?>(?:\\\\s*,\\\\s*<0x[0-9a-f][0-9a-f]?>)*))"\n\ \n\ end = 0\n\ for (pos = search_string(s, seq0xRE, end, "regex"); \\\n\ pos >= 0; \\\n\ pos = search_string(s, seq0xRE, end, "regex"))\n\ {\n\ x = substring(s, pos, $search_end)\n\ end = $search_end\n\ # convert to 2 hex digits\n\ x = replace_in_string(x, "(?i0x([0-9a-f])>)", "0x0\\\\1", "regex", "copy")\n\ if (byChar)\n\ {\n\ xe = 0\n\ for (xp = search_string(x, ch0xRE, xe, "regex"); \\\n\ xp >= 0; \\\n\ xp = search_string(x, ch0xRE, xe, "regex"))\n\ {\n\ xe = $search_end\n\ cpt = hex_to_int(substring(x, xe - 2, xe))\n\ if (cpt)\n\ ch = quote_literal_as_c(tochar(cpt))\n\ else\n\ ch = "\\\\0"\n\ x = substring(x, 0, xp) "'" ch "'" substring(x, xe)\n\ xe = xp + length(ch) + 2\n\ }\n\ }\n\ else\n\ {\n\ x = replace_in_string(x, "(?n(?:\\\\s*,\\\\s*)?0x)", "", "regex", "copy")\n\ x = hex2_to_str(x)\n\ x = "\\"" quote_literal_as_c(x) "\\""\n\ x = replace_in_string(x, "[[[---!NUL!---]]]", "\\\\x00", "case", "copy")\n\ }\n\ s = substring(s, 0, pos) x substring(s, end)\n\ end = pos + length(x)\n\ }\n\ \n\ if (old != s)\n\ replace_range(beg, fin, s)\n\ }\n\ C/C++ Prog>convert text to "c-string":::R: {\n\ NEDIT_require_macro_file("extensions.nm")\n\ \n\ beg = $selection_start\n\ fin = $selection_end\n\ \n\ prompt = "Text to \\"C-String\\": "\n\ if ($selection_left >= 0)\n\ return dialog(prompt "Please use a non-rectangular selection")\n\ s = get_range(beg, fin)\n\ \n\ byLine = dialog(prompt "Break string at newlines?", \\\n\ "Yes", "No", "Cancel")\n\ if (byLine < 1 || byLine > 2)\n\ return\n\ byLine = (byLine == 1)\n\ \n\ if (byLine)\n\ lines = split(s, "\\n")\n\ else\n\ lines[0] = s\n\ \n\ n = lines[]\n\ x = "\\"" quote_literal_as_c(lines[0])\n\ for (i = 1; i < n; i++)\n\ {\n\ x = x "\\\\n\\"\\n\\"" quote_literal_as_c(lines[i])\n\ }\n\ x = x "\\""\n\ \n\ replace_range(beg, fin, x)\n\ }\n\ Move>Start of Select:Ctrl+Home::: {\n\ if ($selection_start != -1)\n\ beginning_of_selection()\n\ else\n\ beginning_of_file()\n\ }\n\ Move>End of Line:::: {\n\ end_of_line()\n\ }\n\ Move>End of Line Select:::: {\n\ end_of_line("extend")\n\ }\n\ Move>End of Select:Ctrl+End::: {\n\ if ($selection_start != -1)\n\ end_of_selection()\n\ else\n\ end_of_file()\n\ }\n\ Move>Goto selected line number:Shift+Ctrl+L::: {\n\ sel = get_selection("any")\n\ if (sel == "")\n\ {\n\ pos = $cursor\n\ while (pos > 0 && (search("\\\\d", pos - 1, "regex") == pos - 1))\n\ pos--\n\ if (search("\\\\d+", pos, "regex") != pos)\n\ {\n\ beep() # no digit here\n\ }\n\ else\n\ {\n\ end = $search_end\n\ goto_line_number(get_range(pos, end))\n\ }\n\ }\n\ \n\ # dialog("In file "$file_name": line "sel)\n\ goto_line_number(get_selection("any"))\n\ }\n\ Move>Smart Home:Alt+Home::: {\n\ # toggle between front of line and first non-space on line\n\ c = $cursor\n\ beginning_of_line()\n\ front = $cursor\n\ if (c == front)\n\ {\n\ first_char = search("[ \\t]*", front, "regex", "forward")\n\ if (first_char != -1)\n\ set_cursor_pos($search_end)\n\ }\n\ }\n\ Move>Goto Definition@*:Shift+Ctrl+E::: {\n\ # pick any selection\n\ s = get_selection("any")\n\ c = $cursor\n\ \n\ # if we're on a word, use it\n\ if (s == "")\n\ {\n\ b = search("<", $cursor, "regex", "backward")\n\ e = search(">", $cursor, "regex", "forward")\n\ if (b <= c && c <= e)\n\ s = get_range(b, e)\n\ }\n\ \n\ # must be a valid word!\n\ pos = search_string(s, "(?n^\\\\w+$)", 0, "regex")\n\ end = $search_end\n\ if (pos != 0 || end != length(s))\n\ s = string_dialog("Enter a tag name to look up", "OK", "Cancel")\n\ \n\ # if all still OK, try to find it!\n\ if (s != "" && $string_dialog_button == 1)\n\ find_definition(s)\n\ }\n\ Move>Goto Definition@C++:Shift+Ctrl+E::: {\n\ s = get_selection("any")\n\ c = $cursor\n\ \n\ scopedWord = "(?MultiTag>Find def@*:Ctrl+Bracketright::: {\n\ NEDIT_require_macro_file("multitags.nm")\n\ NEDIT_require_macro_file("centerline.nm")\n\ \n\ if ($multitags == "")\n\ {\n\ multitags_load_multitags_file()\n\ }\n\ \n\ s = ""\n\ if ($selection_start == -1)\n\ {\n\ b = search("<", $cursor, "regex", "backward")\n\ e = search(">", $cursor, "regex", "forward")\n\ s = get_range(b, e)\n\ }\n\ else\n\ s = get_selection()\n\ \n\ if (s != "")\n\ {\n\ multitags_push_curpos()\n\ if (!multitags_choose_quick(s))\n\ {\n\ multitags_pop_curpos()\n\ deselect_all()\n\ }\n\ else\n\ {\n\ centerline()\n\ }\n\ }\n\ }\n\ Move>MultiTag>Find def@C@C++:Ctrl+Bracketright::: {\n\ NEDIT_require_macro_file("multitags.nm")\n\ NEDIT_require_macro_file("centerline.nm")\n\ \n\ if ($multitags == "")\n\ {\n\ multitags_load_all_multitags_file()\n\ }\n\ \n\ s = ""\n\ if ($selection_start == -1)\n\ {\n\ b = search("<", $cursor, "regex", "backward")\n\ e = search(">", $cursor, "regex", "forward")\n\ s = get_range(b, e)\n\ }\n\ else\n\ s = get_selection()\n\ \n\ if (s != "")\n\ {\n\ multitags_push_curpos()\n\ if (!multitags_choose_quick(s))\n\ {\n\ multitags_pop_curpos()\n\ deselect_all()\n\ }\n\ else\n\ {\n\ centerline()\n\ }\n\ }\n\ }\n\ Move>MultiTag>Find ?@*:::: {\n\ NEDIT_require_macro_file("multitags.nm")\n\ NEDIT_require_macro_file("centerline.nm")\n\ \n\ if ($multitags == "")\n\ {\n\ multitags_load_multitags_file()\n\ }\n\ \n\ s = string_dialog("Symbol", "OK", "Cancel")\n\ \n\ if ($string_dialog_button == 1 && s != "")\n\ {\n\ multitags_push_curpos()\n\ if (!multitags_choose_quick(s))\n\ {\n\ multitags_pop_curpos()\n\ deselect_all()\n\ }\n\ else\n\ {\n\ centerline()\n\ }\n\ }\n\ }\n\ Move>MultiTag>Find ?@C@C++:::: {\n\ NEDIT_require_macro_file("multitags.nm")\n\ NEDIT_require_macro_file("centerline.nm")\n\ \n\ if ($multitags == "")\n\ {\n\ multitags_load_all_multitags_file()\n\ }\n\ \n\ s = string_dialog("Symbol", "OK", "Cancel")\n\ \n\ if ($string_dialog_button == 1 && s != "")\n\ {\n\ multitags_push_curpos()\n\ if (!multitags_choose_quick(s))\n\ {\n\ multitags_pop_curpos()\n\ deselect_all()\n\ }\n\ else\n\ {\n\ centerline()\n\ }\n\ }\n\ }\n\ Move>MultiTag>Push:Ctrl+Bracketleft::: {\n\ NEDIT_require_macro_file("multitags.nm")\n\ \n\ multitags_push_curpos()\n\ }\n\ Move>MultiTag>Back:Shift+Ctrl+Bracketright::: {\n\ NEDIT_require_macro_file("multitags.nm")\n\ NEDIT_require_macro_file("centerline.nm")\n\ \n\ if (multitags_pop_curpos())\n\ centerline()\n\ }\n\ Move>MultiTag>Reload tags@*:::: {\n\ NEDIT_require_macro_file("multitags.nm")\n\ \n\ multitags_load_multitags_file("tags")\n\ }\n\ Move>MultiTag>Reload tags@C@C++:::: {\n\ NEDIT_require_macro_file("multitags.nm")\n\ \n\ multitags_forget_multitags_file()\n\ multitags_load_all_multitags_file("tags")\n\ }\n\ Move>MultiTag>Forget tags:::: {\n\ NEDIT_require_macro_file("multitags.nm")\n\ \n\ multitags_forget_multitags_file()\n\ }\n\ Move>MultiTag>Show tags files:::: {\n\ NEDIT_require_macro_file("multitags.nm")\n\ \n\ s = $multitags_files\n\ if (s == "" || s == "\\n")\n\ s = " (none)\\n"\n\ list_dialog("Multitags: Loaded tags file", $multitags_files)\n\ }\n\ Move>MultiTag>Load specific tags file:::: {\n\ NEDIT_require_macro_file("multitags.nm")\n\ \n\ s = string_dialog("Enter file path", "OK", "Cancel")\n\ if ($string_dialog_button == 1 && s != "")\n\ multitags_load_multitags_file(s)\n\ \n\ }\n\ Move>MultiTag>File symbols:::: {\n\ NEDIT_require_macro_file("multitags.nm")\n\ NEDIT_require_macro_file("centerline.nm")\n\ \n\ if ($multitags == "")\n\ {\n\ if ($language_mode == "C" || \\\n\ $language_mode == "C++")\n\ multitags_load_all_multitags_file()\n\ else\n\ multitags_load_multitags_file()\n\ }\n\ \n\ if (multitags_choose_in_file($file_name))\n\ centerline()\n\ }\n\ Move>MultiTag>Set stack:Shift+Ctrl+Alt+J::: {\n\ NEDIT_require_macro_file("multitags.nm")\n\ \n\ multitags_set_stack_length()\n\ }\n\ Move>MultiTag>Show stack:::: {\n\ NEDIT_require_macro_file("multitags.nm")\n\ NEDIT_require_macro_file("centerline.nm")\n\ \n\ if (multitags_choose_from($multitags_stack))\n\ centerline()\n\ }\n\ Move>MultiTag>Empty stack:::: {\n\ NEDIT_require_macro_file("multitags.nm")\n\ \n\ multitags_empty_stack()\n\ }\n\ Move>Go to Match:Shift+Ctrl+5::: {\n\ select($cursor, $cursor)\n\ cc = $cursor-1\n\ if (cc == -1)\n\ forward_character()\n\ c = get_character(cc)\n\ if (search_string("{}()[]<>\\"", c, 0) == -1)\n\ forward_character()\n\ \n\ match()\n\ \n\ if ($selection_start != -1)\n\ {\n\ if ($cursor == $selection_start+1)\n\ set_cursor_pos($selection_end)\n\ else\n\ set_cursor_pos($selection_start)\n\ }\n\ select($cursor, $cursor)\n\ }\n\ Move>Collapse Match:Ctrl+KP_Subtract::: {\n\ NEDIT_require_macro_file("fold.nm")\n\ \n\ if ($selection_start != -1)\n\ res = fold_selection()\n\ else\n\ res = fold_bracket_or_custom_match()\n\ if (!res)\n\ beep()\n\ }\n\ Move>Expand Match:Ctrl+KP_Add::: {\n\ NEDIT_require_macro_file("fold.nm")\n\ \n\ if (!fold_expand())\n\ beep()\n\ }\n\ Move>Position History>Save position:Ctrl+KP_Begin::: {\n\ $SAVE_POSITIONS[""] = ""\n\ $SAVE_POSITION_INDEX[""] = ""\n\ markers = "123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"\n\ file = $file_path $file_name\n\ \n\ if (!(file in $SAVE_POSITIONS))\n\ {\n\ $SAVE_POSITIONS[file] = ""\n\ $SAVE_POSITION_INDEX[file] = 0\n\ mark("0")\n\ }\n\ \n\ # save position operation stores a new marker letter at position index\n\ # in positions string, and increases the index (if no more more positions\n\ # are available, the first position marker is reused)\n\ \n\ positions = $SAVE_POSITIONS[file]\n\ index = $SAVE_POSITION_INDEX[file]\n\ \n\ # find a new marker char\n\ for (i = 0; i < length(markers); i++)\n\ {\n\ marker = substring(markers, i, i + 1)\n\ if (search_string(positions, marker, 0, "case") < 0)\n\ break\n\ }\n\ if (i >= length(markers)) # all used - steal the first one which isn't 0\n\ {\n\ pos = search_string(positions, "[^0]", 0, "regex")\n\ marker = substring(positions, pos, pos + 1)\n\ positions = replace_substring(positions, pos, pos + 1, "")\n\ if (index >= pos)\n\ index--\n\ }\n\ # mark our position\n\ #dialog("index: "index"\\npositions: "positions"\\nmarker: "marker"\\nfile = "file)\n\ mark(marker)\n\ # and insert it in the list\n\ positions = replace_substring(positions, index, index, marker)\n\ # now save info\n\ $SAVE_POSITIONS[file] = positions\n\ $SAVE_POSITION_INDEX[file] = index + 1\n\ }\n\ Move>Position History>Go back one position:Ctrl+KP_Left::: {\n\ $SAVE_POSITIONS[""] = ""\n\ $SAVE_POSITION_INDEX[""] = ""\n\ markers = "123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"\n\ file = $file_path $file_name\n\ \n\ if (!(file in $SAVE_POSITIONS))\n\ {\n\ $SAVE_POSITIONS[file] = ""\n\ $SAVE_POSITION_INDEX[file] = 0\n\ }\n\ \n\ # go back one position\n\ \n\ positions = $SAVE_POSITIONS[file]\n\ index = $SAVE_POSITION_INDEX[file]\n\ \n\ if (search_string(positions, "0", 0, "case") < 0)\n\ {\n\ mark("0") # for return to current cursor if we change our minds\n\ $SAVE_POSITIONS[file] = positions "0"\n\ }\n\ \n\ for (;;)\n\ {\n\ if (index <= 0)\n\ {\n\ beep()\n\ #dialog("No previous position stored\\nTotal stored: " length(positions))\n\ return\n\ }\n\ $SAVE_POSITION_INDEX[file] = --index\n\ marker = substring(positions, index, index + 1)\n\ if (marker != "0") # skip marker 0\n\ {\n\ pos = $cursor\n\ goto_mark(marker)\n\ if (pos != $cursor)\n\ break # exit loop if we've moved\n\ }\n\ }\n\ }\n\ Move>Position History>Go forward one position:Ctrl+KP_Right::: {\n\ $SAVE_POSITIONS[""] = ""\n\ $SAVE_POSITION_INDEX[""] = ""\n\ markers = "123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"\n\ file = $file_path $file_name\n\ \n\ if (!(file in $SAVE_POSITIONS))\n\ {\n\ $SAVE_POSITIONS[file] = ""\n\ $SAVE_POSITION_INDEX[file] = 0\n\ }\n\ \n\ # go forward one position\n\ \n\ positions = $SAVE_POSITIONS[file]\n\ index = $SAVE_POSITION_INDEX[file]\n\ \n\ if (search_string(positions, "0", 0, "case") < 0)\n\ {\n\ mark("0") # for return to current cursor if we change our minds\n\ $SAVE_POSITIONS[file] = positions "0"\n\ }\n\ \n\ for (;;)\n\ {\n\ if (index == length(positions))\n\ {\n\ beep()\n\ #dialog("No following position stored\\nTotal stored: " length(positions))\n\ return\n\ }\n\ marker = substring(positions, index, index + 1)\n\ $SAVE_POSITION_INDEX[file] = ++index\n\ if (marker != "0") # skip marker 0\n\ {\n\ pos = $cursor\n\ goto_mark(marker)\n\ if (pos != $cursor)\n\ break # exit loop if we've moved\n\ }\n\ }\n\ }\n\ Move>Position History>Jump back again:Ctrl+KP_Down::: {\n\ $SAVE_POSITIONS[""] = ""\n\ $SAVE_POSITION_INDEX[""] = ""\n\ markers = "123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"\n\ file = $file_path $file_name\n\ \n\ if (!(file in $SAVE_POSITIONS))\n\ {\n\ $SAVE_POSITIONS[file] = ""\n\ $SAVE_POSITION_INDEX[file] = 0\n\ mark("0")\n\ beep()\n\ return\n\ }\n\ \n\ $SAVE_POSITIONS[file] = replace_in_string($SAVE_POSITIONS[file], "0", "", "copy")\n\ goto_mark("0")\n\ }\n\ Move>Position History>Record jump back:Ctrl+KP_Up::: {\n\ $SAVE_POSITIONS[""] = ""\n\ $SAVE_POSITION_INDEX[""] = ""\n\ markers = "123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"\n\ file = $file_path $file_name\n\ \n\ if (!(file in $SAVE_POSITIONS))\n\ {\n\ $SAVE_POSITIONS[file] = ""\n\ $SAVE_POSITION_INDEX[file] = 0\n\ }\n\ \n\ $SAVE_POSITIONS[file] = $SAVE_POSITIONS[file] "0"\n\ mark("0")\n\ }\n\ Move>Position History>Forget positions:Ctrl+KP_Delete::: {\n\ $SAVE_POSITIONS[""] = ""\n\ $SAVE_POSITION_INDEX[""] = ""\n\ markers = "123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"\n\ file = $file_path $file_name\n\ \n\ if (file in $SAVE_POSITIONS)\n\ {\n\ delete $SAVE_POSITIONS[file]\n\ delete $SAVE_POSITION_INDEX[file]\n\ }\n\ }\n\ Edit>Paste selection to cursor:::: {\n\ sel = get_selection("any")\n\ if (sel == "")\n\ beep()\n\ else\n\ {\n\ replace_range($cursor, $cursor, sel)\n\ set_cursor_pos($cursor + length(sel))\n\ }\n\ }\n\ Edit>Delete back by Tab Stop:F12::: {\n\ NEDIT_require_macro_file("tabDelete.nm")\n\ \n\ tab_delete()\n\ }\n\ Edit>Delete forward by Tab Stop:Shift+F12::: {\n\ NEDIT_require_macro_file("tabDelete.nm")\n\ \n\ tab_delete_forward()\n\ }\n\ Edit>Insert Special>Non-breaking Space:::: {\n\ insert_string(" ")\n\ }\n\ Edit>Insert Special>Insert tab:Ctrl+Grave::: {\n\ insert_string("\\t")\n\ }\n\ Edit>Insert Special>ISO8859-1 Punctuation:::: {\n\ s = " ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿×÷"\n\ l = ""\n\ for (i = 0; i < length(s); i++)\n\ {\n\ if (i > 0 && i % 6 == 0)\n\ l = l "\\n"\n\ l = l " "(i % 6) ": " substring(s, i, i + 1) " "\n\ }\n\ \n\ s = ""\n\ while (s == "")\n\ {\n\ s = list_dialog("Choose a line and an index within it",\\\n\ l"\\n", "0", "1", "2", "3", "4", "5")\n\ b = $list_dialog_button\n\ if (b <= 0 || b > 6)\n\ return\n\ }\n\ \n\ b-- # from 0 to 5\n\ c = 7 * b + 4\n\ insert_string(substring(s, c, c + 1))\n\ }\n\ Edit>Insert Special>ISO8859-1 Accents:::: {\n\ s = "[A]: 0: À 1: Á 2:  3: à 4: Ä 5: Å 6: Æ\\n"\\\n\ "[a]: 0: à 1: á 2: â 3: ã 4: ä 5: å 6: æ\\n"\\\n\ "[E]: 0: È 1: É 2: Ê 3: Ë\\n"\\\n\ "[e]: 0: è 1: é 2: ê 3: ë\\n"\\\n\ "[I]: 0: Ì 1: Í 2: Î 3: Ï\\n"\\\n\ "[i]: 0: ì 1: í 2: î 3: ï\\n"\\\n\ "[O]: 0: Ò 1: Ó 2: Ô 3: Õ 4: Ö 5: Ø\\n"\\\n\ "[o]: 0: ò 1: ó 2: ô 3: õ 4: ö 5: ø\\n"\\\n\ "[U]: 0: Ù 1: Ú 2: Û 3: Ü\\n"\\\n\ "[u]: 0: ù 1: ú 2: û 3: ü\\n"\\\n\ "[Y]: 0: Ý 1: ý 2: ÿ\\n"\\\n\ "[CN]: 0: Ç 1: ç 2: Ñ 3: ñ\\n"\\\n\ "[ÐÞß]: 0: Ð 1: Þ 2: ð 3: þ 4: ß\\n"\n\ c = ""\n\ while (c == "")\n\ {\n\ x = list_dialog("Choose a line and an index within it",\\\n\ s, "No", "0", "1", "2", "3", "4", "5", "6")\n\ b = $list_dialog_button\n\ if (b < 2 || b > 8)\n\ return\n\ \n\ b -= 2\n\ i = 7 * b + 10\n\ c = substring(x, i, i + 1)\n\ if (c == "")\n\ beep()\n\ }\n\ insert_string(c)\n\ }\n\ Edit>Insert Special>ISO8859-1/ASCII Ctrl Chars:::: {\n\ \n\ lst = "| 0 x00 nul ^@ | 8 x08 bs ^H | 16 x10 dle ^P | 24 x18 can ^X |\\n" \\\n\ "| 1 x01 soh ^A | 9 x09 ht ^I | 17 x11 dc1 ^Q | 25 x19 em ^Y |\\n" \\\n\ "| 2 x02 stx ^B | 10 x0A nl ^J | 18 x12 dc2 ^R | 26 x1A sub ^Z |\\n" \\\n\ "| 3 x03 etx ^C | 11 x0B vt ^K | 19 x13 dc3 ^S | 27 x1B esc ^[ |\\n" \\\n\ "| 4 x04 eot ^D | 12 x0C np ^L | 20 x14 dc4 ^T | 28 x1C fs ^\\\\ |\\n" \\\n\ "| 5 x05 enq ^E | 13 x0D cr ^M | 21 x15 nak ^U | 29 x1D gs ^] |\\n" \\\n\ "| 6 x06 ack ^F | 14 x0E so ^N | 22 x16 syn ^V | 30 x1E rs ^^ |\\n" \\\n\ "| 7 x07 bel ^G | 15 x0F si ^O | 23 x17 etb ^W | 31 x1F us ^_ |\\n" \\\n\ "|127 x7F del ^? |160 xA0 nbsp |"\n\ ct = " \\x01\\x02\\x03\\x04\\x05\\x06\\x07\\x08\\x09\\x0a\\x0b\\x0c\\x0d\\x0e\\x0f" \\\n\ "\\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17\\x18\\x19\\x1a\\x1b\\x1c\\x1d\\x1e\\x1f"\n\ error = ""\n\ while (1)\n\ {\n\ l = list_dialog(error \\\n\ "Choose the character's line and click the column's button",\n\ lst, "1", "2", "3", "4", "Cancel")\n\ btn = $list_dialog_button\n\ if (btn < 1 || 4 < btn)\n\ return\n\ error = "Error: no line chosen\\n"\n\ if (l == "")\n\ continue\n\ error = "Error: no character in column " btn " of line\\n '" l "'\\n"\n\ a = split(l, "|")\n\ if (!(btn in a) || a[btn] == "")\n\ continue\n\ s = a[btn]\n\ i = replace_in_string(s, "\\\\D*(\\\\d+) .*", "\\\\1", "regex")\n\ if (i == "")\n\ continue\n\ error = "Error: cannot insert NUL"\n\ if (i == 0)\n\ continue\n\ error = ""\n\ if (i == 160)\n\ c = "\\xA0"\n\ else if (i == 127)\n\ c = "\\x7F"\n\ else\n\ c = substring(ct, i, i+1)\n\ insert_string(c)\n\ }\n\ }\n\ Edit>Insert Special>ISO8859-1 Accent compose:F12::: {\n\ accents = "`'\\"^~/*,"\n\ accRE = "["accents "]\\\\l|\\\\l["accents "]"\n\ \n\ subs = { .A = { ["`"] = "À", ["'"] = "Á", ["^"] = "Â", ["~"] = "Ã",\n\ ['"'] = "Ä", ["*"] = "Å" },\n\ .a = { ["`"] = "à", ["'"] = "á", ["^"] = "â", ["~"] = "ã",\n\ ['"'] = "ä", ["*"] = "å" },\n\ .E = { ["`"] = "È", ["'"] = "É", ["^"] = "Ê", ['"'] = "Ë" },\n\ .e = { ["`"] = "è", ["'"] = "é", ["^"] = "ê", ['"'] = "ë" },\n\ .I = { ["`"] = "Ì", ["'"] = "Í", ["^"] = "Î", ['"'] = "Ï" },\n\ .i = { ["`"] = "ì", ["'"] = "í", ["^"] = "î", ['"'] = "ï" },\n\ .O = { ["`"] = "Ò", ["'"] = "Ó", ["^"] = "Ô", ["~"] = "Õ",\n\ ['"'] = "Ö", ["/"] = "Ø" },\n\ .o = { ["`"] = "ò", ["'"] = "ó", ["^"] = "ô", ["~"] = "õ",\n\ ['"'] = "ö", ["/"] = "ø" },\n\ .U = { ["`"] = "Ù", ["'"] = "Ú", ["^"] = "Û", ['"'] = "Ü" },\n\ .u = { ["`"] = "ù", ["'"] = "ú", ["^"] = "û", ['"'] = "ü" },\n\ .Y = { ["'"] = "Ý" },\n\ .y = { ["'"] = "ý", ['"'] = "ÿ" },\n\ .C = { [","] = "Ç" },\n\ .c = { [","] = "ç" },\n\ .N = { ["~"] = "Ñ" },\n\ .n = { ["~"] = "ñ" } }\n\ \n\ ligs = { .ss = "ß",\n\ .TH = "Þ", .Th = "Þ", .th = "þ",\n\ .DH = "Ð", .Dh = "Ð", .dh = "ð",\n\ .AE = "Æ", .Ae = "Æ", .ae = "æ" }\n\ \n\ res = ""\n\ \n\ s = get_range($cursor - 2, $cursor)\n\ if (s in ligs)\n\ res = ligs[s]\n\ else if (search_string(s, accRE, 0, "regex") == 0 && $search_end == 2)\n\ {\n\ a = substring(s, 0, 1)\n\ b = substring(s, 1)\n\ if (search_string(accents, a, 0, "case") >= 0)\n\ {\n\ accent = a\n\ letter = b\n\ }\n\ else\n\ {\n\ accent = b\n\ letter = a\n\ }\n\ if (letter in subs)\n\ {\n\ sub1 = subs[letter]\n\ if (accent in sub1)\n\ res = sub1[accent]\n\ }\n\ }\n\ \n\ if (res == "")\n\ dialog("No accented character corresponds to '" s "'\\n", "Dismiss")\n\ else\n\ replace_range($cursor - 2, $cursor, res)\n\ }\n\ Edit>Delete line:::: {\n\ here = $cursor\n\ beginning_of_line()\n\ start = $cursor\n\ end_of_line()\n\ end = $cursor + 1\n\ set_cursor_pos(here)\n\ process_down()\n\ replace_range(start, end, "")\n\ }\n\ Edit>Delete to end:::: {\n\ if ($selection_start == -1) {\n\ if (get_character($cursor) == "\\n")\n\ delete_next_character()\n\ else\n\ delete_to_end_of_line()\n\ }\n\ else {\n\ delete_selection()\n\ }\n\ }\n\ Edit>Deselect:::: {\n\ if ($selection_start != -1)\n\ deselect_all()\n\ }\n\ Edit>Next window:::: {\n\ NEDIT_require_macro_file("win_nextprev.nm")\n\ \n\ win_next()\n\ }\n\ Edit>Prev window:::: {\n\ NEDIT_require_macro_file("win_nextprev.nm")\n\ \n\ win_prev()\n\ }\n\ Edit>Find in files>Find line@C:Ctrl+Alt+F::: {\n\ NEDIT_require_macro_file("grepfiles.nm")\n\ \n\ if ($selection_start == -1)\n\ greplines_from_prompt("./*.[ch] /dev/null")\n\ else\n\ {\n\ greplines("./*.[ch] /dev/null", get_selection())\n\ }\n\ }\n\ Edit>Find in files>Find line@C++:Ctrl+Alt+F::: {\n\ NEDIT_require_macro_file("grepfiles.nm")\n\ \n\ if ($selection_start == -1)\n\ greplines_from_prompt("./*.[CHch]* /dev/null")\n\ else\n\ {\n\ greplines("./*.[CHch]* /dev/null", get_selection())\n\ }\n\ }\n\ Edit>Find in files>Find line C/C++ (-R)@C@C++:::: {\n\ NEDIT_require_macro_file("grepfiles.nm")\n\ \n\ greplines_from_prompt_r("*.[cChH][+pP][+pP] *.[cChH] *.inl *.INL")\n\ }\n\ Edit>Find in files>Find line in *:Ctrl+Alt+F::: {\n\ NEDIT_require_macro_file("grepfiles.nm")\n\ \n\ if ($selection_start == -1)\n\ greplines_from_prompt("* /dev/null")\n\ else\n\ {\n\ greplines("* /dev/null", get_selection())\n\ }\n\ }\n\ Edit>Strip trailing space:::: {\n\ if ($selection_start == -1)\n\ {\n\ str = get_range(0, $text_length)\n\ mod = replace_in_string(str, "\\\\s+$", "", "regex", "copy")\n\ if (str != mod)\n\ replace_range(0, $text_length, mod)\n\ }\n\ else\n\ {\n\ str = get_selection()\n\ mod = replace_in_string(str, "\\\\s+$", "", "regex", "copy")\n\ if (str != mod)\n\ replace_selection(mod)\n\ }\n\ }\n\ Edit>ReDeTab>detab all tabs:::: {\n\ NEDIT_require_macro_file("redetab_re.nm")\n\ \n\ line = $line\n\ col = $column\n\ top = $top_line\n\ \n\ if ($selection_start >= 0)\n\ {\n\ beg = $selection_start\n\ end = $selection_end\n\ s = get_selection()\n\ beginning_of_selection()\n\ startcol = $column\n\ }\n\ else\n\ {\n\ beg = 0\n\ end = $text_length\n\ s = get_range(beg, end)\n\ startcol = 0\n\ }\n\ \n\ # detab all tabs\n\ t = detab_re(s, startcol, "keeptrailing", $tab_dist, "all")\n\ \n\ replace_range(beg, end, t)\n\ scroll_to_line(top)\n\ goto_line_number(line, col)\n\ scroll_to_line(top)\n\ deselect_all()\n\ }\n\ Edit>ReDeTab>retab all tabs:::: {\n\ NEDIT_require_macro_file("redetab_re.nm")\n\ \n\ line = $line\n\ col = $column\n\ top = $top_line\n\ \n\ if ($selection_start >= 0)\n\ {\n\ beg = $selection_start\n\ end = $selection_end\n\ s = get_selection()\n\ beginning_of_selection()\n\ startcol = $column\n\ }\n\ else\n\ {\n\ beg = 0\n\ end = $text_length\n\ s = get_range(beg, end)\n\ startcol = 0\n\ }\n\ \n\ # retab all tabs\n\ minspaces = string_dialog("minspaces", 1, 2, 3, 4, 5, 6, 7, 8)\n\ if (minspaces == "")\n\ minspaces = $string_dialog_button\n\ t = retab_re(s, startcol, "keeptrailing", $tab_dist, minspaces, "all")\n\ \n\ replace_range(beg, end, t)\n\ scroll_to_line(top)\n\ goto_line_number(line, col)\n\ scroll_to_line(top)\n\ deselect_all()\n\ }\n\ Edit>ReDeTab>detab only leading tabs:::: {\n\ NEDIT_require_macro_file("redetab_re.nm")\n\ \n\ line = $line\n\ col = $column\n\ top = $top_line\n\ \n\ if ($selection_start >= 0)\n\ {\n\ beg = $selection_start\n\ end = $selection_end\n\ s = get_selection()\n\ beginning_of_selection()\n\ startcol = $column\n\ }\n\ else\n\ {\n\ beg = 0\n\ end = $text_length\n\ s = get_range(beg, end)\n\ startcol = 0\n\ }\n\ \n\ # detab only leading tabs\n\ t = detab_re(s, startcol, "keeptrailing", $tab_dist, "leading")\n\ \n\ replace_range(beg, end, t)\n\ scroll_to_line(top)\n\ goto_line_number(line, col)\n\ scroll_to_line(top)\n\ deselect_all()\n\ }\n\ Edit>ReDeTab>retab only leading tabs:::: {\n\ NEDIT_require_macro_file("redetab_re.nm")\n\ \n\ line = $line\n\ col = $column\n\ top = $top_line\n\ \n\ if ($selection_start >= 0)\n\ {\n\ beg = $selection_start\n\ end = $selection_end\n\ s = get_selection()\n\ beginning_of_selection()\n\ startcol = $column\n\ }\n\ else\n\ {\n\ beg = 0\n\ end = $text_length\n\ s = get_range(beg, end)\n\ startcol = 0\n\ }\n\ \n\ # retab only leading tabs\n\ t = retab_re(s, startcol, "keeptrailing", $tab_dist, 1, "leading")\n\ \n\ replace_range(beg, end, t)\n\ scroll_to_line(top)\n\ goto_line_number(line, col)\n\ scroll_to_line(top)\n\ deselect_all()\n\ }\n\ Edit>ReDeTab>Choose re/de-tab:Ctrl+5::: {\n\ $REDETAB[""] = 0\n\ \n\ dotidy = "Tidy line ends"\n\ notidy = "Don't tidy line ends"\n\ \n\ if (!(dotidy in $REDETAB))\n\ $REDETAB[dotidy] = 0\n\ \n\ val = $REDETAB[dotidy]\n\ \n\ if ($selection_start >= 0)\n\ {\n\ isSelect = 1\n\ scope = "Selection"\n\ selstart = $selection_start\n\ selend = $selection_end\n\ selleft = $selection_left\n\ selright = $selection_right\n\ }\n\ else\n\ {\n\ isSelect = 0\n\ scope = "Document"\n\ selstart = 0\n\ selend = $text_length\n\ selleft = -1\n\ selright = -1\n\ }\n\ line = $line\n\ column = $column\n\ \n\ options = "detab all tabs\\n" \\\n\ "retab all tabs\\n" \\\n\ "detab only leading tabs\\n" \\\n\ "retab only leading tabs"\n\ \n\ if (val)\n\ tidy = notidy\n\ else\n\ tidy = dotidy\n\ \n\ line = list_dialog("Choose tab replacement action", options, \\\n\ scope, tidy, "Cancel")\n\ btn = $list_dialog_button\n\ \n\ if (btn != 1 && btn != 2)\n\ return\n\ \n\ if (isSelect && ($selection_start != selstart))\n\ {\n\ beep()\n\ return\n\ }\n\ \n\ if (btn == 2)\n\ {\n\ val = !val\n\ $REDETAB[dotidy] = val\n\ }\n\ \n\ # tidy lines first?\n\ if (val)\n\ {\n\ old = get_range(selstart, selend)\n\ str = replace_in_string(old, "\\\\s+$", "", "regex", "copy")\n\ if (old != str)\n\ {\n\ replace_range(selstart, selend, str)\n\ if (isSelect)\n\ {\n\ selend = selstart + length(str)\n\ if (selleft >= 0)\n\ select_rectangle(selstart, selend, selleft, selright)\n\ else\n\ select(selstart, selend)\n\ }\n\ }\n\ }\n\ \n\ # now do the tab conversion\n\ if (line != "")\n\ macro_menu_command("Edit>ReDeTab>" line)\n\ \n\ # restore cursor\n\ goto_line_number(line, column)\n\ }\n\ Edit>ReDeTab>Old>Detab:::: {\n\ NEDIT_require_macro_file("redetab.nm")\n\ \n\ if ($selection_start != -1)\n\ redetab_selection("detab")\n\ else\n\ {\n\ s = detab(get_range(0, $text_length), 0, 0, 0, $tab_dist)\n\ replace_range(0, $text_length, s)\n\ }\n\ }\n\ Edit>ReDeTab>Old>Retab (for string)@C@C++@Java@JavaScript@Yacc@Awk@NEdit Macro:::R: {\n\ NEDIT_require_macro_file("redetab.nm")\n\ \n\ redetab_selection("retab", "\\"([^\\\\n\\\\\\\\\\"]|\\\\\\\\\\\\n|\\\\\\\\.)*\\"")\n\ }\n\ Edit>ReDeTab>Old>Retab:::R: {\n\ NEDIT_require_macro_file("redetab.nm")\n\ \n\ redetab_selection("retab")\n\ }\n\ Edit>ReDeTab>make test area:::: {\n\ NEDIT_require_macro_file("redetab_re.nm")\n\ # load_macro_file($NEDIT_MACRO_DIR"/redetab_re.nm")\n\ \n\ s="12345678"\n\ b=" "\n\ r = ""\n\ for (i = 0; i <= 8; i++)\n\ {\n\ for (j = 7; j >= 0; j--)\n\ {\n\ r = r substring(s, 0, length(s)-j) substring(b, 0, j) substring(b, 0, i) i "\\n"\n\ }\n\ }\n\ beginning_of_line()\n\ insert_string(r)\n\ \n\ s="12345678"\n\ b=" "\n\ r = ""\n\ l = ""\n\ for (i = 0; i <= 8; i++)\n\ {\n\ for (j = 7; j >= 0; j--)\n\ {\n\ r = r l \\\n\ substring(s, 0, length(s)-j) substring(b, 0, j) substring(b, 0, i) i "\\n"\n\ l = l " "\n\ }\n\ }\n\ beginning_of_line()\n\ insert_string(r)\n\ \n\ \n\ }\n\ Edit>Insert tab:Ctrl+Grave::: {\n\ insert_string("\\t")\n\ }\n\ Edit>Increase indent by tab:Ctrl+Tab::: {\n\ shift_right_by_tab()\n\ }\n\ Edit>Increase indent:Ctrl+Space::: {\n\ shift_right()\n\ }\n\ Edit>Decrease indent:Shift+Ctrl+Space::: {\n\ shift_left()\n\ }\n\ Edit>Decrease indent by tab:Shift+Ctrl+Tab::: {\n\ shift_left_by_tab()\n\ }\n\ Edit>Show tabs:::R: {\n\ NEDIT_require_macro_file("redetab.nm")\n\ \n\ showtabspace("display")\n\ }\n\ Edit>Complete Word>Recent@*:Shift+Ctrl+Alt+Space::: {\n\ NEDIT_require_macro_file("multitags.nm")\n\ NEDIT_require_macro_file("wordfinish.nm")\n\ \n\ if ($multitags_symbols == "")\n\ multitags_load_multitags_file()\n\ \n\ wordfinish($multitags_symbols)\n\ }\n\ Edit>Complete Word>Recent@C@C++:Shift+Ctrl+Alt+Space::: {\n\ NEDIT_require_macro_file("multitags.nm")\n\ NEDIT_require_macro_file("wordfinish.nm")\n\ \n\ if ($multitags_symbols == "")\n\ multitags_load_all_multitags_file()\n\ \n\ wordfinish($multitags_symbols)\n\ }\n\ Edit>Complete Word>Default:::: {\n\ NEDIT_require_macro_file("multitags.nm")\n\ NEDIT_require_macro_file("wordfinish.nm")\n\ \n\ if ($wordfinish_sym_list == "")\n\ {\n\ wordfinish_add_symfiles()\n\ }\n\ \n\ if ($multitags_symbols == "")\n\ {\n\ multitags_load_symbols()\n\ if ($multitags_symbols != "")\n\ wordfinish_add_symbols($multitags_symbols)\n\ }\n\ \n\ wordfinish($wordfinish_sym_list)\n\ }\n\ Edit>Complete Word>Forward@*:Alt+Right::: {\n\ NEDIT_require_macro_file("multitags.nm")\n\ NEDIT_require_macro_file("wordfinish.nm")\n\ \n\ if ($wordfinish_sym_list == "")\n\ {\n\ wordfinish_add_symfiles()\n\ }\n\ \n\ if ($multitags_symbols == "")\n\ {\n\ multitags_load_symbols()\n\ if ($multitags_symbols != "")\n\ wordfinish_add_symbols($multitags_symbols)\n\ }\n\ \n\ wordfinish($wordfinish_sym_list, "forward")\n\ }\n\ Edit>Complete Word>Forward@C@C++:Alt+Right::: {\n\ NEDIT_require_macro_file("multitags.nm")\n\ NEDIT_require_macro_file("wordfinish.nm")\n\ \n\ if ($wordfinish_sym_list == "")\n\ {\n\ wordfinish_add_symfiles()\n\ }\n\ \n\ if ($multitags_symbols == "")\n\ {\n\ if ($multitags == "")\n\ multitags_load_all_multitags_file()\n\ multitags_load_symbols()\n\ if ($multitags_symbols != "")\n\ wordfinish_add_symbols($multitags_symbols)\n\ }\n\ \n\ wordfinish($wordfinish_sym_list, "forward")\n\ }\n\ Edit>Complete Word>Backward@*:Alt+Left::: {\n\ NEDIT_require_macro_file("multitags.nm")\n\ NEDIT_require_macro_file("wordfinish.nm")\n\ \n\ if ($wordfinish_sym_list == "")\n\ {\n\ wordfinish_add_symfiles()\n\ }\n\ \n\ if ($multitags_symbols == "")\n\ {\n\ multitags_load_symbols()\n\ if ($multitags_symbols != "")\n\ wordfinish_add_symbols($multitags_symbols)\n\ }\n\ \n\ wordfinish($wordfinish_sym_list, "backward")\n\ }\n\ Edit>Complete Word>Backward@C@C++:Alt+Left::: {\n\ NEDIT_require_macro_file("multitags.nm")\n\ NEDIT_require_macro_file("wordfinish.nm")\n\ \n\ if ($wordfinish_sym_list == "")\n\ {\n\ wordfinish_add_symfiles()\n\ }\n\ \n\ if ($multitags_symbols == "")\n\ {\n\ multitags_load_all_multitags_file()\n\ multitags_load_symbols()\n\ if ($multitags_symbols != "")\n\ wordfinish_add_symbols($multitags_symbols)\n\ }\n\ \n\ wordfinish($wordfinish_sym_list, "backward")\n\ }\n\ Edit>Complete Word>Deselect:Alt+Down::: {\n\ if ($selection_start != -1)\n\ deselect_all()\n\ }\n\ Edit>Complete Word>Del Select:Alt+Up::R: {\n\ if ($selection_start != -1)\n\ replace_selection("")\n\ }\n\ Edit>Complete Word>Standard (old):::: {\n\ # Tuning parameters\n\ ScanDistance = 200\n\ \n\ # Search back to a word boundary to find the word to complete\n\ startScan = max(0, $cursor - ScanDistance)\n\ endScan = min($text_length, $cursor + ScanDistance)\n\ scanString = get_range(startScan, endScan)\n\ keyEnd = $cursor-startScan\n\ keyStart = search_string(scanString, "<", keyEnd, "backward", "regex")\n\ if (keyStart == -1)\n\ return\n\ keyString = "<" substring(scanString, keyStart, keyEnd)\n\ \n\ # search both forward and backward from the cursor position. Note that\n\ # using a regex search can lead to incorrect results if any of the special\n\ # regex characters is encountered, which is not considered a delimiter\n\ backwardSearchResult = search_string(scanString, keyString, keyStart-1, \\\n\ "backward", "regex")\n\ forwardSearchResult = search_string(scanString, keyString, keyEnd, "regex")\n\ if (backwardSearchResult == -1 && forwardSearchResult == -1) {\n\ beep()\n\ return\n\ }\n\ \n\ # if only one direction matched, use that, otherwise use the nearest\n\ if (backwardSearchResult == -1)\n\ matchStart = forwardSearchResult\n\ else if (forwardSearchResult == -1)\n\ matchStart = backwardSearchResult\n\ else {\n\ if (keyStart - backwardSearchResult <= forwardSearchResult - keyEnd)\n\ matchStart = backwardSearchResult\n\ else\n\ matchStart = forwardSearchResult\n\ }\n\ \n\ # find the complete word\n\ matchEnd = search_string(scanString, ">", matchStart, "regex")\n\ completedWord = substring(scanString, matchStart, matchEnd)\n\ \n\ # replace it in the window\n\ replace_range(startScan + keyStart, $cursor, completedWord)\n\ }\n\ Edit>Complete Word>Standard:::: {\n\ # This macro attempts to complete the current word by\n\ # finding another word in the same document that has\n\ # the same prefix; repeated invocations of the macro\n\ # (by repeated typing of its accelerator, say) cycles\n\ # through the alternatives found.\n\ # \n\ # This version avoids the need of initializing the global\n\ # variable in an external macro file\n\ $compWord[""] = ""\n\ \n\ if (!("wordEnd" in $compWord)) {\n\ $compWord["wordEnd"] = 0\n\ $compWord["repeat"] = 0\n\ $compWord["init"] = 0\n\ $compWord["wordStart"] = 0\n\ }\n\ \n\ if ($compWord["wordEnd"] == $cursor) {\n\ $compWord["repeat"] += 1\n\ }\n\ else {\n\ $compWord["repeat"] = 1\n\ $compWord["init"] = $cursor\n\ \n\ # search back to a word boundary to find the word to complete\n\ $compWord["wordStart"] = search("<\\\\l+", $cursor, "backward", "regex", "wrap")\n\ \n\ if ($compWord["wordStart"] == -1)\n\ return\n\ \n\ if ($search_end == $cursor)\n\ $compWord["word"] = get_range($compWord["wordStart"], $cursor)\n\ else\n\ return\n\ }\n\ s = $cursor\n\ for (i=0; i <= $compWord["repeat"]; i++)\n\ s = search($compWord["word"], s - 1, "backward", "regex", "wrap")\n\ \n\ if (s == $compWord["wordStart"]) {\n\ beep()\n\ $compWord["repeat"] = 0\n\ s = $compWord["wordStart"]\n\ se = $compWord["init"]\n\ }\n\ else\n\ se = search(">", s, "regex")\n\ \n\ replace_range($compWord["wordStart"], $cursor, get_range(s, se))\n\ \n\ $compWord["wordEnd"] = $cursor\n\ }\n\ Edit>Toggle case next:Ctrl+Alt+6::: {\n\ NEDIT_require_macro_file("extensions.nm")\n\ \n\ replace_range($cursor, $cursor+1, togglecase(get_character($cursor)))\n\ forward_character()\n\ }\n\ Edit>Toggle case sel:::R: {\n\ NEDIT_require_macro_file("extensions.nm")\n\ \n\ replace_selection(togglecase(get_selection()))\n\ }\n\ Edit>Capitalise Words:Ctrl+Alt+6:C:R: {\n\ NEDIT_require_macro_file("extensions.nm")\n\ \n\ s = get_selection()\n\ s = replace_in_string(s, "<(\\\\w)(\\\\w*)>", "\\\\U\\\\1\\\\L\\\\2", "regex", "copy")\n\ replace_selection(s)\n\ }\n\ HTML>directive@SGML HTML@XML:Shift+Ctrl+Period::R: {\n\ NEDIT_require_macro_file("html.nm")\n\ \n\ html_convert_to_markup()\n\ }\n\ HTML>dialog directive@SGML HTML@XML:Shift+Ctrl+Slash::: {\n\ NEDIT_require_macro_file("html.nm")\n\ \n\ $html_add_markup_brackets["last"] = html_ask_for_markup()\n\ }\n\ HTML>-a name-@SGML HTML:Ctrl+Alt+A::: {\n\ NEDIT_require_macro_file("html.nm")\n\ \n\ html_make_A_NAME()\n\ }\n\ HTML>-a href-@SGML HTML:Alt+A::: {\n\ NEDIT_require_macro_file("html.nm")\n\ \n\ html_make_A_HREF()\n\ }\n\ HTML>-tt-@SGML HTML:Alt+T::: {\n\ NEDIT_require_macro_file("html.nm")\n\ \n\ $html_add_markup_brackets["last"] = html_add_markup_brackets("tt")\n\ }\n\ HTML>-i-@SGML HTML:Alt+I::: {\n\ NEDIT_require_macro_file("html.nm")\n\ \n\ $html_add_markup_brackets["last"] = html_add_markup_brackets("i")\n\ }\n\ HTML>-b-@SGML HTML:Alt+B::: {\n\ NEDIT_require_macro_file("html.nm")\n\ \n\ $html_add_markup_brackets["last"] = html_add_markup_brackets("b")\n\ }\n\ HTML>-p-@SGML HTML:Shift+Ctrl+P::: {\n\ NEDIT_require_macro_file("html.nm")\n\ \n\ if ($selection_start != -1) {\n\ s = "

" get_selection() "

"\n\ replace_selection(s)\n\ fill_paragraph()\n\ end_of_selection()\n\ deselect_all()\n\ }\n\ else {\n\ $html_add_markup_brackets["last"] = html_add_markup_brackets("p")\n\ }\n\ }\n\ HTML>-strong-@SGML HTML:Shift+Ctrl+S::: {\n\ NEDIT_require_macro_file("html.nm")\n\ \n\ $html_add_markup_brackets["last"] = html_add_markup_brackets("strong")\n\ }\n\ HTML>-pre-@SGML HTML:::: {\n\ NEDIT_require_macro_file("html.nm")\n\ \n\ if ($selection_start == -1)\n\ {\n\ $html_add_markup_brackets["last"] = html_add_markup_brackets("pre")\n\ }\n\ else\n\ {\n\ sel = get_selection()\n\ e = $selection_start\n\ \n\ if (search_string(sel, "&", 0) != -1)\n\ sel = replace_in_string(sel, "&", "&")\n\ \n\ if (search_string(sel, "<", 0) != -1)\n\ sel = replace_in_string(sel, "<", "<")\n\ \n\ if (search_string(sel, ">", 0) != -1)\n\ sel = replace_in_string(sel, ">", ">")\n\ \n\ sel = "
\\n" sel "
\\n"\n\ \n\ replace_selection(sel)\n\ deselect_all()\n\ set_cursor_pos(e)\n\ }\n\ }\n\ HTML>-repeat markup-@SGML HTML:::: {\n\ NEDIT_require_macro_file("html.nm")\n\ \n\ $html_add_markup_brackets[""] = 0\n\ if (("last" in $html_add_markup_brackets) && \\\n\ $html_add_markup_brackets["last"] != "")\n\ html_add_markup_brackets($html_add_markup_brackets["last"])\n\ else\n\ $html_add_markup_brackets["last"] = html_ask_for_markup()\n\ }\n\ HTML>&entities;@SGML HTML@XML:::R: {\n\ NEDIT_require_macro_file("html.nm")\n\ \n\ s = html_entities()\n\ replace_selection(s)\n\ }\n\ HTML>&entities; (all)@SGML HTML@XML:::R: {\n\ NEDIT_require_macro_file("html.nm")\n\ \n\ s = html_entities("", "all")\n\ replace_selection(s)\n\ }\n\ HTML>"..." to &[lr]dquo;@SGML HTML@XML:::: {\n\ NEDIT_require_macro_file("html.nm")\n\ NEDIT_require_macro_file("DEBUG.nm")\n\ \n\ attrname="[-:\\\\w]+"\n\ attrval="(?:\\"[^\\">]*\\"|'[^'>]*'|(?:(?!\\\\>|/\\\\s*\\\\>|\\\\s).))\\\\s*"\n\ attrs=attrname "=" attrval\n\ tag="\\\\"\n\ \n\ rs = rangeset_create()\n\ \n\ if ($DEBUG_ENABLE) rangeset_set_color(rs, "lightgreen")\n\ \n\ if (!rs)\n\ {\n\ return dialog("Macro\\n HTML>\\"...\\" to &[lr]dquo;@SGML HTML@XML\\n" \\\n\ "failed to create a rangeset", "Cancel")\n\ }\n\ \n\ # exclude any text in normal tags '<', '>'\n\ end = 0\n\ pos = 0\n\ for (pos = search(tag, 0, "regex"); pos >= 0; pos = search(tag, end, "regex"))\n\ {\n\ end = $search_end\n\ rangeset_add(rs, pos, end)\n\ }\n\ \n\ # exclude any text in )"\n\ \n\ for (pos = search(tag, 0, "regex"); pos >= 0; pos = search(tag, end, "regex"))\n\ {\n\ end = $search_end\n\ rangeset_add(rs, pos, end)\n\ }\n\ \n\ # exclude any text in