| author | wenzelm | 
| Sat, 15 Feb 2025 14:37:41 +0100 | |
| changeset 82181 | a0d1d772ccab | 
| parent 82180 | 1fad64843239 | 
| child 82182 | 137559b26f74 | 
| permissions | -rw-r--r-- | 
| 77566 
2a99fcb283ee
renamed administrative tools to build Isabelle components (unrelated to "isabelle build");
 wenzelm parents: 
76548diff
changeset | 1 | /* Title: Pure/Admin/component_jedit.scala | 
| 73653 | 2 | Author: Makarius | 
| 3 | ||
| 73987 
fc363a3b690a
build.props for isabelle.jar, including isabelle.jedit;
 wenzelm parents: 
73983diff
changeset | 4 | Build component for jEdit text-editor. | 
| 73653 | 5 | */ | 
| 6 | ||
| 7 | package isabelle | |
| 8 | ||
| 9 | ||
| 73983 | 10 | import java.nio.charset.Charset | 
| 11 | ||
| 12 | import scala.jdk.CollectionConverters._ | |
| 13 | ||
| 14 | ||
| 77566 
2a99fcb283ee
renamed administrative tools to build Isabelle components (unrelated to "isabelle build");
 wenzelm parents: 
76548diff
changeset | 15 | object Component_JEdit {
 | 
| 73660 | 16 | /* modes */ | 
| 17 | ||
| 75393 | 18 |   object Mode {
 | 
| 73660 | 19 |     val empty: Mode = new Mode("", "", Nil)
 | 
| 20 | ||
| 21 | val init: Mode = | |
| 22 | empty + | |
| 82121 | 23 |         ("noWordSep" -> Symbol.decode("""_'?\<^sub>\^<>""")) +
 | 
| 82122 | 24 |         ("unalignedOpenBrackets" -> Symbol.open_brackets_decoded) +
 | 
| 25 |         ("unalignedCloseBrackets" -> Symbol.close_brackets_decoded) +
 | |
| 73660 | 26 |         ("tabSize" -> "2") +
 | 
| 27 |         ("indentSize" -> "2")
 | |
| 28 | ||
| 75393 | 29 |     val list: List[Mode] = {
 | 
| 73660 | 30 |       val isabelle_news: Mode = init.define("isabelle-news", "Isabelle NEWS")
 | 
| 31 | ||
| 32 | val isabelle: Mode = | |
| 33 |         init.define("isabelle", "Isabelle theory") +
 | |
| 34 |           ("commentStart" -> "(*") +
 | |
| 35 |           ("commentEnd" -> "*)")
 | |
| 36 | ||
| 37 |       val isabelle_ml: Mode = isabelle.define("isabelle-ml", "Isabelle/ML")
 | |
| 38 | ||
| 39 |       val isabelle_root: Mode = isabelle.define("isabelle-root", "Isabelle session root")
 | |
| 40 | ||
| 41 |       val isabelle_options: Mode = isabelle.define("isabelle-options", "Isabelle options")
 | |
| 42 | ||
| 43 | val sml: Mode = | |
| 44 |         init.define("sml", "Standard ML") +
 | |
| 45 |           ("commentStart" -> "(*") +
 | |
| 46 |           ("commentEnd" -> "*)") +
 | |
| 47 |           ("noWordSep" -> "_'")
 | |
| 48 | ||
| 49 | List(isabelle_news, isabelle, isabelle_ml, isabelle_root, isabelle_options, sml) | |
| 50 | } | |
| 51 | } | |
| 52 | ||
| 75393 | 53 |   final case class Mode private(name: String, description: String, rev_props: Properties.T) {
 | 
| 73660 | 54 | override def toString: String = name | 
| 55 | ||
| 56 | def define(a: String, b: String): Mode = new Mode(a, b, rev_props) | |
| 57 | ||
| 58 | def + (entry: Properties.Entry): Mode = | |
| 59 | new Mode(name, description, Properties.put(rev_props, entry)) | |
| 60 | ||
| 75393 | 61 |     def write(dir: Path): Unit = {
 | 
| 73660 | 62 | require(name.nonEmpty && description.nonEmpty, "Bad Isabelle/jEdit mode content") | 
| 63 | ||
| 64 | val properties = | |
| 65 | rev_props.reverse.map(p => | |
| 66 | Symbol.spaces(4) + | |
| 67 |           XML.string_of_tree(XML.elem(Markup("PROPERTY", List("NAME" -> p._1, "VALUE" -> p._2)))))
 | |
| 68 | ||
| 69 | File.write(dir + Path.basic(name).xml, | |
| 70 | """<?xml version="1.0" encoding="UTF-8"?> | |
| 71 | <!DOCTYPE MODE SYSTEM "xmode.dtd"> | |
| 72 | ||
| 73 | <!-- """ + XML.text(description) + """ mode --> | |
| 74 | <MODE> | |
| 73665 | 75 |   <PROPS>""" + properties.mkString("\n", "\n", "") + """
 | 
| 73660 | 76 | </PROPS> | 
| 77 | </MODE> | |
| 78 | """) | |
| 79 | } | |
| 80 | } | |
| 81 | ||
| 82 | ||
| 73653 | 83 | /* build jEdit component */ | 
| 84 | ||
| 85 | private val download_jars: List[(String, String)] = | |
| 86 | List( | |
| 87 | "https://repo1.maven.org/maven2/com/google/code/findbugs/jsr305/3.0.2/jsr305-3.0.2.jar" -> | |
| 88 | "jsr305-3.0.2.jar") | |
| 89 | ||
| 90 | private val download_plugins: List[(String, String)] = | |
| 91 | List( | |
| 92 | "Code2HTML" -> "0.7", | |
| 93 | "CommonControls" -> "1.7.4", | |
| 94 | "Console" -> "5.1.4", | |
| 95 | "ErrorList" -> "2.4.0", | |
| 74548 | 96 | "Highlight" -> "2.5", | 
| 73653 | 97 | "Navigator" -> "2.7", | 
| 98 | "SideKick" -> "1.8") | |
| 99 | ||
| 74104 | 100 | private def exclude_package(name: String): Boolean = | 
| 101 |     name.startsWith("de.masters_of_disaster.ant") ||
 | |
| 102 | name == "doclet" || | |
| 103 | name == "installer" | |
| 104 | ||
| 73653 | 105 | def build_jedit( | 
| 76518 | 106 | component_path: Path, | 
| 73653 | 107 | version: String, | 
| 108 | original: Boolean = false, | |
| 75393 | 109 | progress: Progress = new Progress | 
| 110 |   ): Unit = {
 | |
| 73653 | 111 |     Isabelle_System.require_command("ant", test = "-version")
 | 
| 112 |     Isabelle_System.require_command("patch")
 | |
| 113 | ||
| 76547 | 114 | val component_dir = Components.Directory(component_path).create(progress = progress) | 
| 74030 
39e05601faeb
more accurate scala_project, based on build.props of components;
 wenzelm parents: 
73987diff
changeset | 115 | |
| 73653 | 116 | |
| 117 | /* jEdit directory */ | |
| 118 | ||
| 119 | val jedit = "jedit" + version | |
| 120 | val jedit_patched = jedit + "-patched" | |
| 121 | ||
| 76518 | 122 | val jedit_dir = Isabelle_System.make_directory(component_path + Path.basic(jedit)) | 
| 123 | val jedit_patched_dir = component_path + Path.basic(jedit_patched) | |
| 82180 
1fad64843239
more accurate patch: change jEdit source directory and copy to installation directory;
 wenzelm parents: 
82179diff
changeset | 124 |     val source_dir = jedit_patched_dir + Path.basic("jEdit")
 | 
| 73653 | 125 | |
| 75393 | 126 |     def download_jedit(dir: Path, name: String, target_name: String = ""): Path = {
 | 
| 73653 | 127 | val jedit_name = jedit + name | 
| 128 | val url = | |
| 129 | "https://sourceforge.net/projects/jedit/files/jedit/" + | |
| 130 | version + "/" + jedit_name + "/download" | |
| 73660 | 131 | val path = dir + Path.basic(proper_string(target_name) getOrElse jedit_name) | 
| 73653 | 132 | Isabelle_System.download_file(url, path, progress = progress) | 
| 133 | path | |
| 134 | } | |
| 135 | ||
| 75491 | 136 |     Isabelle_System.with_tmp_dir("build") { tmp_dir =>
 | 
| 73653 | 137 | /* original version */ | 
| 138 | ||
| 139 | val install_path = download_jedit(tmp_dir, "install.jar") | |
| 140 |       Isabelle_System.bash("""export CLASSPATH=""
 | |
| 141 | isabelle_java java -Duser.home=""" + File.bash_platform_path(tmp_dir) + | |
| 142 | " -jar " + File.bash_platform_path(install_path) + " auto " + | |
| 143 | File.bash_platform_path(jedit_dir) + " unix-script=off unix-man=off").check | |
| 144 | ||
| 145 | val source_path = download_jedit(tmp_dir, "source.tar.bz2") | |
| 76540 
83de6e9ae983
clarified signature: prefer Scala functions instead of shell scripts;
 wenzelm parents: 
76530diff
changeset | 146 | Isabelle_System.extract(source_path, jedit_dir) | 
| 73653 | 147 | |
| 148 | ||
| 149 | /* patched version */ | |
| 150 | ||
| 151 | Isabelle_System.copy_dir(jedit_dir, jedit_patched_dir) | |
| 152 | ||
| 82179 | 153 |       val source_org_dir = source_dir + Path.basic("org")
 | 
| 73653 | 154 |       val tmp_source_dir = tmp_dir + Path.basic("jEdit")
 | 
| 155 | ||
| 156 |       progress.echo("Patching jEdit sources ...")
 | |
| 157 |       for {
 | |
| 76527 | 158 |         file <- File.find_files(Path.explode("~~/src/Tools/jEdit/patches").file).sortBy(_.getName)
 | 
| 73653 | 159 | name = file.getName | 
| 75906 
2167b9e3157a
clarified signature: support for adhoc file types;
 wenzelm parents: 
75491diff
changeset | 160 | if !File.is_backup(name) | 
| 73653 | 161 |       } {
 | 
| 162 |         progress.bash("patch -p2 < " + File.bash_path(File.path(file)),
 | |
| 80224 
db92e0b6a11a
clarified signature: prefer symbolic isabelle.Path over physical java.io.File;
 wenzelm parents: 
77566diff
changeset | 163 | cwd = source_dir, echo = true).check | 
| 73653 | 164 | } | 
| 165 | ||
| 73660 | 166 |       for { theme <- List("classic", "tango") } {
 | 
| 167 |         val path = Path.explode("org/gjt/sp/jedit/icons/themes/" + theme + "/32x32/apps/isabelle.gif")
 | |
| 168 |         Isabelle_System.copy_file(Path.explode("~~/lib/logo/isabelle_transparent-32.gif"),
 | |
| 169 | source_dir + path) | |
| 170 | } | |
| 171 | ||
| 73653 | 172 |       progress.echo("Building jEdit ...")
 | 
| 173 | Isabelle_System.copy_dir(source_dir, tmp_source_dir) | |
| 81449 
d92d754b5dd9
removed obsolete option: jEdit 5.7.0 can be built with default jdk;
 wenzelm parents: 
81427diff
changeset | 174 |       progress.bash("ant", cwd = tmp_source_dir, echo = true).check
 | 
| 73653 | 175 |       Isabelle_System.copy_file(tmp_source_dir + Path.explode("build/jedit.jar"), jedit_patched_dir)
 | 
| 74030 
39e05601faeb
more accurate scala_project, based on build.props of components;
 wenzelm parents: 
73987diff
changeset | 176 | |
| 
39e05601faeb
more accurate scala_project, based on build.props of components;
 wenzelm parents: 
73987diff
changeset | 177 | val java_sources = | 
| 76527 | 178 |         (for {
 | 
| 82179 | 179 | file <- File.find_files(source_org_dir.file, file => File.is_java(file.getName)) | 
| 74104 | 180 | package_name <- Scala_Project.package_name(File.path(file)) | 
| 181 | if !exclude_package(package_name) | |
| 76527 | 182 | } yield File.path(component_path.java_path.relativize(file.toPath).toFile).implode).sorted | 
| 74030 
39e05601faeb
more accurate scala_project, based on build.props of components;
 wenzelm parents: 
73987diff
changeset | 183 | |
| 76518 | 184 | File.write(component_dir.build_props, | 
| 74057 | 185 | "module = " + jedit_patched + "/jedit.jar\n" + | 
| 186 | "no_build = true\n" + | |
| 74030 
39e05601faeb
more accurate scala_project, based on build.props of components;
 wenzelm parents: 
73987diff
changeset | 187 | "requirements = env:JEDIT_JARS\n" + | 
| 75221 | 188 |         ("sources =" :: java_sources.sorted.map("  " + _)).mkString("", " \\\n", "\n"))
 | 
| 75394 | 189 | } | 
| 73653 | 190 | |
| 191 | ||
| 192 | /* jars */ | |
| 193 | ||
| 194 |     val jars_dir = Isabelle_System.make_directory(jedit_patched_dir + Path.basic("jars"))
 | |
| 195 | ||
| 196 |     for { (url, name) <- download_jars } {
 | |
| 197 | Isabelle_System.download_file(url, jars_dir + Path.basic(name), progress = progress) | |
| 198 | } | |
| 199 | ||
| 82018 
d104c6ad04ee
suppress MacOS.jar from jEdit 5.7.0, following 65fd0f032a75;
 wenzelm parents: 
81449diff
changeset | 200 |     (jars_dir + Path.basic("MacOS.jar")).file.delete
 | 
| 
d104c6ad04ee
suppress MacOS.jar from jEdit 5.7.0, following 65fd0f032a75;
 wenzelm parents: 
81449diff
changeset | 201 | |
| 73653 | 202 |     for { (name, vers) <- download_plugins } {
 | 
| 75394 | 203 |       Isabelle_System.with_tmp_file("tmp", ext = "zip") { zip_path =>
 | 
| 73653 | 204 | val url = | 
| 205 | "https://sourceforge.net/projects/jedit-plugins/files/" + name + "/" + vers + "/" + | |
| 206 | name + "-" + vers + "-bin.zip/download" | |
| 207 | Isabelle_System.download_file(url, zip_path, progress = progress) | |
| 76530 | 208 | Isabelle_System.extract(zip_path, jars_dir) | 
| 75394 | 209 | } | 
| 73653 | 210 | } | 
| 211 | ||
| 212 | ||
| 73660 | 213 | /* resources */ | 
| 214 | ||
| 73983 | 215 |     val keep_encodings = List("ISO-8859-1", "ISO-8859-15", "US-ASCII", "UTF-8", "windows-1252")
 | 
| 216 | val drop_encodings = | |
| 217 | Charset.availableCharsets().keySet().asScala.toList.sorted.filterNot(keep_encodings.contains) | |
| 218 | ||
| 82180 
1fad64843239
more accurate patch: change jEdit source directory and copy to installation directory;
 wenzelm parents: 
82179diff
changeset | 219 |     File.write(source_dir + Path.explode("properties/jEdit.props"),
 | 
| 73660 | 220 | """#jEdit properties | 
| 221 | autoReloadDialog=false | |
| 222 | buffer.deepIndent=false | |
| 223 | buffer.encoding=UTF-8-Isabelle | |
| 224 | buffer.indentSize=2 | |
| 225 | buffer.lineSeparator=\n | |
| 226 | buffer.maxLineLen=100 | |
| 227 | buffer.noTabs=true | |
| 228 | buffer.sidekick.keystroke-parse=false | |
| 229 | buffer.tabSize=2 | |
| 230 | buffer.undoCount=1000 | |
| 231 | close-docking-area.shortcut2=C+e C+CIRCUMFLEX | |
| 232 | complete-word.shortcut= | |
| 233 | console.dock-position=floating | |
| 234 | console.encoding=UTF-8 | |
| 235 | console.font=Isabelle DejaVu Sans Mono | |
| 236 | console.fontsize=14 | |
| 237 | delete-line.shortcut=A+d | |
| 238 | delete.shortcut2=C+d | |
| 73983 | 239 | """ + drop_encodings.map(a => "encoding.opt-out." + a + "=true").mkString("\n") + """
 | 
| 73660 | 240 | encodingDetectors=BOM XML-PI buffer-local-property | 
| 241 | end.shortcut= | |
| 242 | expand-abbrev.shortcut2=CA+SPACE | |
| 243 | expand-folds.shortcut= | |
| 244 | fallbackEncodings=UTF-8 ISO-8859-15 US-ASCII | |
| 245 | firstTime=false | |
| 246 | focus-buffer-switcher.shortcut2=A+CIRCUMFLEX | |
| 247 | foldPainter=Circle | |
| 248 | gatchan.highlight.overview=false | |
| 249 | helpviewer.font=Isabelle DejaVu Serif | |
| 250 | helpviewer.fontsize=12 | |
| 251 | home.shortcut= | |
| 252 | hypersearch-results.dock-position=right | |
| 253 | insert-newline-indent.shortcut= | |
| 254 | insert-newline.shortcut= | |
| 255 | isabelle-debugger.dock-position=floating | |
| 256 | isabelle-documentation.dock-position=left | |
| 257 | isabelle-export-browser.label=Browse theory exports | |
| 258 | isabelle-output.dock-position=bottom | |
| 259 | isabelle-output.height=174 | |
| 260 | isabelle-output.width=412 | |
| 261 | isabelle-query.dock-position=bottom | |
| 262 | isabelle-session-browser.label=Browse session information | |
| 263 | isabelle-simplifier-trace.dock-position=floating | |
| 264 | isabelle-sledgehammer.dock-position=bottom | |
| 265 | isabelle-state.dock-position=right | |
| 266 | isabelle-symbols.dock-position=bottom | |
| 267 | isabelle-theories.dock-position=right | |
| 268 | isabelle.antiquoted_cartouche.label=Make antiquoted cartouche | |
| 269 | isabelle.complete-word.label=Complete word | |
| 270 | isabelle.complete.label=Complete Isabelle text | |
| 271 | isabelle.complete.shortcut2=C+b | |
| 272 | isabelle.control-bold.label=Control bold | |
| 273 | isabelle.control-bold.shortcut=C+e RIGHT | |
| 274 | isabelle.control-emph.label=Control emphasized | |
| 275 | isabelle.control-emph.shortcut=C+e LEFT | |
| 276 | isabelle.control-reset.label=Control reset | |
| 277 | isabelle.control-reset.shortcut=C+e BACK_SPACE | |
| 278 | isabelle.control-sub.label=Control subscript | |
| 279 | isabelle.control-sub.shortcut=C+e DOWN | |
| 280 | isabelle.control-sup.label=Control superscript | |
| 281 | isabelle.control-sup.shortcut=C+e UP | |
| 282 | isabelle.decrease-font-size.label=Decrease font size | |
| 283 | isabelle.decrease-font-size.shortcut2=C+SUBTRACT | |
| 284 | isabelle.decrease-font-size.shortcut=C+MINUS | |
| 285 | isabelle.decrease-font-size2.label=Decrease font size (clone) | |
| 286 | isabelle.draft.label=Show draft in browser | |
| 287 | isabelle.exclude-word-permanently.label=Exclude word permanently | |
| 288 | isabelle.exclude-word.label=Exclude word | |
| 289 | isabelle.first-error.label=Go to first error | |
| 290 | isabelle.first-error.shortcut=CS+a | |
| 291 | isabelle.goto-entity.label=Go to definition of formal entity at caret | |
| 292 | isabelle.goto-entity.shortcut=CS+d | |
| 293 | isabelle.include-word-permanently.label=Include word permanently | |
| 294 | isabelle.include-word.label=Include word | |
| 295 | isabelle.increase-font-size.label=Increase font size | |
| 296 | isabelle.increase-font-size.shortcut2=C+ADD | |
| 297 | isabelle.increase-font-size.shortcut=C+PLUS | |
| 298 | isabelle.increase-font-size2.label=Increase font size (clone) | |
| 299 | isabelle.increase-font-size2.shortcut=C+EQUALS | |
| 300 | isabelle.java-monitor.label=Java/VM monitor | |
| 301 | isabelle.last-error.label=Go to last error | |
| 302 | isabelle.last-error.shortcut=CS+z | |
| 303 | isabelle.message.label=Show message | |
| 304 | isabelle.message.shortcut=CS+m | |
| 305 | isabelle.newline.label=Newline with indentation of Isabelle keywords | |
| 306 | isabelle.newline.shortcut=ENTER | |
| 307 | isabelle.next-error.label=Go to next error | |
| 308 | isabelle.next-error.shortcut=CS+n | |
| 309 | isabelle.options.label=Isabelle options | |
| 310 | isabelle.prev-error.label=Go to previous error | |
| 311 | isabelle.prev-error.shortcut=CS+p | |
| 312 | isabelle.preview.label=Show preview in browser | |
| 313 | isabelle.reset-continuous-checking.label=Reset continuous checking | |
| 314 | isabelle.reset-font-size.label=Reset font size | |
| 315 | isabelle.reset-node-required.label=Reset node required | |
| 316 | isabelle.reset-words.label=Reset non-permanent words | |
| 317 | isabelle.select-entity.label=Select all occurences of formal entity at caret | |
| 318 | isabelle.select-entity.shortcut=CS+ENTER | |
| 81300 
42ff2b915b1d
support Isabelle/jEdit action isabelle.select_structure;
 wenzelm parents: 
81297diff
changeset | 319 | isabelle.select-structure.label=Select structure around selection or caret | 
| 
42ff2b915b1d
support Isabelle/jEdit action isabelle.select_structure;
 wenzelm parents: 
81297diff
changeset | 320 | isabelle.select-structure.shortcut=C+7 | 
| 73660 | 321 | isabelle.set-continuous-checking.label=Set continuous checking | 
| 322 | isabelle.set-node-required.label=Set node required | |
| 323 | isabelle.toggle-breakpoint.label=Toggle Breakpoint | |
| 324 | isabelle.toggle-continuous-checking.label=Toggle continuous checking | |
| 325 | isabelle.toggle-continuous-checking.shortcut=C+e ENTER | |
| 326 | isabelle.toggle-node-required.label=Toggle node required | |
| 327 | isabelle.toggle-node-required.shortcut=C+e SPACE | |
| 328 | isabelle.tooltip.label=Show tooltip | |
| 329 | isabelle.tooltip.shortcut=CS+b | |
| 330 | isabelle.update-state.label=Update state output | |
| 331 | isabelle.update-state.shortcut=S+ENTER | |
| 332 | lang.usedefaultlocale=false | |
| 333 | largefilemode=full | |
| 334 | line-end.shortcut=END | |
| 335 | line-home.shortcut=HOME | |
| 336 | logo.icon.medium=32x32/apps/isabelle.gif | |
| 337 | lookAndFeel=com.formdev.flatlaf.FlatLightLaf | |
| 338 | match-bracket.shortcut2=C+9 | |
| 339 | metal.primary.font=Isabelle DejaVu Sans | |
| 340 | metal.primary.fontsize=12 | |
| 341 | metal.secondary.font=Isabelle DejaVu Sans | |
| 342 | metal.secondary.fontsize=12 | |
| 343 | navigator.showOnToolbar=true | |
| 344 | new-file-in-mode.shortcut= | |
| 345 | next-bracket.shortcut2=C+e C+9 | |
| 346 | options.shortcuts.deletekeymap.label=Delete | |
| 347 | options.shortcuts.duplicatekeymap.dialog.title=Keymap name | |
| 348 | options.shortcuts.duplicatekeymap.label=Duplicate | |
| 349 | options.shortcuts.resetkeymap.dialog.title=Reset keymap | |
| 350 | options.shortcuts.resetkeymap.label=Reset | |
| 351 | options.textarea.lineSpacing=1 | |
| 352 | plugin-blacklist.MacOSX.jar=true | |
| 353 | plugin.MacOSXPlugin.altDispatcher=false | |
| 354 | plugin.MacOSXPlugin.disableOption=true | |
| 355 | prev-bracket.shortcut2=C+e C+8 | |
| 356 | print.font=Isabelle DejaVu Sans Mono | |
| 357 | print.glyphVector=true | |
| 358 | recent-buffer.shortcut2=C+CIRCUMFLEX | |
| 359 | restore.remote=false | |
| 360 | restore=false | |
| 361 | search.subdirs.toggle=true | |
| 362 | select-block.shortcut2=C+8 | |
| 363 | sidekick-tree.dock-position=right | |
| 364 | sidekick.auto-complete-popup-get-focus=true | |
| 365 | sidekick.buffer-save-parse=true | |
| 366 | sidekick.complete-delay=0 | |
| 367 | sidekick.complete-instant.toggle=false | |
| 368 | sidekick.complete-popup.accept-characters=\\t | |
| 369 | sidekick.complete-popup.insert-characters= | |
| 370 | sidekick.persistentFilter=true | |
| 371 | sidekick.showFilter=true | |
| 372 | sidekick.splitter.location=721 | |
| 373 | systrayicon=false | |
| 374 | tip.show=false | |
| 375 | toggle-full-screen.shortcut2=S+F11 | |
| 376 | toggle-multi-select.shortcut2=C+NUMBER_SIGN | |
| 377 | toggle-rect-select.shortcut2=A+NUMBER_SIGN | |
| 378 | twoStageSave=false | |
| 379 | vfs.browser.dock-position=left | |
| 380 | vfs.favorite.0.type=1 | |
| 381 | vfs.favorite.0=$ISABELLE_HOME | |
| 382 | vfs.favorite.1.type=1 | |
| 383 | vfs.favorite.1=$ISABELLE_HOME_USER | |
| 384 | vfs.favorite.2.type=1 | |
| 385 | vfs.favorite.2=$JEDIT_HOME | |
| 386 | vfs.favorite.3.type=1 | |
| 387 | vfs.favorite.3=$JEDIT_SETTINGS | |
| 388 | vfs.favorite.4.type=1 | |
| 389 | vfs.favorite.4=isabelle-export: | |
| 390 | vfs.favorite.5.type=1 | |
| 391 | vfs.favorite.5=isabelle-session: | |
| 392 | view.antiAlias=subpixel HRGB | |
| 393 | view.blockCaret=true | |
| 394 | view.caretBlink=false | |
| 395 | view.docking.framework=PIDE | |
| 396 | view.eolMarkers=false | |
| 397 | view.extendedState=0 | |
| 398 | view.font=Isabelle DejaVu Sans Mono | |
| 399 | view.fontsize=18 | |
| 400 | view.fracFontMetrics=false | |
| 401 | view.gutter.font=Isabelle DejaVu Sans Mono | |
| 402 | view.gutter.fontsize=12 | |
| 403 | view.gutter.lineNumbers=false | |
| 404 | view.gutter.selectionAreaWidth=18 | |
| 405 | view.height=850 | |
| 406 | view.middleMousePaste=true | |
| 407 | view.showToolbar=true | |
| 408 | view.status.memory.background=#666699 | |
| 409 | view.status=( mode , fold , encoding ) locked wrap multiSelect rectSelect overwrite lineSep buffersets task-monitor java-status ml-status errors clock | |
| 410 | view.thickCaret=true | |
| 411 | view.width=1200 | |
| 412 | xml-insert-closing-tag.shortcut= | |
| 413 | """) | |
| 414 | ||
| 82180 
1fad64843239
more accurate patch: change jEdit source directory and copy to installation directory;
 wenzelm parents: 
82179diff
changeset | 415 |     val modes_dir = source_dir + Path.basic("modes")
 | 
| 73660 | 416 | |
| 417 | Mode.list.foreach(_.write(modes_dir)) | |
| 418 | ||
| 75202 | 419 |     File.change_lines(modes_dir + Path.basic("catalog")) { _.flatMap(line =>
 | 
| 420 |       if (line.containsSlice("FILE=\"ml.xml\"") ||
 | |
| 421 |         line.containsSlice("FILE_NAME_GLOB=\"*.{sml,ml}\"") ||
 | |
| 422 |         line.containsSlice("FILE_NAME_GLOB=\"*.ftl\"")) Nil
 | |
| 423 |       else if (line.containsSlice("NAME=\"jamon\"")) {
 | |
| 424 | List( | |
| 425 |           """<MODE NAME="isabelle" FILE="isabelle.xml" FILE_NAME_GLOB="{*.thy,ROOT0.ML,ROOT.ML}"/>""",
 | |
| 426 | "", | |
| 427 | """<MODE NAME="isabelle-ml" FILE="isabelle-ml.xml" FILE_NAME_GLOB="*.ML"/>""", | |
| 428 | "", | |
| 429 | """<MODE NAME="isabelle-news" FILE="isabelle-news.xml"/>""", | |
| 430 | "", | |
| 431 | """<MODE NAME="isabelle-options" FILE="isabelle-options.xml"/>""", | |
| 432 | "", | |
| 433 | """<MODE NAME="isabelle-root" FILE="isabelle-root.xml" FILE_NAME_GLOB="ROOT"/>""", | |
| 434 | "", | |
| 435 | line) | |
| 436 | } | |
| 437 |       else if (line.containsSlice("NAME=\"sqr\"")) {
 | |
| 438 | List( | |
| 439 |           """<MODE NAME="sml" FILE="sml.xml" FILE_NAME_GLOB="*.{sml,sig}"/>""",
 | |
| 440 | "", | |
| 441 | line) | |
| 442 | } | |
| 443 | else List(line)) | |
| 444 | } | |
| 73660 | 445 | |
| 82180 
1fad64843239
more accurate patch: change jEdit source directory and copy to installation directory;
 wenzelm parents: 
82179diff
changeset | 446 |     for (name <- List("keymaps", "macros", "modes", "properties", "startup")) {
 | 
| 
1fad64843239
more accurate patch: change jEdit source directory and copy to installation directory;
 wenzelm parents: 
82179diff
changeset | 447 | val path = Path.explode(name) | 
| 
1fad64843239
more accurate patch: change jEdit source directory and copy to installation directory;
 wenzelm parents: 
82179diff
changeset | 448 | Isabelle_System.rm_tree(jedit_patched_dir + path) | 
| 
1fad64843239
more accurate patch: change jEdit source directory and copy to installation directory;
 wenzelm parents: 
82179diff
changeset | 449 | Isabelle_System.copy_dir(source_dir + path, jedit_patched_dir) | 
| 
1fad64843239
more accurate patch: change jEdit source directory and copy to installation directory;
 wenzelm parents: 
82179diff
changeset | 450 | } | 
| 
1fad64843239
more accurate patch: change jEdit source directory and copy to installation directory;
 wenzelm parents: 
82179diff
changeset | 451 | |
| 73660 | 452 | |
| 453 | /* doc */ | |
| 454 | ||
| 455 |     val doc_dir = jedit_patched_dir + Path.basic("doc")
 | |
| 456 | ||
| 457 | download_jedit(doc_dir, "manual-a4.pdf", target_name = "jedit-manual.pdf") | |
| 458 | ||
| 459 | Isabelle_System.copy_file( | |
| 460 |       doc_dir + Path.basic("CHANGES.txt"), doc_dir + Path.basic("jedit-changes"))
 | |
| 461 | ||
| 462 |     File.write(doc_dir + Path.basic("Contents"),
 | |
| 463 | """Original jEdit Documentation | |
| 464 | jedit-manual jEdit User's Guide | |
| 465 | jedit-changes jEdit Version History | |
| 466 | ||
| 467 | """) | |
| 468 | ||
| 73653 | 469 | |
| 75229 | 470 | /* make patch */ | 
| 73653 | 471 | |
| 76518 | 472 | File.write(component_path + Path.basic(jedit).patch, | 
| 473 | Isabelle_System.make_patch(component_path, Path.basic(jedit), Path.basic(jedit_patched))) | |
| 73653 | 474 | |
| 475 | if (!original) Isabelle_System.rm_tree(jedit_dir) | |
| 476 | ||
| 477 | ||
| 74030 
39e05601faeb
more accurate scala_project, based on build.props of components;
 wenzelm parents: 
73987diff
changeset | 478 | /* settings */ | 
| 73653 | 479 | |
| 81427 
ecd62f7b3644
performance tuning for macOS (after update of "jedit" component): old OpenGL works better for text rendering;
 wenzelm parents: 
81300diff
changeset | 480 | // see also https://docs.oracle.com/en/java/javase/21/troubleshoot/java-2d-properties.html | 
| 
ecd62f7b3644
performance tuning for macOS (after update of "jedit" component): old OpenGL works better for text rendering;
 wenzelm parents: 
81300diff
changeset | 481 | |
| 76548 | 482 |     component_dir.write_settings("""
 | 
| 73987 
fc363a3b690a
build.props for isabelle.jar, including isabelle.jedit;
 wenzelm parents: 
73983diff
changeset | 483 | JEDIT_HOME="$COMPONENT/""" + jedit_patched + """" | 
| 
fc363a3b690a
build.props for isabelle.jar, including isabelle.jedit;
 wenzelm parents: 
73983diff
changeset | 484 | JEDIT_JARS=""" + quote(File.read_dir(jars_dir).map("$JEDIT_HOME/jars/" + _).mkString(":")) + """
 | 
| 
fc363a3b690a
build.props for isabelle.jar, including isabelle.jedit;
 wenzelm parents: 
73983diff
changeset | 485 | JEDIT_JAR="$JEDIT_HOME/jedit.jar" | 
| 
fc363a3b690a
build.props for isabelle.jar, including isabelle.jedit;
 wenzelm parents: 
73983diff
changeset | 486 | classpath "$JEDIT_JAR" | 
| 
fc363a3b690a
build.props for isabelle.jar, including isabelle.jedit;
 wenzelm parents: 
73983diff
changeset | 487 | |
| 
fc363a3b690a
build.props for isabelle.jar, including isabelle.jedit;
 wenzelm parents: 
73983diff
changeset | 488 | JEDIT_SETTINGS="$ISABELLE_HOME_USER/jedit" | 
| 
fc363a3b690a
build.props for isabelle.jar, including isabelle.jedit;
 wenzelm parents: 
73983diff
changeset | 489 | JEDIT_OPTIONS="-reuseview -nobackground -nosplash -log=9" | 
| 
fc363a3b690a
build.props for isabelle.jar, including isabelle.jedit;
 wenzelm parents: 
73983diff
changeset | 490 | JEDIT_JAVA_OPTIONS="-Xms512m -Xmx4g -Xss16m" | 
| 81427 
ecd62f7b3644
performance tuning for macOS (after update of "jedit" component): old OpenGL works better for text rendering;
 wenzelm parents: 
81300diff
changeset | 491 | JEDIT_JAVA_SYSTEM_OPTIONS="-Dsun.java2d.metal=false -Duser.language=en -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true -Dapple.laf.useScreenMenuBar=true -Dapple.awt.application.name=Isabelle" | 
| 73987 
fc363a3b690a
build.props for isabelle.jar, including isabelle.jedit;
 wenzelm parents: 
73983diff
changeset | 492 | |
| 
fc363a3b690a
build.props for isabelle.jar, including isabelle.jedit;
 wenzelm parents: 
73983diff
changeset | 493 | ISABELLE_DOCS="$ISABELLE_DOCS:$JEDIT_HOME/doc" | 
| 
fc363a3b690a
build.props for isabelle.jar, including isabelle.jedit;
 wenzelm parents: 
73983diff
changeset | 494 | """) | 
| 73653 | 495 | |
| 496 | ||
| 497 | /* README */ | |
| 498 | ||
| 76518 | 499 | File.write(component_dir.README, | 
| 73653 | 500 | """This is a slightly patched version of jEdit """ + version + """ from | 
| 501 | https://sourceforge.net/projects/jedit/files/jedit with some | |
| 502 | additional plugins jars from | |
| 503 | https://sourceforge.net/projects/jedit-plugins/files | |
| 504 | ||
| 505 | ||
| 506 | Makarius | |
| 507 | """ + Date.Format.date(Date.now()) + "\n") | |
| 508 | } | |
| 509 | ||
| 510 | ||
| 511 | ||
| 512 | /** Isabelle tool wrappers **/ | |
| 513 | ||
| 81297 | 514 | val default_version = "5.7.0" | 
| 73653 | 515 | |
| 516 | val isabelle_tool = | |
| 77566 
2a99fcb283ee
renamed administrative tools to build Isabelle components (unrelated to "isabelle build");
 wenzelm parents: 
76548diff
changeset | 517 |     Isabelle_Tool("component_jedit", "build Isabelle component from the jEdit text-editor",
 | 
| 75394 | 518 | Scala_Project.here, | 
| 519 |       { args =>
 | |
| 520 | var target_dir = Path.current | |
| 521 | var original = false | |
| 522 | var version = default_version | |
| 73653 | 523 | |
| 75394 | 524 |         val getopts = Getopts("""
 | 
| 77566 
2a99fcb283ee
renamed administrative tools to build Isabelle components (unrelated to "isabelle build");
 wenzelm parents: 
76548diff
changeset | 525 | Usage: isabelle component_jedit [OPTIONS] | 
| 73653 | 526 | |
| 527 | Options are: | |
| 528 | -D DIR target directory (default ".") | |
| 529 | -O retain copy of original jEdit directory | |
| 530 | -V VERSION jEdit version (default: """ + quote(default_version) + """) | |
| 531 | ||
| 532 | Build auxiliary jEdit component from original sources, with some patches. | |
| 533 | """, | |
| 75394 | 534 | "D:" -> (arg => target_dir = Path.explode(arg)), | 
| 535 | "O" -> (_ => original = true), | |
| 536 | "V:" -> (arg => version = arg)) | |
| 73653 | 537 | |
| 75394 | 538 | val more_args = getopts(args) | 
| 539 | if (more_args.nonEmpty) getopts.usage() | |
| 73653 | 540 | |
| 75394 | 541 |         val component_dir = target_dir + Path.basic("jedit-" + Date.Format.alt_date(Date.now()))
 | 
| 542 | val progress = new Console_Progress() | |
| 73653 | 543 | |
| 81449 
d92d754b5dd9
removed obsolete option: jEdit 5.7.0 can be built with default jdk;
 wenzelm parents: 
81427diff
changeset | 544 | build_jedit(component_dir, version, original = original, progress = progress) | 
| 75394 | 545 | }) | 
| 73653 | 546 | } |