From e8398a8ad9ba267bbe28f2ba13914bcd1dbc150e Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Sat, 14 Mar 2009 12:42:09 +0100 Subject: Show implementation in geiser-mode's modeline. --- elisp/geiser-impl.el | 7 +++++-- elisp/geiser-mode.el | 8 ++++++-- elisp/geiser-repl.el | 8 ++++++-- 3 files changed, 17 insertions(+), 6 deletions(-) (limited to 'elisp') diff --git a/elisp/geiser-impl.el b/elisp/geiser-impl.el index 4f70b29..20b648e 100644 --- a/elisp/geiser-impl.el +++ b/elisp/geiser-impl.el @@ -60,6 +60,10 @@ geiser-impl-default-implementation (car geiser-impl--impls))) +(defsubst geiser-impl--impl-str (&optional impl) + (let ((impl (or impl geiser-impl--implementation))) + (and impl (capitalize (format "%s" impl))))) + ;;; Installing Scheme implementations: @@ -78,7 +82,6 @@ (geiser-impl--install-eval impl) (geiser-impl--register impl))) - (defsubst geiser-impl--sym (imp name) (intern (format "geiser-%s-%s" imp name))) @@ -104,7 +107,7 @@ (geiser-impl--sym impl "get-module")) (defsubst geiser-impl--geiser-procedure-function (impl) - (geiser-impl--sym imp "geiser-procedure")) + (geiser-impl--sym impl "geiser-procedure")) (defun geiser-impl--install-eval (impl) (setq geiser-eval--get-module-function (geiser-impl--module-function impl)) diff --git a/elisp/geiser-mode.el b/elisp/geiser-mode.el index cf43e00..57fb84e 100644 --- a/elisp/geiser-mode.el +++ b/elisp/geiser-mode.el @@ -135,9 +135,13 @@ With prefix, recursively macro-expand the resulting expression." ;;; Geiser mode: (make-variable-buffer-local - (defvar geiser-mode-string " G" + (defvar geiser-mode-string nil "Modeline indicator for geiser-mode")) +(defun geiser-mode--lighter () + (or geiser-mode-string + (format " %s" (or (geiser-impl--impl-str) "G")))) + (defvar geiser-mode-map (make-sparse-keymap) "Key map for geiser-mode") @@ -151,7 +155,7 @@ When Geiser mode is enabled, a host of nice utilities for interacting with the Geiser REPL is at your disposal. \\{geiser-mode-map}" :init-value nil - :lighter geiser-mode-string + :lighter (:eval (geiser-mode--lighter)) :group 'geiser-mode :keymap geiser-mode-map (when geiser-mode (geiser-impl--set-buffer-implementation)) diff --git a/elisp/geiser-repl.el b/elisp/geiser-repl.el index c362787..62fbcdf 100644 --- a/elisp/geiser-repl.el +++ b/elisp/geiser-repl.el @@ -103,10 +103,14 @@ REPL buffer." (with-current-buffer repl (add-to-list 'act geiser-impl--implementation))))) +(defsubst geiser-repl--repl-name (impl) + (format "%s REPL" (geiser-impl--impl-str impl))) + (defun geiser-repl--to-repl-buffer (impl) (unless (and (eq major-mode 'geiser-repl-mode) (not (get-buffer-process (current-buffer)))) - (pop-to-buffer (generate-new-buffer (format "*Geiser REPL (%s)*" impl)))) + (pop-to-buffer + (generate-new-buffer (format "* %s *" (geiser-repl--repl-name impl))))) (geiser-impl--set-buffer-implementation impl) (geiser-repl-mode)) @@ -116,7 +120,7 @@ REPL buffer." (let ((binary (geiser-impl--binary impl)) (args (geiser-impl--parameters impl)) (prompt-rx (geiser-impl--prompt-regexp impl)) - (cname (format "Geiser REPL (%s)" impl))) + (cname (geiser-repl--repl-name impl))) (unless (and binary prompt-rx) (error "Sorry, I don't know how to start a REPL for %s" impl)) (set (make-local-variable 'comint-prompt-regexp) prompt-rx) -- cgit v1.2.3