From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eduardo Ochs Newsgroups: gmane.emacs.help Subject: Re: Any packages using ThingAtPointPlus for activation? Date: Tue, 3 Jan 2023 03:16:50 -0300 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25471"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Help GNU Emacs , Drew Adams To: Jean Louis Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jan 03 07:17:53 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 1pCacS-0006MS-F8 for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 03 Jan 2023 07:17:52 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pCabj-0003Yc-3U; Tue, 03 Jan 2023 01:17:07 -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 1pCabi-0003YU-7C for help-gnu-emacs@gnu.org; Tue, 03 Jan 2023 01:17:06 -0500 Original-Received: from mail-io1-xd35.google.com ([2607:f8b0:4864:20::d35]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pCabg-0008RX-51 for help-gnu-emacs@gnu.org; Tue, 03 Jan 2023 01:17:05 -0500 Original-Received: by mail-io1-xd35.google.com with SMTP id n63so16206432iod.7 for ; Mon, 02 Jan 2023 22:17:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=syg6QUCCVxPpsxvEQ92hz5VaaNZUN9soKK6+ER4QgJk=; b=lEyN7lrBgjVj3JpiMuwr7CTPLsZ/sa+nMV6kKI9zht7X9G1ZTeVGAPdOYK+YQe8m75 x1Engl5kyzd22Z8gPvRTn2DjdKDZ1k+y41IC88TRpGpZvvuHI7i1+Rw7DCld7V5vlytl opoEFO+LMxy9D7pQzXZ3dIOVHQoJ80NW+JPCmBpMxpbZBKJYWP3X+XOk0Ls92Nq7MkZZ nWSG8uoU4EWCyhi6gvCTK3nXxdKN7vqkHSn1DxHHYagzW7Hyto+icVaH5yIbh7FHfeSk bqdOUWeIOc3/cAKx+PdmJPUbPCfYYdwWwnQNt91N0UJFTzRgmwkzWdo1cOyw75goCsLi +6Sg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=syg6QUCCVxPpsxvEQ92hz5VaaNZUN9soKK6+ER4QgJk=; b=MOdZpJed4AkMFDGMh+2Tldxap/5HgOAoxWX99qHMh4aps5CyfXtlMR1GG6bPro8gyJ Yoct766RJm5eu0rguyqGibkIIAOhoXxBTTPLavbwAcMG2zar+NPTJUk/5VoWIJsbsycn t3OSkZl0YvJcm/wZBU8QSfUDT6BTm8xgleJVZW6soN4wK09v/73heR3xa8tdPpZWtjlg vtSNNY90vR1/VtuMzRx1mDkWiL+U+lc+Y53FUMigve0EoSTcKrIrcFV8NACQ6DsWXp5C a2ox8VUdLdKvARLBxpHx3/bLnQ/I9GwziQMbxFKpn2L8E4M3SCWPEBalb6RDcLl8i2b7 VXRw== X-Gm-Message-State: AFqh2kopUBN8mDds5G+HR25T0mRYq/3VkMqjLd9pOoE0fP/ekIvPLwuf xnBgBFDcsAKTI6mBhsAcPLVz2IJcHkSn02BXoXfTOl6sQMQ= X-Google-Smtp-Source: AMrXdXv7Fbz7tI1ime+YSAcKbIM263SF+r+0ssjyguAiuBVOU4t4BQ4hhzVLUySZpH30RZhrfSOpmQp1afBKwtBUNOE= X-Received: by 2002:a02:b1cd:0:b0:38a:7518:fb66 with SMTP id u13-20020a02b1cd000000b0038a7518fb66mr3210886jah.253.1672726622220; Mon, 02 Jan 2023 22:17:02 -0800 (PST) In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::d35; envelope-from=eduardoochs@gmail.com; helo=mail-io1-xd35.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=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:142102 Archived-At: On Mon, 2 Jan 2023 at 07:13, Jean Louis wrote: > > Dear Drew, > > Regarding your library: > https://www.emacswiki.org/emacs/ThingAtPointPlus > > You probably know Hyperbole and how M-RET works in Hyperbole. I like > the concept and wish to use M-RET in similar fashion, though without > Hyperbole package, so to jump to various functions by using > thing-at-point plus. It gives me freedom to easier define what I need, > and if nothing found I can still include Hyperbole function on the > end. > > The concept to "jump" based on some things at point, is useful. I jump > faster to various pieces of information. > > Here is the preliminary function that shows the concept: > > (defun hyperscope-action-button (&optional prefix) > (interactive "p") > (cond ((thing-at-point 'uuid) (rcd-db-uuid-action (thing-at-point 'uuid))) > ;; the above would find UUID in databases or Org files and jump there. > ((thing-at-point 'url) (browse-url (thing-at-point 'url))) > ;; the above browse the URL > ((thing-at-point 'email) (rcd-write-email user-full-name user-mail-address (thing-at-point 'email) (thing-at-point 'email))) > ;; the above writes the e-mail to email address found at point > ((thing-at-point 'symbol) > (let ((symbol (intern (thing-at-point 'symbol)))) > (cond ((fboundp symbol) > (find-function symbol)) > ((boundp symbol) > (find-variable symbol)) > (t (rcd-warning-message "Could not find symbol `%s'" symbol))))) > ;; the above finds definition of a function similar like xref but works outside of Emacs Lisp mode > ((thing-at-point 'number) (hyperscope-isolate (thing-at-point 'number))) > ;; the above would jump to elementary object in Hyperscope database > (t (rcd-message "Hyperscope action not defined."))))) > ;; Or I get warning > > ;; Easy to define global key > (keymap-global-set "M-RET" #'hyperscope-action-button) > > I want to expand the concept by following thinking: > > - M-RET -- jump to default function > - C-u 0 M-RET -- capture thing at point > - C-u 1 M-RET -- share thing at point > - C-u 2 M-RET -- etc. etc. etc. > > Point of this e-mail: > --------------------- > > Before I continue expanding the concept, it is better I ask you and others about previous work. > > Do you know of any existing package(s), apart from Hyperbole, that > deal in similar way with action keys andjumping based on what is found > under the point? > > On MELPA, I see related packages, that have useful functions: > https://melpa.org/#/?q=at-point > > And M-x package-list-packages did not give me some more relevant > information about "thing" and "jump". Hi Jean Louis, just one comment... `hyperscope-action-button' is written in a way that I don't like: it doesn't let us inspect what is the thing at point before doing something with the thing at point, and so it is hard to debug. I would factor it in at least two functions, and the lower-level one would be something like this, but I've omitted the case that tests for interned symbols... (defun ee-thing-at-point () (cond ((thing-at-point 'symbol) (list 'symbol (thing-at-point 'symbol))) ((thing-at-point 'url) (list 'url (thing-at-point 'url))) ((thing-at-point 'email) (list 'email (thing-at-point 'email))) ((thing-at-point 'number) (list 'number (thing-at-point 'number))) )) In eev I have something similar to that, but that classifies the current buffer into several kinds instead of classifying the thing around point into several kinds. It is here, http://angg.twu.net/eev-current/eev-hlinks.el.html#ee-fhl-main-program (find-eev "eev-hlinks.el" "ee-fhl-main-program") and it is written in a way in which I can replace the code that interprets the "program" by something more elegant without having to change the "program" itself... which is good, because I think that the current interpreter is not very well-written. But the current version has a debugging mode that is decently good - try `M-1 M-h M-h' to see what it shows. Cheers, Eduardo Ochs http://angg.twu.net/#eev