[slime-devel] slime-symbol-name-at-point for "ERROR: with SYMBOLS."
pjb at informatimago.com
Thu Jul 1 03:19:24 UTC 2004
Here is a version of slime-symbol-name-at-point that's more
sophisticated than the one using thing-at-point. If there's a
dot-double-quote after the symbol at point, then it removes the dot.
The Right Thing would be to match the symbol at point depending on the
expected symbols (known CLHS / current program symbols), and to try
several possibilities (to be able to handle case when the symbol-dot
does not end a string).
(defun slime-symbol-name-at-point ()
"Return the name of the symbol at point, otherwise nil."
;; Don't be tricked into grabbing the REPL prompt.
(when (and (eq major-mode 'slime-repl-mode)
(>= (point) slime-repl-input-start-mark))
(narrow-to-region slime-repl-input-start-mark (point-max)))
(let ((string (let ((bounds (bounds-of-thing-at-point 'symbol)))
(buffer-substring (car bounds)
(goto-char (1- (cdr bounds)))
(if (looking-at "\\.\"")
(1- (cdr bounds))
;; In Emacs20 (thing-at-point 'symbol) returns "" instead
;; of nil when called from an empty (or
;; narrowed-to-empty) buffer.
(not (equal string ""))
__Pascal Bourguignon__ http://www.informatimago.com/
There is no worse tyranny than to force a man to pay for what he does not
want merely because you think it would be good for him. -- Robert Heinlein
More information about the slime-devel