]> git.donarmstrong.com Git - org-ref.git/blobdiff - org-ref.org
fix space issue in sorting keys
[org-ref.git] / org-ref.org
index e0c321698a9e8fef054d6a5ea4ad07f2fa88d2ec..a300bdde6bffb993533bdb594e27fcbfe3f45117 100644 (file)
@@ -3226,7 +3226,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)))))
@@ -3781,7 +3791,7 @@ This is a list of cons cells '((\"description\" . action)). The action function
  '("Example" . (lambda () (message-box "You did it!")))
  t)
 
-;;;###qautoload
+;;;###autoload
 (defun org-ref-cite-click-helm (key)
   "Open helm for actions on a cite link.
 subtle points.