[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: patch for thingatpt.el
From: |
Stefan Monnier |
Subject: |
Re: patch for thingatpt.el |
Date: |
Mon, 16 Jul 2007 13:33:08 -0400 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (gnu/linux) |
>>>>> "Drew" == Drew Adams <address@hidden> writes:
>> > Below is a patch for thingatpt.el that provides additional
>> > functionality and new thing and form functions. In particular:
>> > (1) it lets you supply a syntax-table argument to most functions,
>> > to affect the definition of what a word etc. is, and (2) it
>> > provides functions to return things near point, not
>> > just precisely at point.
>>
>> I believe that point 1 is misguided. We have `with-syntax-table'
>> for those cases and it is quite sufficient AFAIK.
> Right, and it's a much better approach too. Sorry about that. My enhancement
> predated `with-syntax-table', and I wasn't aware of it.
> Here is an updated change log and patch, which also incorporates the `defun'
> bug fix I sent after the previous patch.
> ! (defun symbol-at-point-with-bounds (&optional non-nil)
> ! "Return (SYMBOL START . END) with START and END of SYMBOL.
> ! Return nil if no such Emacs Lisp symbol is found.
> ! SYMBOL is the `symbol-at-point' (which see).
> ! If optional arg NON-NIL is non-nil, then the nearest symbol other
> ! than `nil' is sought."
> ! (with-syntax-table emacs-lisp-mode-syntax-table
> ! (form-at-point-with-bounds
> ! 'symbol (if non-nil (lambda (sym) (and sym (symbolp sym)))
> 'symbolp))))
This is wrong. The name is clearly generic, whereas the docstring then goes
on to say it's only specific to Emacs Lisp symbols. I think the name is
right and the docstring (and code) are wrong.
Check "recent" changes to symbol-at-point where I've fixed a similar problem
(basically you shouldn't call `read').
Stefan