From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jean Louis Newsgroups: gmane.emacs.help Subject: Re: [External] : ThingAtPointPlus, and extending things at point Date: Fri, 6 Jan 2023 19:23:49 +0300 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3337"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mutt/2.2.9+54 (af2080d) (2022-11-21) Cc: Help GNU Emacs To: Drew Adams Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jan 06 17:27:03 2023 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pDpYb-0000XC-Rd for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 06 Jan 2023 17:27:01 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pDpY0-0001LY-Jh; Fri, 06 Jan 2023 11:26:24 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pDpXy-0001JV-Rc for help-gnu-emacs@gnu.org; Fri, 06 Jan 2023 11:26:22 -0500 Original-Received: from stw1.rcdrun.com ([217.170.207.13]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pDpXx-00014f-5o for help-gnu-emacs@gnu.org; Fri, 06 Jan 2023 11:26:22 -0500 Original-Received: from localhost ([::ffff:197.239.40.106]) (AUTH: PLAIN admin, TLS: TLS1.3,256bits,ECDHE_RSA_AES_256_GCM_SHA384) by stw1.rcdrun.com with ESMTPSA id 000000000005611D.0000000063B84BAF.00002053; Fri, 06 Jan 2023 09:26:22 -0700 Mail-Followup-To: Drew Adams , Help GNU Emacs Content-Disposition: inline In-Reply-To: Received-SPF: pass client-ip=217.170.207.13; envelope-from=bugs@gnu.support; helo=stw1.rcdrun.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:142136 Archived-At: * Drew Adams [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/