From 1536e3bf322ad27f6f4a4f961efbd8510148a5d6 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Thu, 3 Feb 2011 22:33:45 +0100 Subject: [PATCH] New geiser-add-to-load-path, just for Guile right now As per Andy's request. Adding it to Racket (and to the user manual), shouldn't be difficult). --- NEWS | 7 +++- README | 74 +++++++++++++++++++------------------- elisp/geiser-compile.el | 10 +++++- elisp/geiser-mode.el | 3 +- elisp/geiser-repl.el | 1 + scheme/guile/geiser/evaluation.scm | 11 ++++-- 6 files changed, 65 insertions(+), 41 deletions(-) diff --git a/NEWS b/NEWS index b0c2ea4..63202df 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,10 @@ * Version 0.1.2 + New features: + + - New C-c C-e C-l (or C-c C-r in REPL) to add a directory to + Scheme's load path. + Bug fixes: - Company mode integration fixes (including #32231) @@ -11,8 +16,8 @@ - "Manual autodoc" command; C-c C-d s. - Autodoc retrieval is now asynchronous, for better behaviour in remote connections. - - Racket: ',enter "foo"' as a synonym of ',enter (file "foo")'. - New C-c C-a to switch to REPL and enter module (C-c C-Z was broken). + - Racket: ',enter "foo"' as a synonym of ',enter (file "foo")'. - Documentation typos, and grammar and layout fixes. diff --git a/README b/README index 184dd12..3ff61b2 100644 --- a/README +++ b/README @@ -105,42 +105,43 @@ *** In Scheme buffers: - |---------------------+-------------------------------------------------| - | C-c C-z | Switch to REPL | - | C-c C-a | Switch to REPL and current module | - | C-c C-s | Specify Scheme implementation for buffer | - |---------------------+-------------------------------------------------| - | M-. | Go to definition of identifier at point | - | M-, | Go back to where M-. was last invoked | - | C-c C-e m | Ask for a module and open its file | - | C-c C-e [ | Toggle between () and [] for current form | - |---------------------+-------------------------------------------------| - | C-M-x | Eval definition around point | - | C-c M-e | Eval definition around point and switch to REPL | - | C-x C-e | Eval sexp before point | - | C-c C-r | Eval region | - | C-c M-r | Eval region and switch to REPL | - |---------------------+-------------------------------------------------| - | C-c C-m x | Macro-expand definition around point | - | C-c C-m e | Macro-expand sexp before point | - | C-c C-m r | Marcro-expand region | - |---------------------+-------------------------------------------------| - | C-c C-k | Compile and load current file | - |---------------------+-------------------------------------------------| - | C-c C-d d | See documentation for identifier at point | - | C-c C-d s | See short documentation for identifier at point | - | C-c C-d i | Look up manual for identifier at point | - | C-c C-d m | See a list of a module's exported identifiers | - | C-c C-d a | Toggle autodoc mode | - |---------------------+-------------------------------------------------| - | C-c < | Show callers of procedure at point | - | C-c > | Show callees of procedure at point | - |---------------------+-------------------------------------------------| - | M-TAB | Complete identifier at point | - | M-`, C-. | Complete module name at point | - | TAB | Complete identifier at point or indent | - | | (If `geiser-mode-smart-tab-p' is t) | - |---------------------+-------------------------------------------------| + |-------------+-------------------------------------------------| + | C-c C-z | Switch to REPL | + | C-c C-a | Switch to REPL and current module | + | C-c C-s | Specify Scheme implementation for buffer | + |-------------+-------------------------------------------------| + | M-. | Go to definition of identifier at point | + | M-, | Go back to where M-. was last invoked | + | C-c C-e m | Ask for a module and open its file | + | C-c C-e C-l | Add a given directory to Scheme's load path | + | C-c C-e [ | Toggle between () and [] for current form | + |-------------+-------------------------------------------------| + | C-M-x | Eval definition around point | + | C-c M-e | Eval definition around point and switch to REPL | + | C-x C-e | Eval sexp before point | + | C-c C-r | Eval region | + | C-c M-r | Eval region and switch to REPL | + |-------------+-------------------------------------------------| + | C-c C-m x | Macro-expand definition around point | + | C-c C-m e | Macro-expand sexp before point | + | C-c C-m r | Marcro-expand region | + |-------------+-------------------------------------------------| + | C-c C-k | Compile and load current file | + |-------------+-------------------------------------------------| + | C-c C-d d | See documentation for identifier at point | + | C-c C-d s | See short documentation for identifier at point | + | C-c C-d i | Look up manual for identifier at point | + | C-c C-d m | See a list of a module's exported identifiers | + | C-c C-d a | Toggle autodoc mode | + |-------------+-------------------------------------------------| + | C-c < | Show callers of procedure at point | + | C-c > | Show callees of procedure at point | + |-------------+-------------------------------------------------| + | M-TAB | Complete identifier at point | + | M-`, C-. | Complete module name at point | + | TAB | Complete identifier at point or indent | + | | (If `geiser-mode-smart-tab-p' is t) | + |-------------+-------------------------------------------------| *** In the REPL @@ -156,6 +157,7 @@ |-------------+----------------------------------------------------| | C-c C-m | Set current module | | C-c C-i | Import module into current namespace | + | C-c C-r | Add a given directory to scheme's load path | |-------------+----------------------------------------------------| | C-c C-d C-d | See documentation for symbol at point | | C-c C-d C-m | See documentation for module | diff --git a/elisp/geiser-compile.el b/elisp/geiser-compile.el index bc9aace..911de05 100644 --- a/elisp/geiser-compile.el +++ b/elisp/geiser-compile.el @@ -1,6 +1,6 @@ ;; geiser-compile.el -- compile/load scheme files -;; Copyright (C) 2009, 2010 Jose Antonio Ortega Ruiz +;; Copyright (C) 2009, 2010, 2011 Jose Antonio Ortega Ruiz ;; This program is free software; you can redistribute it and/or ;; modify it under the terms of the Modified BSD License. You should @@ -67,6 +67,14 @@ (interactive) (geiser-load-file (buffer-file-name (current-buffer)))) +(defun geiser-add-to-load-path (path) + "Add a new directory to running Scheme's load path. +When called interactively, this function will ask for the path to +add, defaulting to the current buffer's directory." + (interactive "DDirectory to add: ") + (let* ((c `(:eval (:ge add-to-load-path ,path))) + (r (geiser-eval--send/result c))) + (message "%s" (if r "Added" "Failed!")))) (provide 'geiser-compile) diff --git a/elisp/geiser-mode.el b/elisp/geiser-mode.el index a28fad5..c0388f0 100644 --- a/elisp/geiser-mode.el +++ b/elisp/geiser-mode.el @@ -1,6 +1,6 @@ ;; geiser-mode.el -- minor mode for scheme buffers -;; Copyright (C) 2009, 2010 Jose Antonio Ortega Ruiz +;; Copyright (C) 2009, 2010, 2011 Jose Antonio Ortega Ruiz ;; This program is free software; you can redistribute it and/or ;; modify it under the terms of the Modified BSD License. You should @@ -303,6 +303,7 @@ interacting with the Geiser REPL is at your disposal. ("Complete module name" ((kbd "M-`") (kbd "C-.")) geiser-completion--complete-module) ("Edit module" ("\C-c\C-e\C-m" "\C-c\C-em") geiser-edit-module) + ("Add to load path..." ("\C-c\C-e\C-l" "\C-c\C-el") geiser-add-to-load-path) ("Toggle ()/[]" ("\C-c\C-e\C-[" "\C-c\C-e[") geiser-squarify) -- ("Callers" ((kbd "C-c <")) geiser-xref-callers diff --git a/elisp/geiser-repl.el b/elisp/geiser-repl.el index 25cb116..3de0a60 100644 --- a/elisp/geiser-repl.el +++ b/elisp/geiser-repl.el @@ -527,6 +527,7 @@ buffer." -- ("Switch to module..." "\C-c\C-m" switch-to-geiser-module) ("Import module..." "\C-c\C-i" geiser-repl-import-module) + ("Add to load path..." "\C-c\C-r" geiser-add-to-load-path) -- ("Previous matching input" "\M-p" comint-previous-matching-input-from-input "Previous input matching current") diff --git a/scheme/guile/geiser/evaluation.scm b/scheme/guile/geiser/evaluation.scm index 3741c6a..b6575ba 100644 --- a/scheme/guile/geiser/evaluation.scm +++ b/scheme/guile/geiser/evaluation.scm @@ -1,6 +1,6 @@ ;;; evaluation.scm -- evaluation, compilation and macro-expansion -;; Copyright (C) 2009, 2010 Jose Antonio Ortega Ruiz +;; Copyright (C) 2009, 2010, 2011 Jose Antonio Ortega Ruiz ;; This program is free software; you can redistribute it and/or ;; modify it under the terms of the Modified BSD License. You should @@ -15,7 +15,8 @@ ge:macroexpand ge:compile-file ge:load-file - ge:set-warnings) + ge:set-warnings + ge:add-to-load-path) #:use-module (geiser modules) #:use-module (srfi srfi-1) #:use-module (language tree-il) @@ -104,3 +105,9 @@ (with-output-to-string (lambda () (pretty-print (tree-il->scheme (macroexpand form))))))) + +(define (ge:add-to-load-path dir) + (and (file-is-directory? dir) + (not (member dir %load-path)) + (begin (set! %load-path (cons dir %load-path)) + #t))) -- 2.11.4.GIT