[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Tip] Popup-menu with several actions for a link
From: |
Juan Manuel Macías |
Subject: |
Re: [Tip] Popup-menu with several actions for a link |
Date: |
Sun, 20 Aug 2023 10:13:27 +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