summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2009-05-18 01:41:26 +0200
committerJose Antonio Ortega Ruiz <jao@gnu.org>2009-05-18 01:41:26 +0200
commit36ad012fd1c5c0a1b1fff02bf3123080901b796e (patch)
tree61f21a40799b738c113c1096be9a46260a293c33
parent7b9260d93d355ce574b0c5037697a542b9abe610 (diff)
downloadgeiser-36ad012fd1c5c0a1b1fff02bf3123080901b796e.tar.gz
geiser-36ad012fd1c5c0a1b1fff02bf3123080901b796e.tar.bz2
Autodoc: correct detection of start of string in argument highlighting.
-rw-r--r--elisp/geiser-syntax.el15
1 files changed, 9 insertions, 6 deletions
diff --git a/elisp/geiser-syntax.el b/elisp/geiser-syntax.el
index ea57a95..81025a9 100644
--- a/elisp/geiser-syntax.el
+++ b/elisp/geiser-syntax.el
@@ -79,20 +79,23 @@
(defconst geiser-syntax--placeholder (format "___%s___" (random 100)))
+(defsubst geiser-syntax--beginning-of-form ()
+ (memq (char-after (point)) '(?\" ?\()))
+
(defun geiser-syntax--complete-partial-sexp (buffer begin end)
(geiser-syntax--with-buffer
(erase-buffer)
(insert-buffer-substring-no-properties buffer begin end)
- (when (not (eq (char-after (point)) ?\())
+ (when (not (geiser-syntax--beginning-of-form))
(skip-syntax-backward "-<>")
(delete-region (point) (point-max)))
(let ((p (nth 8 (syntax-ppss))))
(when p ;; inside a comment or string
- (let ((str (nth 3 (syntax-ppss))))
- (delete-region p (point-max))
- (when str (insert geiser-syntax--placeholder)))))
+ (delete-region p (point-max))
+ (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)
+ ((geiser-syntax--beginning-of-form)
+ (delete-region (point) (point-max)) t)
((memq (char-after (1- (point))) (list ?. ?@ ?, ?\' ?\` ?\# ?\\))
(skip-syntax-backward "^-(")
(delete-region (point) (point-max))
@@ -114,7 +117,7 @@
(defsubst geiser-syntax--get-partial-sexp ()
(unless (zerop (nth 0 (syntax-ppss)))
- (let* ((end (if (eq (char-after (point)) ?\() (1+ (point))
+ (let* ((end (if (geiser-syntax--beginning-of-form) (1+ (point))
(save-excursion (skip-syntax-forward "^-\"<>()") (point))))
(begin (save-excursion (beginning-of-defun) (point))))
(geiser-syntax--complete-partial-sexp (current-buffer) begin end))))