emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Juan Manuel Macías" <maciaschain@posteo.net>
To: Ihor Radchenko <yantar92@posteo.net>
Cc: orgmode <emacs-orgmode@gnu.org>
Subject: Re: [Tip] Popup-menu with several actions for a link
Date: Sun, 20 Aug 2023 10:13:27 +0000	[thread overview]
Message-ID: <87y1i6c988.fsf@posteo.net> (raw)
In-Reply-To: <87wmxquqhb.fsf@localhost> (Ihor Radchenko's message of "Sun, 20 Aug 2023 07:23:28 +0000")

Ihor Radchenko writes:

>> ... Also, I don't usually use the mouse
>> much (actually I only use it in Gimp and the like) and the combination
>> of popup.el with hyperbole is more comfortable and keyboard-centric for
>> me.
>
> By default, context menu is bound to S-<F10>. Who cares about mouse XD

Oh I see. Very interesting. But I have seen that, at least by default,
there is no autocomplete feature. What I like about popup.el is, in
addition to autocompletion, the ability to easily create menus for
anything. Some time ago I defined a popup-menu[1] that shows me all the
header levels from where I am to the first one, defaulting to the
current level. It helps me situate myself in deep levels (other options
like imenu or org-sidebar give me too much information and I get lost).
I'm going to investigate if something similar can be done with
context-menu-mode...

Thank you for all the info!

[1] https://i.imgur.com/KoAZtIz.png
┌────
│ (defun my-org-where-i-am-popup ()
│   (interactive)
│   (setq org-heading-titles-list nil)
│   (org-with-wide-buffer
│    (save-excursion
│      (save-restriction
│        (org-back-to-heading t)
│        (if (eq (org-element-property :level (org-element-at-point)) 1)
│            (message "First level")
│          (push (cons (org-link-display-format
│                       (nth 4 (org-heading-components)))
│                      (point))
│                org-heading-titles-list)
│          (while
│              (ignore-errors (outline-up-heading 1 t))
│            (push (cons (org-link-display-format
│                         (nth 4 (org-heading-components)))
│                        (point))
│                  org-heading-titles-list))))))
│   (org-with-wide-buffer
│    (save-excursion
│      (save-restriction
│        (goto-char
│         (popup-menu* (mapcar
│                       (lambda (x)
│                         (popup-make-item (car x) :value (cdr x)))
│                       org-heading-titles-list)
│                      :isearch t
│                      :initial-index (length org-heading-titles-list)))
│        (org-tree-to-indirect-buffer)))))
└────

-- 
Juan Manuel Macías

https://juanmanuelmacias.com

https://lunotipia.juanmanuelmacias.com

https://gnutas.juanmanuelmacias.com


      reply	other threads:[~2023-08-20 10:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-18 18:27 [Tip] Popup-menu with several actions for a link Juan Manuel Macías
2023-08-19 19:53 ` Ihor Radchenko
2023-08-19 20:29   ` Juan Manuel Macías
2023-08-20  7:23     ` Ihor Radchenko
2023-08-20 10:13       ` Juan Manuel Macías [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y1i6c988.fsf@posteo.net \
    --to=maciaschain@posteo.net \
    --cc=emacs-orgmode@gnu.org \
    --cc=yantar92@posteo.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).