Is there a command to display and automatically copy to clipboard both the current version of Emacs and the current version of org-mode?

  • 1
    That's pretty idiosyncratic, so you'll probably need to write it yourself. What have you tried?
    – Dan
    Apr 22, 2017 at 18:22
  • Here's what I have. Doesn't work. (defun display-and-copy-version-info () "Echo the current version of Spacemacs, Emacs, and org-mode, and copy it." (interactive) (let ((msg (format "Spacemacs v.%s" spacemacs-version "Emacs" emacs-version "org-mode" org-version))) (message msg) (clipboard-kill-ring-save msg))) I feel like it would be useful to anyone who needs to submit issues for any package that's org-mode related. Apr 22, 2017 at 18:37
  • @incandescentman it looks like you're confusing between concat and format.
    – npostavs
    Apr 22, 2017 at 19:05
  • @npostavs When I change it to concat I get edebug-read-sexp: Lisp nesting exceeds ‘max-lisp-eval-depth’ Apr 23, 2017 at 5:47
  • 2
    Not directly related, but may of interest in this context: the functions emacs-version and org-version take a prefix argument which says "put the output in this buffer". So if you are composing your bug report in emacs, all you have to do is C-u M-x emacs-version and C-u M-x org-version and you are done. You can also wrap the two calls into a single function of course, or bind them to keys.
    – NickD
    Apr 24, 2017 at 14:31

1 Answer 1


I suggest you take a look at the doc string for function format, with C-h f format (M-x describe-function). It is similar to the C language printf, if you know that. The doc string for message includes:

(message FORMAT-STRING &rest ARGS)

Display a message at the bottom of the screen. The message also goes into the ‘Messages’ buffer, if ‘message-log-max’ is non-nil. (In keyboard macros, that’s all it does.) Return the message.

Also, the docstring for clipboard-kill-ring-save shows you don't call it with the proper arguments, and in fact is to be used when copying some text from a buffer, not from a string.

Searching for "kill-ring" in the index of the info elisp manual can bring to the section Low-Level Kill Ring where the function kill-new is described. Since message returns the displayed string, we can feed it directly to kill-new.

(defun display-and-copy-version-info ()
  "Echo the current version of Spacemacs, Emacs, and org-mode, and copy it."
     (message "Spacemacs v.%s Emacs %s org-mode %s"
              spacemacs-version emacs-version org-version)))
  • You should use (message "%s" msg) to be safe (probably none of the versions will include a % so it doesn't really matter, but still...)
    – npostavs
    Apr 24, 2017 at 14:19
  • @npostavs Indeed, thanx.
    – JeanPierre
    Apr 24, 2017 at 14:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.