emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: John Kitchin <jkitchin@andrew.cmu.edu>
To: Daniele Nicolodi <daniele@grinta.net>
Cc: org-mode-email <emacs-orgmode@gnu.org>
Subject: Re: what do do when multiple functions store a link
Date: Sat, 2 Jan 2021 09:55:44 -0500	[thread overview]
Message-ID: <CAJ51EToKcJWxS8WkX+D9up_E8HsvsGM0pfog=ZbNsoEc=+cwtQ@mail.gmail.com> (raw)
In-Reply-To: <54d60a65-eee0-deac-c7ba-9d18dbce27b6@grinta.net>

[-- Attachment #1: Type: text/plain, Size: 1822 bytes --]

Here is a very grungy solution:

(defun scimax-store-link-advice (orig-fun &rest args)
  (cl-letf (((symbol-function 'symbol-name)
	     (lambda (_)
    (apply orig-fun args)))

(advice-add 'org-store-link :around 'scimax-store-link-advice)

It works by temporarily redefining symbol-name to return an empty string.
It's only redeeming qualities are 1) it works, 2) you don't have to modify
the org src code!


Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213

On Sat, Jan 2, 2021 at 9:37 AM Daniele Nicolodi <daniele@grinta.net> wrote:

> On 02/01/2021 14:49, John Kitchin wrote:
> > Recently I have had an issue where multiple functions may store a link,
> > e.g. to a bibtex entry.
> >
> > In this case, org-mode seems to prompt me to ask which function to store
> > the link with, with an initial input of the first function, which masks
> > all the options that are available. This happens
> > inside |org-store-link| in ol.el at line 1495 for me. in
> >
> > (apply #'org-link-store-props
> > (cdr (assoc-string
> >       (completing-read
> > "Which function for creating the link? "
> > (mapcar #'car results-alist)
> > nil t (symbol-name name))
> >       results-alist)))
> >
> > because of the (symbol-name name).
> >
> > Is there an easy way to avoid this, or to modify the order of the
> > functions used? I want to see all the options for storing, or better, to
> > just store them all and let me choose later when I use org-insert-link.
> I have the exact same problem. I think it comes from having org-bibtex
> and org-ref loaded at the same time. I haven't investigated a possible
> solution.
> Cheers,
> Dan

[-- Attachment #2: Type: text/html, Size: 2924 bytes --]

  reply	other threads:[~2021-01-02 14:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-02 13:49 what do do when multiple functions store a link John Kitchin
2021-01-02 14:37 ` Daniele Nicolodi
2021-01-02 14:55   ` John Kitchin [this message]
2021-01-02 22:13 ` [PATCH] ol: Avoid initial input when completing function for storing link Kyle Meyer
2021-01-05  5:16   ` Kyle Meyer
2021-04-25  3:38     ` Timothy

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:

  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='CAJ51EToKcJWxS8WkX+D9up_E8HsvsGM0pfog=ZbNsoEc=+cwtQ@mail.gmail.com' \
    --to=jkitchin@andrew.cmu.edu \
    --cc=daniele@grinta.net \
    --cc=emacs-orgmode@gnu.org \


* 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


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).