emacs-devel
[Top][All Lists]
Advanced

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

Re: patch for thingatpt.el


From: Andreas Röhler
Subject: Re: patch for thingatpt.el
Date: Sun, 8 Jun 2008 09:18:52 +0200
User-agent: KMail/1.9.6 (enterprise 20070904.708012)

Am Samstag, 7. Juni 2008 schrieb Drew Adams:
> > just for curiosity: could you tell in which
> > circumstances you use something like "nearest point"?
> > 
> > Saw that implemented already in your code, so
> > you will know the reason.
> 
> I use `*-nearest-point' functions typically to pick up a default value for 
use
> in completion by a command. I use `symbol-nearest-point' and
> `symbol-name-nearest-point' more often than other `*-nearest-point' 
functions.
> 
> Places where I use `*-nearest-point':
> 
> grep, make-face, find-dired, where-is, describe-function, describe-command,
> describe-variable, describe-option, descibe-option-of-type,
> Info-goto-emacs-command-node, name-last-kbd-macro, insert-kbd-macro,
> enable-command, disable-command, query-replace, query-replace-regexp,
> query-replace-regexp-eval, replace-string, replace-regexp, keep-lines,
> flush-lines, how-many, occur, multi-occur, multi-occur-in-matching-buffers,
> read-variable, read-any-variable, synonyms, synonyms-no-read,
> synonyms-definition, synonyms-definition-no-read, synonyms-definition-mouse,
> thing-region, cycle-thing-region, cancel-function-timers 
> 
> (For those of the above that are standard functions, I have my own version 
that
> uses `*-nearest-point'.)
> 
> And in Icicles, you can use `M-.' in the minibuffer to yank different kinds 
of
> thing from at or near point to the minibuffer. I use `*-nearest-point' there
> also.
> 
> > Simply can't imagine, in the case being nearby some
> > form, why not use forward-word or backward-word,
> > resp. skip-chars-... that kind of simple things?
> 
> Do you mean as a user or as part of the definition of some command? If the
> former, then why should a user need to fiddle with the exact cursor 
position,
> just to be able to pick up a default value? If you mean the latter, then 
that's
> just what `*-nearest-point' does.
> 
> See the recent bug with subject "describe-* and M-x should see past quote 
mark"
> as an example. Stefan presumably (I haven't checked) fixed this by 
maneuvering
> around a quote mark at point, to get to the symbol. That kind of maneuvering 
is
> unnecessary as a one-off fix if you just use `*-nearest-point'.
> 
> That's the kind of thing that `*-nearest-point' is designed for. Quote 
marks,
> parens, spaces, etc. are some of the stuff that might be under the cursor 
when
> it is near a name that could serve as a good default value.
> 
> 

Thanks a lot.

I assume, if already at thing, thing-nearest- will
also DTRT, so one key/command will be enough then.

Please let me raise still two other points at the
occasion:

All thing-at-point forms might be very useful for
immediate copying (and some more operations) IMO. 
What about to make them callable interactivly?

Return-value of `symbol-at-point' is not consistent
with other forms.

`symbol-at-point' interns symbol-name under
point--as you told me kindly months ago--while 
all other form deliver a portion of the
buffer, a substring.

My suggestion is: let `symbol-at-point' behave as the
rest. Then write (intern (symbol-at-point)) if the 
interned symbol is needed.

That change will break some code now, but is more
straightforward and looks promising on the long run.

It enables the set-up of a range of functions relying
 on thing-at-point. Otherwise you must always deal 
separatly with symbol-at... 



Andreas Röhler







reply via email to

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