From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:403:4789::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id aCBXKjK432SZzAAASxT56A (envelope-from ) for ; Fri, 18 Aug 2023 20:28:02 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:4789::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id 0MFiKTK432Q8hwAAG6o9tA (envelope-from ) for ; Fri, 18 Aug 2023 20:28:02 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 400EC5275F for ; Fri, 18 Aug 2023 20:28:02 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=ZRIe86rF; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=posteo.net ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1692383282; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=kpCJs4gaLWVXeoArrneckx4Gc4LXjrURd2xifaVHGlo=; b=ZoHpf3eZdP6FETsV4ytPXNtWKeOX23tqGO2EfVl2QtqFZBbd5La9EySSE6Vemuy/nOccwS Bo7fKtKjw32n2MRc5CoIUV6JEBcHawRmfgVhp0DvxP2rGluSLFP8Ty483PbgXt+UwL0xAj lMQbJD+3DU1g4d75Rodx5hJy9Lz0vpsVWshk9pVklZI7UQrY6YNrKYn12H/9u/QBknHq+Y 2/z1EAebRE7XrOuI8UDi60tJ7txM+zkt0dcrNuEXF2isjWAeX7TqAiegBEVfqm1F0qia3w RWzkMv9ZaWuOdMrpUxZrIlVj2fYyPcLLQ09SitKKXmyatPSJwsv4ZEYS5Uk6kA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1692383282; a=rsa-sha256; cv=none; b=uELmrBAlBGRXYm9touDyTr37wq+0zh8RmHbpjkh106ggK1kGnBI9ob1dvnPWG6gC64ksDp nPzPGhS7B/ZCYnVmwQChWNaKBbDt8V0/OhYpnq2SvOSU/a3ypNUp27xYv7eOmSkSss0jA/ t+CPf77KtlvdIBbpcmsifB6aH6OzSVdSt3uCczwlw90zsbdBBNkEI/AiFbXAXuqaCKBnsk zIfSqUfORpUeBQs7lSbbtb81iZfyo5PwGfrkSHgdq/qGkSv9MJbqJooe46Hn6wUVlq3L5j 6sLS85hqcXbFn1wkQ4kDHgGWZ1cHrm78ALRFRqOPvg7LuPxz3Hyb4hmPLTiJSA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=ZRIe86rF; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=posteo.net Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qX4Bi-0002Ys-9N; Fri, 18 Aug 2023 14:27:10 -0400 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 1qX4Bg-0002YK-CM for emacs-orgmode@gnu.org; Fri, 18 Aug 2023 14:27:08 -0400 Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qX4Bc-0002em-GM for emacs-orgmode@gnu.org; Fri, 18 Aug 2023 14:27:08 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 4C2E8240101 for ; Fri, 18 Aug 2023 20:27:02 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1692383222; bh=2IhEwwliqEyfZu52pDv0Tcpcr/gsKJpm5JFy2JaJHMQ=; h=From:To:Subject:Date:Message-ID:MIME-Version: Content-Transfer-Encoding:From; b=ZRIe86rFozUIGXCaOrQCoXElYmXbn3E/aO90pYk9W/xhQmfoB5pPjYmJj0w5Kj/fP eKWk4dpdTFyfHR/SZdkrxi4chbZljXKLK8PhmBvnKzzvftYTbPaIxuvmH1UyjiuWZ6 0ZEHjPoaiQKfl9piDRgpA2JjYINp+Yz5fPvZ6BQXwL4KhKngVgK31RbhxJY8NKHqjn NdSH9gctCOdBBbUygvYHfV9DUIOudzlt3R3/pOeOOBvU4QyEuj4nrq5yGNimUi5zbb ewPtKqMMpiH/q9K/dZbrTR1RlipXje7tqnwusRt9gnQwx3MlhnBou538JMGWeOKSSz Eo0lXky6EAtyA== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4RS9M95tdPz9rxD for ; Fri, 18 Aug 2023 20:27:01 +0200 (CEST) From: =?utf-8?Q?Juan_Manuel_Mac=C3=ADas?= To: orgmode Subject: [Tip] Popup-menu with several actions for a link Date: Fri, 18 Aug 2023 18:27:01 +0000 Message-ID: <87ttsww6iy.fsf@posteo.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=185.67.36.66; envelope-from=maciaschain@posteo.net; helo=mout02.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -9.03 X-Spam-Score: -9.03 X-Migadu-Queue-Id: 400EC5275F X-Migadu-Scanner: mx1.migadu.com X-TUID: cjNDZbV7lnv9 Hi, I=E2=80=99ve been experimenting for a while with the popup.el library (), which offers an easy way to create popup menus (even cascading menus), with auto-completion functions. I=E2=80=99m sharing here a popup menu that I=E2=80=99ve defined = to perform various actions on an Org link, in case anyone finds it useful. In this list I store the functions that I am writing to manipulate links (open the link with eww, open the file with an external application, attach it to an email, upload it to Imgur, copy it to another directory or move it, visit the file directory, etc.). Something like this: =E2=94=8C=E2=94=80=E2=94=80=E2=94=80=E2=94=80 =E2=94=82 (setq my-org-link-actions-list =E2=94=82 '(("Action 1" . function1) =E2=94=82 ("Action 2" . function2) =E2=94=82 ("etc..." . etc))) =E2=94=94=E2=94=80=E2=94=80=E2=94=80=E2=94=80 Then, I have defined this popup-menu that is displayed on a link: =E2=94=8C=E2=94=80=E2=94=80=E2=94=80=E2=94=80 =E2=94=82 (defun my-org-actions-link-popup () =E2=94=82 (interactive) =E2=94=82 (funcall =E2=94=82 (popup-menu* =E2=94=82 (mapcar =E2=94=82 (lambda (x) =E2=94=82 (popup-make-item (car x) :value (cdr x))) =E2=94=82 my-org-link-actions-list) =E2=94=82 :isearch t))) =E2=94=94=E2=94=80=E2=94=80=E2=94=80=E2=94=80 And a little addendum. Being a Hyperbole user, it occurred to me a while ago that a =E2=80=99secondary action key=E2=80=99 could be very useful to m= e in certain contexts. So I defined this: =E2=94=8C=E2=94=80=E2=94=80=E2=94=80=E2=94=80 =E2=94=82 (defvar my-hyp-alt-act nil) =E2=94=82=20 =E2=94=82 (defun my-hyp-action-key-alt () =E2=94=82 (interactive) =E2=94=82 (let ((my-hyp-alt-act t)) =E2=94=82 (action-key))) =E2=94=94=E2=94=80=E2=94=80=E2=94=80=E2=94=80 If `C-c i' is for the =E2=80=99primary=E2=80=99 action key, `C-c I' is for = the =E2=80=99secondary=E2=80=99 action: =E2=94=8C=E2=94=80=E2=94=80=E2=94=80=E2=94=80 =E2=94=82 (global-set-key (kbd "C-c I") #'mi-hyp-action-key-alt) =E2=94=94=E2=94=80=E2=94=80=E2=94=80=E2=94=80 And then I=E2=80=99ve modified hyperbole `org-link' a bit: =E2=94=8C=E2=94=80=E2=94=80=E2=94=80=E2=94=80 =E2=94=82 (defact org-link (&optional link) =E2=94=82 "Follows an optional Org mode LINK to its target. =E2=94=82 If LINK is nil, follows any link at point. Otherwise, triggers a= n error." =E2=94=82 (if (not my-hyp-alt-act) =E2=94=82 (if (stringp link) =E2=94=82 (org-link-open-from-string link) =E2=94=82 (org-open-at-point)) =E2=94=82 (hact #'my-org-actions-link-popup))) =E2=94=94=E2=94=80=E2=94=80=E2=94=80=E2=94=80 In this way, if I have the point over the link and press `C-c i', the link opens. If I press `C-c I' the popup-menu is displayed. Best regards, Juan Manuel=20 --=20 -- ------------------------------------------------------ Juan Manuel Mac=C3=ADas=20 https://juanmanuelmacias.com https://lunotipia.juanmanuelmacias.com https://gnutas.juanmanuelmacias.com