summaryrefslogtreecommitdiff
path: root/elisp
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2016-06-12 04:33:04 +0200
committerJose Antonio Ortega Ruiz <jao@gnu.org>2016-06-12 04:33:04 +0200
commitbebd3944c130a75c5d39eb7d50439fe524b57d39 (patch)
tree4957ba8b0f6eb8c33efaff230b6e5158c52150dc /elisp
parent6c9b307d38716c922542b395fab1e676c34b3173 (diff)
downloadgeiser-guile-bebd3944c130a75c5d39eb7d50439fe524b57d39.tar.gz
geiser-guile-bebd3944c130a75c5d39eb7d50439fe524b57d39.tar.bz2
Removing stale keywords when switching to another scheme
Addresses github's #158, and its implementation is really easy (kudos to fice-t, also for telling me about bound-and-true-p).
Diffstat (limited to 'elisp')
-rw-r--r--elisp/geiser-mode.el3
-rw-r--r--elisp/geiser-syntax.el10
2 files changed, 10 insertions, 3 deletions
diff --git a/elisp/geiser-mode.el b/elisp/geiser-mode.el
index f8329f8..640dbcc 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, 2011, 2012, 2013, 2014, 2015 Jose Antonio Ortega Ruiz
+;; Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 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
@@ -195,6 +195,7 @@ With prefix, recursively macro-expand the resulting expression."
(defun geiser-set-scheme ()
"Associates current buffer with a given Scheme implementation."
(interactive)
+ (geiser-syntax--remove-kws)
(let ((impl (geiser-impl--read-impl)))
(geiser-impl--set-buffer-implementation impl)
(geiser-repl--set-up-repl impl)))
diff --git a/elisp/geiser-syntax.el b/elisp/geiser-syntax.el
index ce64171..79f899b 100644
--- a/elisp/geiser-syntax.el
+++ b/elisp/geiser-syntax.el
@@ -1,6 +1,6 @@
;;; geiser-syntax.el -- utilities for parsing scheme syntax
-;; Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014, 2015 Jose Antonio Ortega Ruiz
+;; Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 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
@@ -135,13 +135,19 @@ implementation-specific entries for font-lock-keywords.")
"A flag saying whether keywords are case sensitive.")
(defun geiser-syntax--add-kws (&optional global-p)
- (when (not (and (boundp 'quack-mode) quack-mode))
+ (unless (bound-and-true-p quack-mode)
(let ((kw (geiser-syntax--impl-kws geiser-impl--implementation))
(cs (geiser-syntax--case-sensitive geiser-impl--implementation)))
(when kw (font-lock-add-keywords nil kw))
(when global-p (font-lock-add-keywords nil (geiser-syntax--keywords)))
(setq font-lock-keywords-case-fold-search (not cs)))))
+(defun geiser-syntax--remove-kws ()
+ (unless (bound-and-true-p quack-mode)
+ (let ((kw (geiser-syntax--impl-kws geiser-impl--implementation)))
+ (when kw
+ (font-lock-remove-keywords nil kw)))))
+
;;; A simple scheme reader