- ;; now if we have comma separated bibliographies
- ;; we find the one clicked on. we want to
- ;; search forward to next comma from point
- (save-excursion
- (if (search-forward "," link-string-end 1 1)
- (setq key-end (- (match-end 0) 1)) ; we found a match
- (setq key-end (point)))) ; no comma found so take the point
- ;; and backward to previous comma from point
- (save-excursion
- (if (search-backward "," link-string-beginning 1 1)
- (setq key-beginning (+ (match-beginning 0) 1)) ; we found a match
- (setq key-beginning (point)))) ; no match found
- ;; save the key we clicked on.
- (setq bibfile (org-ref-strip-string (buffer-substring key-beginning key-end)))
- (find-file bibfile))) ; open file on click
+ (let (key-beginning key-end)
+ ;; now if we have comma separated bibliographies
+ ;; we find the one clicked on. we want to
+ ;; search forward to next comma from point
+ (save-excursion
+ (if (search-forward "," link-string-end 1 1)
+ (setq key-end (- (match-end 0) 1)) ; we found a match
+ (setq key-end (point)))) ; no comma found so take the point
+ ;; and backward to previous comma from point
+ (save-excursion
+ (if (search-backward "," link-string-beginning 1 1)
+ (setq key-beginning (+ (match-beginning 0) 1)) ; we found a match
+ (setq key-beginning (point)))) ; no match found
+ ;; save the key we clicked on.
+ (setq bibfile (org-ref-strip-string (buffer-substring key-beginning key-end)))
+ (find-file bibfile)))) ; open file on click