From: "Juan Manuel Macías" <maciaschain@posteo.net>
To: orgmode <emacs-orgmode@gnu.org>
Subject: Open a footnote definition outside a narrowed subtree (workaround)
Date: Tue, 22 Feb 2022 16:04:13 +0000 [thread overview]
Message-ID: <878ru23n2a.fsf@posteo.net> (raw)
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
next reply other threads:[~2022-02-22 16:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-22 16:04 Juan Manuel Macías [this message]
2022-02-22 16:45 ` Open a footnote definition outside a narrowed subtree (workaround) Nicolas Goaziou
2022-02-22 17:34 ` Juan Manuel Macías
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=878ru23n2a.fsf@posteo.net \
--to=maciaschain@posteo.net \
--cc=emacs-orgmode@gnu.org \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.