I don't know if it is possible to get helm-bibtex to insert links with
pre/post text in a way that doesn't get in the (i.e. my) way. I never use
pre/post text, so I want to select entries, and press enter to insert them.
There would have to be some prompt for pre and post text I think, and I
wouldn't want to press enter two more times to get empty ones.

You could write your own function for that like this:

#+BEGIN_SRC emacs-lisp
(defun my-insert (candidate)
  (insert (format "[[cite:%s]%s]"
 candidate
 (let ((pre (read-input "pre-text: "))
(post (read-input "post text: ")))
   (cond
    ;; both pre and post
    ((and (not (string= pre ""))
  (not (string= post "")))
     (format "[%s::%s]" pre post))
    ;; only pre
    ((and (not (string= pre ""))
  (string= post ""))
     (format "[%s]" pre))
    ((and (not (string= post ""))
  (string= pre ""))
     (format "[::%s]" post)))))))

(helm-add-action-to-source "pre/post insert cite" 'my-insert
  helm-source-bibtex)
#+END_SRC

we already use C-u to insert a ref link, and C-u C-u to insert a label link
on C-c ] (which inserts a citation).

John

-----------------------------------
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu


On Thu, Jan 5, 2017 at 12:20 PM, Gerald Wildgruber <
gerald.wildgru...@unibas.ch> wrote:

>
> On Mi, Jan 04 2017, John Kitchin <jkitc...@andrew.cmu.edu> wrote:
>
>
> >> A simple link would be of the form "cite:MYREF" or "citep:MYREF"; but if
> >> I want to add a page number to this reference, the syntax of the link
> >> seems to be very different, like so: "[[citep:MYREF][PAGENUM]]" or
> >> [[citep:MYREF][::PAGENUM]].
> >
> > That is correct. Basically it is [[cite:key][pre text::post text]]
> >
> > You can type C-c C-l, select the link type, then the bibtex key, then
> > type in the description. There is no way to do it through helm-bibtex
> though.
>
> Thanks! Is there a reason why refs with pre- and post-text use the
> general Org-mode link syntax and insert mechanisms and not org-ref's own
> more powerful format and interface (helm-bibtex); why are they handled
> differently?
>
> Gerald.
>
>
> --
> Dr.Gerald Wildgruber
> eikones NFS Bildkritik
> NCCR Iconic Criticism
> Universität Basel
> Rheinsprung 11
> CH-4051 Basel
> www.eikones.ch
> T. +41 (0)61 267 18 02
> F. +41 (0)61 267 18 11
> ---------------------
> Sent with mu4e
>

Reply via email to