]> git.donarmstrong.com Git - org-ref.git/blobdiff - org-ref.org
add new nonascii '
[org-ref.git] / org-ref.org
index b69062201b7c210fb8e0c00f7383c50b60e04089..f9bc3adb7f23e64267f0ff9902e57b3f0da6d258 100644 (file)
@@ -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)))))