From 88c4657cf18d58ef2e179073006987345aa46b09 Mon Sep 17 00:00:00 2001 From: Darcy Shen Date: Mon, 12 Aug 2024 23:13:12 +0800 Subject: [PATCH] [66_9] TMU: default to TMU format when Save or Save as ## What + File -> Save switches to TMU format + File -> Save as switches to TMU format + `std-S` switches to TMU format + `S-F3` switches to TMU format + Add support of TM format in the export menu ## How to test your changes? Tested the shortcuts and menu entries above. --- TeXmacs/plugins/tmu/progs/data/tmu.scm | 2 +- TeXmacs/progs/generic/generic-kbd.scm | 4 ++-- TeXmacs/progs/texmacs/menus/file-menu.scm | 18 ++++++++++-------- TeXmacs/progs/texmacs/texmacs/tm-files.scm | 2 +- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/TeXmacs/plugins/tmu/progs/data/tmu.scm b/TeXmacs/plugins/tmu/progs/data/tmu.scm index 5317d2ed1a..07554ae7d9 100644 --- a/TeXmacs/plugins/tmu/progs/data/tmu.scm +++ b/TeXmacs/plugins/tmu/progs/data/tmu.scm @@ -15,7 +15,7 @@ (define-format tmu (:name "TMU") - (:suffix "tmu" "tsu")) + (:suffix "tmu")) (define (texmacs->tmu t) (serialize-tmu (cork-tree->utf8-tree t))) diff --git a/TeXmacs/progs/generic/generic-kbd.scm b/TeXmacs/progs/generic/generic-kbd.scm index cbfc90b104..1749aaf056 100644 --- a/TeXmacs/progs/generic/generic-kbd.scm +++ b/TeXmacs/progs/generic/generic-kbd.scm @@ -378,7 +378,7 @@ ("M-S-F2" (new-document*)) ;;("M-C-F2" (clone-window)) ("F3" (save-buffer)) - ("S-F3" (choose-file save-buffer-as "Save TeXmacs file" "texmacs")) + ("S-F3" (choose-file save-buffer-as "Save TeXmacs file" "tmu")) ("F4" (preview-buffer)) ("S-F4" (print-buffer)) ("C-F4" (interactive print-to-file)) @@ -797,7 +797,7 @@ ("std q" (safely-quit-TeXmacs)) ("std R" (update-document "all")) ("std s" (save-buffer)) - ("std S" (choose-file save-buffer-as "Save TeXmacs file" "texmacs")) + ("std S" (choose-file save-buffer-as "Save TeXmacs file" "tmu")) ("std u" (toggle-underlined)) ("std v" (kbd-paste)) ("std V" (kbd-paste-verbatim)) diff --git a/TeXmacs/progs/texmacs/menus/file-menu.scm b/TeXmacs/progs/texmacs/menus/file-menu.scm index 28087c6fc2..6ee8a5674c 100644 --- a/TeXmacs/progs/texmacs/menus/file-menu.scm +++ b/TeXmacs/progs/texmacs/menus/file-menu.scm @@ -139,12 +139,13 @@ (tm-menu (export-menu flag?) (with l (converters-from-special "texmacs-file" "-file" #f) - (for (fm l) - (let* ((name (format-get-name fm)) - (save-text (string-append "Save " (string-downcase name) " file")) - (export-text `(concat "Export as " ,name)) - (text (if flag? export-text name))) - ((eval text) (choose-file (buffer-exporter fm) save-text fm)))))) + (with l2 (filter (lambda (x) (not (string=? x "tmu"))) l) + (for (fm l2) + (let* ((name (format-get-name fm)) + (save-text (string-append "Save " (string-downcase name) " file")) + (export-text `(concat "Export as " ,name)) + (text (if flag? export-text name))) + ((eval text) (choose-file (buffer-exporter fm) save-text fm))))))) (tm-define (export-top-menu) (export-menu #t)) (tm-define (export-export-menu) (export-menu #f)) @@ -181,7 +182,7 @@ (menu-bind save-menu ("Save" (save-buffer)) - ("Save as" (choose-file save-buffer-as "Save TeXmacs file" "texmacs")) + ("Save as" (choose-file save-buffer-as "Save TeXmacs file" "tmu")) --- (link export-top-menu) --- @@ -270,7 +271,7 @@ ("Clear menu" (forget-interactive "recent-buffer")))) --- ("Save" (save-buffer)) - ("Save as" (choose-file save-buffer-as "Save TeXmacs file" "texmacs")) + ("Save as" (choose-file save-buffer-as "Save TeXmacs file" "tmu")) --- (link print-menu) --- @@ -281,6 +282,7 @@ (-> "Export" (link export-export-menu) --- + ("TM document" (choose-file save-buffer-as "Save TeXmacs file" "texmacs")) ("Pdf" (choose-file wrapped-print-to-file "Save pdf file" "pdf")) ("Pdf with embedded document" (choose-file wrapped-print-to-pdf-embeded-with-tm "Save pdf file" "pdf")) ("Postscript" diff --git a/TeXmacs/progs/texmacs/texmacs/tm-files.scm b/TeXmacs/progs/texmacs/texmacs/tm-files.scm index 585f41531d..b03404a4ce 100644 --- a/TeXmacs/progs/texmacs/texmacs/tm-files.scm +++ b/TeXmacs/progs/texmacs/texmacs/tm-files.scm @@ -190,7 +190,7 @@ (cond ((url-scratch? name) (choose-file (lambda (x) (apply save-buffer-as-main (cons x opts))) - "Save TeXmacs file" "texmacs")) + "Save TeXmacs file" "tmu")) ((not (buffer-exists? name)) (with msg `(concat "The buffer " ,vname " does not exist") (set-message msg "Save file")))