summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2009-03-03 01:05:12 +0100
committerJose Antonio Ortega Ruiz <jao@gnu.org>2009-03-03 01:05:12 +0100
commit1561d097a65189175d43b5960a93cac194f4a2f4 (patch)
tree3ff5a462a973d440a30edb06e0b28e48338f5ee7
parent673d6027eaae6c5ce5955435cf23cacd83899b52 (diff)
downloadgeiser-1561d097a65189175d43b5960a93cac194f4a2f4.tar.gz
geiser-1561d097a65189175d43b5960a93cac194f4a2f4.tar.bz2
Highlight also #:key in autodoc.
-rw-r--r--elisp/geiser-autodoc.el15
-rw-r--r--elisp/geiser-syntax.el6
2 files changed, 15 insertions, 6 deletions
diff --git a/elisp/geiser-autodoc.el b/elisp/geiser-autodoc.el
index f4ffbae..da635cb 100644
--- a/elisp/geiser-autodoc.el
+++ b/elisp/geiser-autodoc.el
@@ -50,6 +50,10 @@
'font-lock-keyword-face
geiser-autodoc "highlighting #:opt marker in autodoc messages")
+(geiser-custom--defface autodoc-key-arg-marker
+ 'font-lock-keyword-face
+ geiser-autodoc "highlighting #:key marker in autodoc messages")
+
(defcustom geiser-autodoc-delay 0.2
"Delay before autodoc messages are fetched and displayed, in seconds."
:type 'number
@@ -94,10 +98,13 @@ when `geiser-autodoc-display-module-p' is on."
(defun geiser-autodoc--insert-arg (arg current pos)
(let ((p (point))
(str (format "%s" (if (eq arg '\#:rest) "." arg)))
- (face (or (and (eq '\#:opt arg)
- 'geiser-font-lock-autodoc-optional-arg-marker)
- (and (= current pos)
- 'geiser-font-lock-autodoc-current-arg))))
+ (face (cond ((eq '\#:opt arg)
+ 'geiser-font-lock-autodoc-optional-arg-marker)
+ ((eq '\#:key arg)
+ 'geiser-font-lock-autodoc-key-arg-marker)
+ ((= current pos)
+ 'geiser-font-lock-autodoc-current-arg)
+ (t nil))))
(insert str)
(when (listp arg)
(save-excursion
diff --git a/elisp/geiser-syntax.el b/elisp/geiser-syntax.el
index 01dd151..f0148e2 100644
--- a/elisp/geiser-syntax.el
+++ b/elisp/geiser-syntax.el
@@ -76,6 +76,8 @@
(forward-sexp arg)
(delete-region p (point))))
+(defconst geiser-syntax--placeholder (format "___%s___" (random 100)))
+
(defun geiser-syntax--complete-partial-sexp (buffer begin end)
(geiser-syntax--with-buffer
(erase-buffer)
@@ -87,14 +89,14 @@
(when p ;; inside a comment or string
(let ((str (nth 3 (syntax-ppss))))
(delete-region p (point-max))
- (when str (insert "XXXpointXXX")))))
+ (when str (insert geiser-syntax--placeholder)))))
(when (cond ((eq (char-after (1- (point))) ?\)) (geiser-syntax--del-sexp -1) t)
((eq (char-after (point)) ?\() (delete-region (point) (point-max)) t)
((memq (char-after (1- (point))) (list ?. ?@ ?, ?\' ?\` ?\# ?\\))
(skip-syntax-backward "^-(")
(delete-region (point) (point-max))
t))
- (insert "XXXpointXX"))
+ (insert geiser-syntax--placeholder))
(let ((depth (nth 0 (parse-partial-sexp (point-min) (point)))))
(unless (zerop depth) (insert (make-string depth ?\)))))
(when (< (point-min) (point))