help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

lisp-var-at-point bug?


From: Antonio Martinez
Subject: lisp-var-at-point bug?
Date: Mon, 28 Apr 2003 18:29:10 GMT
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0) Gecko/20020529

Hi,

[I'm using Gnu Emacs 21.2 on Debian 3.0.]

I think the lisp-var-at-point in inf-lisp.el may have a bug. It skips quote characters prefixing the symbol, not prefix syntax characters, so `foo, #'foo etc. aren't converted to lisp vars when I think they could be. Here's the system definition:

(defun lisp-var-at-pt ()
  (condition-case ()
      (save-excursion
        (forward-sexp -1)
        (skip-chars-forward "'")
        (let ((obj (read (current-buffer))))
          (and (symbolp obj) obj)))
    (error nil)))

The following definition doesn't have this behaviour:

(defun lisp-var-at-pt ()
  (condition-case ()
      (save-excursion
        (forward-sexp -1)
        (skip-prefix-chars-forward)
        (let ((obj (read (current-buffer))))
          (and (symbolp obj) obj)))
    (error nil)))

Is the original lisp-var-at-point behaviour a bug? Is the replacement a reasonable fix?

Alternatively, it might be reasonable to use the thing-at-point extension interface as follows:

(put 'common-lisp-symbol 'end-op (lambda ()
                                   (forward-sexp)))

(put 'common-lisp-symbol
     'beginning-op
     (lambda ()
       (let ((end (point)))
         (backward-sexp)
         (skip-prefix-chars-forward)
         (re-search-forward "::?" end nil))))

This correctly handles common lisp style package prefixes (for describe et al). lisp-var-at-point becomes (thing-at-point 'common-lisp-symbol).

Thanks in advance for any comments,

                                                --Tony



reply via email to

[Prev in Thread] Current Thread [Next in Thread]