On Tue, Nov 17, 2009 at 8:30 AM, <a...@gursey.gov.tr> wrote: > Hello, > > Thanks for the code. I would definitely benefit from an emacs mode for GAP > with more functionality. > > The code is not fully working, unfortunately. I think you have some other > related code, which it is looking for. > > I have added your code to gap-mode.el. > When I tried it, this is what happened: > > I have tried these command with these key bindings. The first and the last > worked properly. > >> (define-key gap-mode-map "\C-c\C-s" 'nea-send-string-to-gap) >> (define-key gap-mode-map "\C-c\C-l" 'nea-send-line-to-gap) >> (define-key gap-mode-map "\C-c\C-r" 'nea-send-region-to-gap) >> (define-key gap-mode-map "\C-c\C-f" 'nea-send-region-to-gap-as-file) >> (define-key gap-mode-map "\C-ci" 'nea-ins-gap) > > For 2,3,4, I got the following error messages (with the same order). >
Oops! Yeah, these functions have gone through several stages and several names. I believe the following code is correct. Please check: -- 8< -------- Begin Elisp Code ;; The name of the temp file should probably be randomly chosen. ;;; Haven't really used this command much. (defun nea-send-region-to-gap-as-file (begin end) "Have GAP read the contents of the region as a file." (interactive "r") (let ((temp-gap-file "/tmp/tmp.gap")) (write-region begin end temp-gap-file) (nea-send-string-to-gap (concat "Read(\"" temp-gap-file "\");\n")))) (defun nea-send-region-to-gap (begin end &optional arg) "Send region to gap." (interactive "r\nP") (let ((string (buffer-substring begin end))) (save-window-excursion (set-buffer "*gap*") (goto-char (point-max)) (nea-send-string-to-gap string arg)))) (defun nea-send-line-to-gap (&optional arg) "Send current line to GAP." (interactive "P") (nea-send-region-to-gap (line-beginning-position) (line-end-position) arg)) -- 8< -------- End Elisp Code Hope it works correctly now, Nikos _______________________________________________ Forum mailing list Forum@mail.gap-system.org http://mail.gap-system.org/mailman/listinfo/forum