* Open a footnote definition outside a narrowed subtree (workaround)
@ 2022-02-22 16:04 Juan Manuel Macías
2022-02-22 16:45 ` Nicolas Goaziou
0 siblings, 1 reply; 3+ messages in thread
From: Juan Manuel Macías @ 2022-02-22 16:04 UTC (permalink / raw)
To: orgmode
Hi all,
When I am working on a narrowed subtree and want to open a footnote for
editing (`C-c C-o': `org-open-at-point'), I get the message: "Definition
is outside narrowed part of buffer". I don't know if there is a
"standard" solution for that (aside from cloning the buffer and/or
removing the restrictions)... I’ve written this simple and quick
workaround, and then remapped `C-c C-o' so that:
`C-u C-c C-o'
my function
`C-c C-o'
`org-open-at-point'
┌────
│ (defun my-org-open-fn-indirect-buffer ()
│ (interactive)
│ (if (not (equal (org-element-type (org-element-context)) 'footnote-reference))
│ (error "Not in a footnote reference!")
│ (let* ((el (org-element-context))
│ (label (org-element-property :label el))
│ (buf (buffer-name))
│ (format (format "%s | Note %s" buf label)))
│ (when (get-buffer format)
│ (kill-buffer format))
│ (clone-indirect-buffer format t)
│ (setq header-line-format (format "NOTE %s" label))
│ (widen)
│ (org-open-at-point)
│ (recenter 0))))
│
│ (defun my-org-open-at-point ()
│ (interactive)
│ (if (equal current-prefix-arg nil)
│ (org-open-at-point)
│ (my-org-open-fn-indirect-buffer)))
│
│ (with-eval-after-load 'org
│ (define-key org-mode-map (kbd "C-c C-o") nil)
│ (define-key org-mode-map (kbd "C-c C-o") 'my-org-open-at-point))
└────
Best regards,
Juan Manuel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-02-22 17:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-22 16:04 Open a footnote definition outside a narrowed subtree (workaround) Juan Manuel Macías
2022-02-22 16:45 ` Nicolas Goaziou
2022-02-22 17:34 ` Juan Manuel Macías
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).