diff options
author | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2009-03-01 02:19:41 +0100 |
---|---|---|
committer | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2009-03-01 02:19:41 +0100 |
commit | db726f75e33feb2505ba2b8a55359db121e9b70b (patch) | |
tree | 97a3cba2fcf42f23f9edcae496a6fe0184d51d84 | |
parent | 7e5f31f4ca0a8cd66f2fae4fc6a5112f082bb184 (diff) | |
download | geiser-db726f75e33feb2505ba2b8a55359db121e9b70b.tar.gz geiser-db726f75e33feb2505ba2b8a55359db121e9b70b.tar.bz2 |
More precise argument position highlighting in autodoc.
-rw-r--r-- | elisp/geiser-syntax.el | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/elisp/geiser-syntax.el b/elisp/geiser-syntax.el index a41f152..dcc8359 100644 --- a/elisp/geiser-syntax.el +++ b/elisp/geiser-syntax.el @@ -80,18 +80,18 @@ (geiser-syntax--with-buffer (erase-buffer) (insert-buffer-substring-no-properties buffer begin end) - (skip-syntax-backward "-<>") - (delete-region (point) (point-max)) + (when (not (eq (char-after (point)) ?\()) + (skip-syntax-backward "-<>") + (delete-region (point) (point-max))) (let ((pps (parse-partial-sexp (point-min) (point)))) (when (nth 8 pps) ;; inside a comment or string (delete-region (nth 8 pps) (point-max)))) - (cond ((eq (char-after (1- (point))) ?\)) - (geiser-syntax--del-sexp -1) (insert "XXpointXX")) - ((eq (char-after (point)) ?\() - (geiser-syntax--del-sexp 1) (insert "XXpointXX"))) - (when (memq (char-after (1- (point))) (list ?. ?@ ?, ?\' ?\` ?\#)) - (skip-syntax-backward "^-(") - (delete-region (point) (point-max)) + (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")) (let ((depth (nth 0 (parse-partial-sexp (point-min) (point))))) (unless (zerop depth) (insert (make-string depth ?\))))) @@ -99,9 +99,10 @@ (defsubst geiser-syntax--get-partial-sexp () (unless (zerop (nth 0 (syntax-ppss))) - (let* ((end (save-excursion (skip-syntax-forward "^-()") (point))) + (let* ((end (if (eq (char-after (point)) ?\() (1+ (point)) + (save-excursion (skip-syntax-forward "^-()") (point)))) (begin (save-excursion (beginning-of-defun) (point)))) - (geiser-syntax--complete-partial-sexp (current-buffer) begin end)))) + (geiser-syntax--complete-partial-sexp (current-buffer) begin end)))) ;;; Fontify strings as Scheme code: |