Skip to content

Commit

Permalink
[66_9] TMU: default to TMU format when Save or Save as
Browse files Browse the repository at this point in the history
<!-- Thank you for your contribution! -->
## 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.
  • Loading branch information
da-liii authored Aug 12, 2024
1 parent 1ce831e commit 88c4657
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion TeXmacs/plugins/tmu/progs/data/tmu.scm
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand Down
4 changes: 2 additions & 2 deletions TeXmacs/progs/generic/generic-kbd.scm
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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))
Expand Down
18 changes: 10 additions & 8 deletions TeXmacs/progs/texmacs/menus/file-menu.scm
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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)
---
Expand Down Expand Up @@ -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)
---
Expand All @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion TeXmacs/progs/texmacs/texmacs/tm-files.scm
Original file line number Diff line number Diff line change
Expand Up @@ -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")))
Expand Down

0 comments on commit 88c4657

Please sign in to comment.