[climacs-cvs] CVS update: climacs/gui.lisp

Christophe Rhodes crhodes at common-lisp.net
Thu May 19 09:04:27 UTC 2005


Update of /project/climacs/cvsroot/climacs
In directory common-lisp.net:/tmp/cvs-serv6573

Modified Files:
	gui.lisp 
Log Message:
Add com-insert-file (from David Lewis)

Date: Thu May 19 11:04:27 2005
Author: crhodes

Index: climacs/gui.lisp
diff -u climacs/gui.lisp:1.138 climacs/gui.lisp:1.139
--- climacs/gui.lisp:1.138	Tue May 10 18:28:53 2005
+++ climacs/gui.lisp	Thu May 19 11:04:26 2005
@@ -721,6 +721,20 @@
     ;; resets the low and high marks after redisplay
     (redisplay-frame-panes *application-frame*)))
 
+(define-named-command com-insert-file ()
+  (let ((filename (accept 'completable-pathname
+			  :prompt "Insert File"))
+	(pane (current-window)))
+    (when (probe-file filename)
+      (setf (mark pane) (clone-mark (point pane) :left))
+      (with-open-file (stream filename :direction :input)
+	(input-from-stream stream
+			   (buffer pane)
+			   (offset (point pane))))
+      (psetf (offset (mark pane)) (offset (point pane))
+	     (offset (point pane)) (offset (mark pane))))
+    (redisplay-frame-panes *application-frame*)))
+
 (defun save-buffer (buffer)
   (let ((filepath (or (filepath buffer)
 		      (accept 'completable-pathname
@@ -1458,6 +1472,7 @@
 (c-x-set-key '(#\e) 'com-call-last-kbd-macro)
 (c-x-set-key '(#\c :control) 'com-quit)
 (c-x-set-key '(#\f :control) 'com-find-file)
+(c-x-set-key '(#\i) 'com-insert-file)
 (c-x-set-key '(#\k) 'com-kill-buffer)
 (c-x-set-key '(#\l :control) 'com-load-file)
 (c-x-set-key '(#\o) 'com-other-window)




More information about the Climacs-cvs mailing list