X-Git-Url: https://git.donarmstrong.com/?p=org-ref.git;a=blobdiff_plain;f=org-ref.org;h=f9bc3adb7f23e64267f0ff9902e57b3f0da6d258;hp=b69062201b7c210fb8e0c00f7383c50b60e04089;hb=176463683cd4543bacf9a6573e5d2d9dc324da72;hpb=ad4841a2541783f57e60610e6804dcda0df9df79 diff --git a/org-ref.org b/org-ref.org index b690622..f9bc3ad 100644 --- a/org-ref.org +++ b/org-ref.org @@ -1,3 +1,4 @@ +# -*- org-edit-src-content-indentation: 0; -*- #+TITLE: Org-ref - The best reference handling for org-mode #+AUTHOR: John Kitchin #+DATE: April 29, 2014 @@ -3226,7 +3227,17 @@ Sometimes it may be helpful to manually change the order of citations. These fun (org-ref-swap-keys i (- i 1) keys)) (setq keys (mapconcat 'identity keys ",")) ;; and replace the link with the sorted keys - (cl--set-buffer-substring begin end (concat type ":" keys " ")) + (cl--set-buffer-substring + begin end + (concat + type ":" keys + ;; It seems the space at the end can get consumed, so we see if there + ;; is a space, and add it if so. Sometimes there is a comma or period, + ;; then we do not want a space. + (when + (save-excursion + (goto-char end) + (looking-back " ")) " "))) ;; now go forward to key so we can move with the key (re-search-forward key) (goto-char (match-beginning 0)))))