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." (save-restriction ;; 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))) (save-excursion (skip-syntax-forward "w_") (skip-syntax-backward "-") (let ((string (let ((bounds (bounds-of-thing-at-point 'symbol))) (when bounds (buffer-substring (car bounds) (progn (goto-char (1- (cdr bounds))) (if (looking-at "\."") (1- (cdr bounds)) (cdr bounds)))))))) (and string ;; In Emacs20 (thing-at-point 'symbol) returns "" instead ;; of nil when called from an empty (or ;; narrowed-to-empty) buffer. (not (equal string "")) (substring-no-properties string))))))
"Pascal J.Bourguignon" pjb@informatimago.com writes:
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).
Do you know about `C-u M-.'? This way it slurps the symbol into the minibuffer where you can do small edits (like removing a trailing #. character). I find this okay so I'm not very keen on DWIM'ifying.
P.S., please send unidiffs - even in small functions it takes some eyeballing to see what's changed :-)
-Luke
Luke Gorrie writes:
Do you know about `C-u M-.'? This way it slurps the symbol into the minibuffer where you can do small edits (like removing a trailing #. character). I find this okay so I'm not very keen on DWIM'ifying.
I didn't know C-u M-. Perhaps consistency is more important, you're right.
P.S., please send unidiffs - even in small functions it takes some eyeballing to see what's changed :-)
Ok.