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

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

Re: [External] : ThingAtPointPlus, and extending things at point


From: Jean Louis
Subject: Re: [External] : ThingAtPointPlus, and extending things at point
Date: Fri, 6 Jan 2023 19:23:49 +0300
User-agent: Mutt/2.2.9+54 (af2080d) (2022-11-21)

* Drew Adams <drew.adams@oracle.com> [2023-01-05 20:00]:
> Typically I SOFT-require a library and so take advantage of it only
> IF you _load_ it.  And in some cases certain commands in a library
> might themselves really require a particular library (in which case
> they're either not defined if that library isn't available or they
> raise an error telling you it's needed).

Yes, I have to adopt that approach, you use this:

(require 'naked nil t) ;; (no error if not found): naked-key-description

and then

(if (fbound 'naked-function)
    (naked-function)
  (otherwise-normal-function))

> > There is 'string and 'string-contents, really good.
> > 
> > Though in various modes 'string should be re-defined to support
> > various quotes in various modes, let us say in Perl.

I see it finds string in Perl, like:

print 'string';

(thing-at-point 'string-contents)

it finds:

#("string" 0 6 (face font-lock-string-face fontified t))

but not that it finds it in Elisp mode, because it is not string, and
also not in mail mode

> > I have examined (thing-at-point 'list):
> > - it works on '(1 "OK" 2) and then I can choose
> >   (thing-at-point 'list-contents) to get the elements
> > - but it does not work on (list 1 2 3), as there I get
> >   the element `list' by using 'list-contents, that is now
> >   what I expected, but OK, it is more generalized "list".
> 
> I guess you mean that you get the string "list 1 2 3".  That's
> correct - that's the text that's the list content.

Yes, I was thinking you made it so, low level.

> You might also be interested in my `find-where.el'.

I use following `cond' statement to find your library `find-where.el'
as people often quote in this way `'. What is the name of that type of
quoting?

The action button moves me to find-where.el

        ((thing-at-point 'thing-within-grave-and-apostrophe)
         (let ((thing (thing-at-point 'thing-within-grave-and-apostrophe)))
           (cond ((file-exists-p thing) (find-file thing))
                 ((and (string-match "\\.el$" thing)
                       (locate-library (substring thing 0 (- (length thing) 
3))))
                  (find-library thing)))))

Thanks, I find the function `fw-to-next-thing' very useful in this
unification of functions. It is reinventing the wheel what GNU
Hyperbole already has, with extensions.

I can imagine that `fw-to-next-thing' must be slower function right?
It is much slower then just using regular expression search. 

> https://www.emacswiki.org/emacs/FindWhere

Thanks.

> For example, you can find a text THING, such as the next vector with
> 13 elements, and have it returned along with its bounds (start and
> end positions).

That is useful. Let us say I wish to collect all the anchors in the
file, I can do it easier.

-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



reply via email to

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