Skip to Content.
Sympa Menu

texmacs-users - Re: Pasting source code into TeXmacs?

Subject: mailing-list for TeXmacs Users

List archive

Re: Pasting source code into TeXmacs?


Chronological Thread 
  • From: David Allouche <address@hidden>
  • To: address@hidden
  • Subject: Re: Pasting source code into TeXmacs?
  • Date: Sun, 24 Feb 2002 03:14:12 +0100

I just noticed how the Edit->import and Edit->export were breaking basic GUI
rules... So here is a Scheme hack to help improve the situation. It adds
ASCII art chekboxes to these menus.

This is a nice demonstration of how very much the TeXmacs menu are
customizable, but I do not pretend it is demonstration of good Scheme
programming. I am not sure I have grasped the philosophy of the language yet.


(define selection-import-conversion "TeXmacs")
(define selection-export-conversion "TeXmacs")

(define internal-selection-set-import selection-set-import)
(define internal-selection-set-export selection-set-export)

(define (selection-set-import conv)
(set! selection-import-conversion conv)
(internal-selection-set-import conv))
(define (selection-set-export conv)
(set! selection-export-conversion conv)
(internal-selection-set-export conv))

(define (checked-menu-item pred label lam)
(list (string-append (if pred "[X] " "[_] ") label) lam))
(define (set-variable-menu-item label var cmd val)
(checked-menu-item (equal? var val) label
(list cmd val)))

(define (edit-import-menu-item label val)
(set-variable-menu-item label selection-import-conversion
'selection-set-import val))
(define (edit-export-menu-item label val)
(set-variable-menu-item label selection-export-conversion
'selection-set-export val))

(define edit-import-menu
'((link (edit-import-menu-item "TeXmacs" "TeXmacs"))
(link (edit-import-menu-item "LaTeX" "latex"))
(link (edit-import-menu-item "html" "html"))
(link (edit-import-menu-item "scheme" "scheme"))
(link (edit-import-menu-item "verbatim" "verbatim"))))

(define edit-export-menu
'((link (edit-export-menu-item "TeXmacs" "TeXmacs"))
(link (edit-export-menu-item "LaTeX" "latex"))
(link (edit-export-menu-item "scheme" "scheme"))
(link (edit-export-menu-item "verbatim" "verbatim"))))

(define edit-menu
'(("copy" "E-c" (copy "primary"))
("cut" "E-x" (cut "primary"))
("paste" "E-p" (paste "primary"))
("clear" "E-r" (selection-clear "primary"))
("cancel" "C-g" (selection-cancel))
---
("search" "C-s" (search-start #t))
("replace" "C-="
(interactive '("Replace:" "Replace by:") 'replace-start-forward))
("spell" "E-$" (spell-start))
("undo" "E-[" (undo))
("redo" "E-]" (redo))
---
(-> "import" (link edit-import-menu))
(-> "export" (link edit-export-menu))
(-> "copy to"
("primary" "E-1 c" (copy "primary"))
("secondary" "E-2 c" (copy "secondary"))
("ternary" "E-3 c" (copy "ternary"))
---
("other" "E-0 c" (interactive '("Copy to:") 'copy)))
(-> "paste from"
("primary" "E-1 p" (paste "primary"))
("secondary" "E-2 p" (paste "secondary"))
("ternary" "E-3 p" (paste "ternary"))
---
("other" "E-0 p" (interactive '("Paste from:") 'paste)))
(-> "clear selection"
("primary" "E-1 r" (selection-clear "primary"))
("secondary" "E-2 r" (selection-clear "secondary"))
("ternary" "E-3 r" (selection-clear "ternary"))
---
("other" "E-0 r"
(interactive '("Clear selection:") 'selection-clear)))))

--

-- David --



Archive powered by MHonArc 2.6.19.

Top of Page